I referred this link 并且添加了spark.sql.catalogImplementation = hive添加了spark-default.xml会话详细信息。我也启用了蜂巢,但仍然出现相同的错误。请注意,我在本地模式下从Eclipse运行,这使我可以打开会话。
SparkSession spark = SparkSession
.builder()
.appName(SessionCode)
// .config("spark.some.config.option", "some-value")
//.master("use spark-submit")
.enableHiveSupport()
.config("spark.sql.warehouse.dir", "/user/hive/warehouse")
.getOrCreate();
sp=spark;
LogUtil.logMessage("Session details"+sp.conf().getAll(), "INFO");
我正在使用spark 2.3.2,配置显示了这一点
Map(spark.sql.warehouse.dir -> /user/hive/warehouse,
spark.driver.host -> PARAY-IN.in.oracle.com,
spark.driver.port -> 51551,
spark.jars -> C:\Work\workspaces\SparkJvGradlePOC\build\libs\SparkJvGradlePOC1.0.jar,
spark.hadoop.fs.defaultFS -> hdfs://whf00aql,
spark.hadoop.yarn.resourcemanager.address -> whf00aql:8032,
spark.app.name -> TestSession,
spark.executor.id -> driver, spark.master -> local,
spark.hadoop.dfs.nameservices -> whf00aql:8020,
spark.sql.catalogImplementation -> hive,
spark.hadoop.yarn.application.classpath -> $HADOOP_CONF_DIR,$HADOOP_COMMON_HOME/*,$HADOOP_COMMON_HOME/lib/*,$HADOOP_HDFS_HOME/*,$HADOOP_HDFS_HOME/lib/*,$HADOOP_YARN_HOME/*,$HADOOP_YARN_HOME/lib/*,$HADOOP_MAPRED_HOME/*,$HADOOP_MAPRED_HOME/lib/*, spark.hadoop.yarn.resourcemanager.hostname -> whf00aql,
spark.app.id -> local-1543579484518)
完整登录控制台:
18/12/03 15:34:18 INFO spark.SparkContext: Running Spark version 2.3.2
18/12/03 15:34:19 INFO spark.SparkContext: Submitted application: test1-spark-job2
18/12/03 15:34:19 INFO spark.SecurityManager: Changing view acls to: PARAY
18/12/03 15:34:19 INFO spark.SecurityManager: Changing modify acls to: PARAY
18/12/03 15:34:19 INFO spark.SecurityManager: Changing view acls groups to:
18/12/03 15:34:19 INFO spark.SecurityManager: Changing modify acls groups to:
18/12/03 15:34:19 INFO spark.SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(PARAY); groups with view permissions: Set(); users with modify permissions: Set(PARAY); groups with modify permissions: Set()
18/12/03 15:34:20 INFO util.Utils: Successfully started service 'sparkDriver' on port 55579.
18/12/03 15:34:20 INFO spark.SparkEnv: Registering MapOutputTracker
18/12/03 15:34:21 INFO spark.SparkEnv: Registering BlockManagerMaster
18/12/03 15:34:21 INFO storage.BlockManagerMasterEndpoint: Using org.apache.spark.storage.DefaultTopologyMapper for getting topology information
18/12/03 15:34:21 INFO storage.BlockManagerMasterEndpoint: BlockManagerMasterEndpoint up
18/12/03 15:34:21 INFO storage.DiskBlockManager: Created local directory at C:\Users\PARAY\AppData\Local\Temp\blockmgr-fb7a071e-afe9-4841-856c-fd880ca90451
18/12/03 15:34:21 INFO memory.MemoryStore: MemoryStore started with capacity 873.0 MB
18/12/03 15:34:21 INFO spark.SparkEnv: Registering OutputCommitCoordinator
18/12/03 15:34:21 INFO util.log: Logging initialized @7621ms
18/12/03 15:34:21 INFO server.Server: jetty-9.3.z-SNAPSHOT, build timestamp: unknown, git hash: unknown
18/12/03 15:34:21 INFO server.Server: Started @7845ms
18/12/03 15:34:21 INFO server.AbstractConnector: Started ServerConnector@1568159{HTTP/1.1,[http/1.1]}{0.0.0.0:4040}
18/12/03 15:34:21 INFO util.Utils: Successfully started service 'SparkUI' on port 4040.
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@7f69d591{/jobs,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@4985cbcb{/jobs/json,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@72f46e16{/jobs/job,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@332a7fce{/jobs/job/json,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@549621f3{/stages,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@54361a9{/stages/json,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@32232e55{/stages/stage,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@293bb8a5{/stages/stage/json,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@2416a51{/stages/pool,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@6fa590ba{/stages/pool/json,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@6e9319f{/storage,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@72e34f77{/storage/json,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@7bf9b098{/storage/rdd,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@389adf1d{/storage/rdd/json,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@77307458{/environment,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@1fc0053e{/environment/json,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@290b1b2e{/executors,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@47874b25{/executors/json,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@33617539{/executors/threadDump,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@2c177f9e{/executors/threadDump/json,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@5db4c359{/static,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@7997b197{/,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@11dee337{/api,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@770d4269{/jobs/job/kill,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@4a8ab068{/stages/stage/kill,null,AVAILABLE,@Spark}
18/12/03 15:34:21 INFO ui.SparkUI: Bound SparkUI to 0.0.0.0, and started at http://PARAY-IN.in.oracle.com:4040
18/12/03 15:34:22 INFO spark.SparkContext: Added JAR C:\Work\workspaces\SparkJvGradlePOC\build\libs\SparkJvGradlePOC-1.0.jar at spark://PARAY-IN.in.oracle.com:55579/jars/SparkJvGradlePOC-1.0.jar with timestamp 1543831462114
18/12/03 15:34:22 INFO executor.Executor: Starting executor ID driver on host localhost
18/12/03 15:34:22 INFO util.Utils: Successfully started service 'org.apache.spark.network.netty.NettyBlockTransferService' on port 55588.
18/12/03 15:34:22 INFO netty.NettyBlockTransferService: Server created on PARAY-IN.in.oracle.com:55588
18/12/03 15:34:22 INFO storage.BlockManager: Using org.apache.spark.storage.RandomBlockReplicationPolicy for block replication policy
18/12/03 15:34:22 INFO storage.BlockManagerMaster: Registering BlockManager BlockManagerId(driver, PARAY-IN.in.oracle.com, 55588, None)
18/12/03 15:34:22 INFO storage.BlockManagerMasterEndpoint: Registering block manager PARAY-IN.in.oracle.com:55588 with 873.0 MB RAM, BlockManagerId(driver, PARAY-IN.in.oracle.com, 55588, None)
18/12/03 15:34:22 INFO storage.BlockManagerMaster: Registered BlockManager BlockManagerId(driver, PARAY-IN.in.oracle.com, 55588, None)
18/12/03 15:34:22 INFO storage.BlockManager: Initialized BlockManager: BlockManagerId(driver, PARAY-IN.in.oracle.com, 55588, None)
18/12/03 15:34:22 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@697446d4{/metrics/json,null,AVAILABLE,@Spark}
creating sparksession
18/12/03 15:34:23 WARN spark.SparkContext: Using an existing SparkContext; some configuration may not take effect.
18/12/03 15:34:23 INFO internal.SharedState: loading hive config file: file:/C:/Work/workspaces/SparkJavaGrdl/resources/yarn-clientconfig/yarn-conf/hive-site.xml
18/12/03 15:34:23 INFO internal.SharedState: spark.sql.warehouse.dir is not set, but hive.metastore.warehouse.dir is set. Setting spark.sql.warehouse.dir to the value of hive.metastore.warehouse.dir ('/user/hive/warehouse').
18/12/03 15:34:23 INFO internal.SharedState: Warehouse path is '/user/hive/warehouse'.
18/12/03 15:34:23 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@19593091{/SQL,null,AVAILABLE,@Spark}
18/12/03 15:34:23 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@5d39f2d8{/SQL/json,null,AVAILABLE,@Spark}
18/12/03 15:34:23 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@175acfb2{/SQL/execution,null,AVAILABLE,@Spark}
18/12/03 15:34:23 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@4a03bb68{/SQL/execution/json,null,AVAILABLE,@Spark}
18/12/03 15:34:23 INFO handler.ContextHandler: Started o.s.j.s.ServletContextHandler@1dab9dd6{/static/sql,null,AVAILABLE,@Spark}
18/12/03 15:34:25 INFO state.StateStoreCoordinatorRef: Registered StateStoreCoordinator endpoint
[INFO] Session detailsMap(spark.sql.warehouse.dir -> /user/hive/warehouse, spark.driver.host -> PARAY-IN.in.oracle.com, spark.driver.port -> 55579, spark.jars -> C:\Work\workspaces\SparkJvGradlePOC\build\libs\SparkJvGradlePOC-1.0.jar, spark.hadoop.fs.defaultFS -> hdfs://whf00aql, spark.hadoop.yarn.resourcemanager.address -> whf00aql:8032, spark.app.name -> TestSession, spark.executor.id -> driver, spark.master -> local, spark.hadoop.dfs.nameservices -> whf00aql:8020, spark.sql.catalogImplementation -> hive, spark.hadoop.yarn.application.classpath -> $HADOOP_CONF_DIR,$HADOOP_COMMON_HOME/*,$HADOOP_COMMON_HOME/lib/*,$HADOOP_HDFS_HOME/*,$HADOOP_HDFS_HOME/lib/*,$HADOOP_YARN_HOME/*,$HADOOP_YARN_HOME/lib/*,$HADOOP_MAPRED_HOME/*,$HADOOP_MAPRED_HOME/lib/*, spark.hadoop.yarn.resourcemanager.hostname -> whf00aql, spark.app.id -> local-1543831462204)
ENVSP01:Spark session test:true
Failed creating table Hive support is required to CREATE Hive TABLE (AS SELECT);;
'CreateTable `fct_exchane_rate`, org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, Ignore
Failed creating table org.apache.spark.sql.AnalysisException: Hive support is required to CREATE Hive TABLE (AS SELECT);;
'CreateTable `fct_exchane_rate`, org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, Ignore
Failed creating table null
DAO01:Exchange Rate DAO test:testAdd(com.oracle.fsgbu.analytics.dao.test.ExchangeRateDaoTest): null
DAO01:Exchange Rate DAO test:false
18/12/03 15:34:30 INFO spark.SparkContext: Invoking stop() from shutdown hook
18/12/03 15:34:30 INFO server.AbstractConnector: Stopped Spark@1568159{HTTP/1.1,[http/1.1]}{0.0.0.0:4040}
18/12/03 15:34:30 INFO ui.SparkUI: Stopped Spark web UI at http://PARAY-IN.in.oracle.com:4040
18/12/03 15:34:30 INFO spark.MapOutputTrackerMasterEndpoint: MapOutputTrackerMasterEndpoint stopped!
18/12/03 15:34:30 INFO memory.MemoryStore: MemoryStore cleared
18/12/03 15:34:30 INFO storage.BlockManager: BlockManager stopped
18/12/03 15:34:30 INFO storage.BlockManagerMaster: BlockManagerMaster stopped
18/12/03 15:34:30 INFO scheduler.OutputCommitCoordinator$OutputCommitCoordinatorEndpoint: OutputCommitCoordinator stopped!
18/12/03 15:34:30 INFO spark.SparkContext: Successfully stopped SparkContext
18/12/03 15:34:30 INFO util.ShutdownHookManager: Shutdown hook called
18/12/03 15:34:30 INFO util.ShutdownHookManager: Deleting directory C:\Users\PARAY\AppData\Local\Temp\spark-c194cfea-ce04-48cd-b2f7-d04d06f3401b