Error: Spark2.0 ml algorithm running on Windows:

Exception in thread "main" java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: file:F:/program/MyPrograms/spark-warehouse
Copy the code

Error location:

val spark = SparkSession
      .builder
      .appName("EstimatorTransformerParamExample")
      .getOrCreate()
Copy the code

After the query, it is found that the database file address needs to be specified when spark SQL is used.

But spark SQL is not used here. SparkSession should be used instead of SQLContext and HiveContext.

To:

val spark = SparkSession
      .builder
      .appName("EstimatorTransformerParamExample")
      .config("spark.sql.warehouse.dir"."F:/program/MyPrograms/spark-warehouse")
Copy the code
      .master("local")
      .getOrCreate()
Copy the code

It’ll be ok.

or

.config("spark.sql.warehouse.dir"."file:///F:/program/MyPrograms/spark-warehouse")
Copy the code

\

This directory can be selected arbitrarily, using file:/// directly