报错信息如下:
2019-04-28 21:55:26 [main] [org.apache.hadoop.util.Shell] [ERROR] - Failed to locate the winutils binary in the hadoop binary path
java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.
at org.apache.hadoop.util.Shell.getQualifiedBinPath(Shell.java:378)
at org.apache.hadoop.util.Shell.getWinUtilsPath(Shell.java:393)
at org.apache.hadoop.util.Shell.(Shell.java:386)
at org.apache.hadoop.hive.conf.HiveConf$ConfVars.findHadoopBinary(HiveConf.java:2327)
at org.apache.hadoop.hive.conf.HiveConf$ConfVars.(HiveConf.java:365)
at org.apache.hadoop.hive.conf.HiveConf.(HiveConf.java:105)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.apache.spark.util.Utils$.classForName(Utils.scala:230)
at org.apache.spark.sql.SparkSession$.hiveClassesArePresent(SparkSession.scala:1063)
at org.apache.spark.sql.SparkSession$Builder.enableHiveSupport(SparkSession.scala:842)
at readhive.ReadHive$.main(ReadHive.scala:13)
at readhive.ReadHive.main(ReadHive.scala)
2019-04-28 21:55:28 [main] [org.apache.spark.SparkContext] [INFO] - Running Spark version 2.2.0
2019-04-28 21:55:28 [main] [org.apache.hadoop.util.NativeCodeLoader] [WARN] - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
2019-04-28 21:55:29 [main] [org.apache.spark.SparkContext] [INFO] - Submitted application: ReadHive
2019-04-28 21:55:29 [main] [org.apache.spark.SecurityManager] [INFO] - Changing view acls to: hdfs,Administrator
2019-04-28 21:55:29 [main] [org.apache.spark.SecurityManager] [INFO] - Changing modify acls to: hdfs,Administrator
2019-04-28 21:55:29 [main] [org.apache.spark.SecurityManager] [INFO] - Changing view acls groups to:
2019-04-28 21:55:29 [main] [org.apache.spark.SecurityManager] [INFO] - Changing modify acls groups to:
2019-04-28 21:55:29 [main] [org.apache.spark.SecurityManager] [INFO] - SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(hdfs, Administrator); groups with view permissions: Set(); users with modify permissions: Set(hdfs, Administrator); groups with modify permissions: Set()
2019-04-28 21:55:30 [main] [org.apache.spark.util.Utils] [INFO] - Successfully started service 'sparkDriver' on port 60715.
2019-04-28 21:55:30 [main] [org.apache.spark.SparkEnv] [INFO] - Registering MapOutputTracker
2019-04-28 21:55:30 [main] [org.apache.spark.SparkEnv] [INFO] - Registering BlockManagerMaster
2019-04-28 21:55:30 [main] [org.apache.spark.storage.BlockManagerMasterEndpoint] [INFO] - Using org.apache.spark.storage.DefaultTopologyMapper for getting topology information
2019-04-28 21:55:30 [main] [org.apache.spark.storage.BlockManagerMasterEndpoint] [INFO] - BlockManagerMasterEndpoint up
2019-04-28 21:55:30 [main] [org.apache.spark.storage.DiskBlockManager] [INFO] - Created local directory at C:\Users\Administrator.USER-20140612OG\AppData\Local\Temp\blockmgr-371dc45d-1ff8-48db-8604-034990947f1e
2019-04-28 21:55:30 [main] [org.apache.spark.storage.memory.MemoryStore] [INFO] - MemoryStore started with capacity 1443.6 MB
2019-04-28 21:55:30 [main] [org.apache.spark.SparkEnv] [INFO] - Registering OutputCommitCoordinator
2019-04-28 21:55:30 [main] [org.spark_project.jetty.util.log] [INFO] - Logging initialized @6521ms
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.Server] [INFO] - jetty-9.3.z-SNAPSHOT
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.Server] [INFO] - Started @6638ms
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.AbstractConnector] [INFO] - Started ServerConnector@c5130a7{HTTP/1.1,[http/1.1]}{0.0.0.0:4040}
2019-04-28 21:55:30 [main] [org.apache.spark.util.Utils] [INFO] - Successfully started service 'SparkUI' on port 4040.
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@4940809c{/jobs,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@4da855dd{/jobs/json,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@2187fff7{/jobs/job,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@4de025bf{/jobs/job/json,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@1eef9aef{/stages,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@5db99216{/stages/json,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@5c1bd44c{/stages/stage,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@2c4ca0f9{/stages/stage/json,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@7df587ef{/stages/pool,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@2755d705{/stages/pool/json,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@740abb5{/storage,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@5fe8b721{/storage/json,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@578524c3{/storage/rdd,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@7e094740{/storage/rdd/json,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@4cc547a{/environment,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@4152d38d{/environment/json,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@5398edd0{/executors,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@5cc5b667{/executors/json,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@758f4f03{/executors/threadDump,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@6928f576{/executors/threadDump/json,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@69f63d95{/static,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@59a67c3a{/,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@724bade8{/api,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@9573b3b{/jobs/job/kill,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@78461bc4{/stages/stage/kill,null,AVAILABLE,@Spark}
2019-04-28 21:55:30 [main] [org.apache.spark.ui.SparkUI] [INFO] - Bound SparkUI to 0.0.0.0, and started at http://169.254.210.91:4040
2019-04-28 21:55:31 [main] [org.apache.spark.executor.Executor] [INFO] - Starting executor ID driver on host localhost
2019-04-28 21:55:31 [main] [org.apache.spark.util.Utils] [INFO] - Successfully started service 'org.apache.spark.network.netty.NettyBlockTransferService' on port 60728.
2019-04-28 21:55:31 [main] [org.apache.spark.network.netty.NettyBlockTransferService] [INFO] - Server created on 169.254.210.91:60728
2019-04-28 21:55:31 [main] [org.apache.spark.storage.BlockManager] [INFO] - Using org.apache.spark.storage.RandomBlockReplicationPolicy for block replication policy
2019-04-28 21:55:31 [main] [org.apache.spark.storage.BlockManagerMaster] [INFO] - Registering BlockManager BlockManagerId(driver, 169.254.210.91, 60728, None)
2019-04-28 21:55:31 [dispatcher-event-loop-2] [org.apache.spark.storage.BlockManagerMasterEndpoint] [INFO] - Registering block manager 169.254.210.91:60728 with 1443.6 MB RAM, BlockManagerId(driver, 169.254.210.91, 60728, None)
2019-04-28 21:55:31 [main] [org.apache.spark.storage.BlockManagerMaster] [INFO] - Registered BlockManager BlockManagerId(driver, 169.254.210.91, 60728, None)
2019-04-28 21:55:31 [main] [org.apache.spark.storage.BlockManager] [INFO] - Initialized BlockManager: BlockManagerId(driver, 169.254.210.91, 60728, None)
2019-04-28 21:55:31 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@3e521715{/metrics/json,null,AVAILABLE,@Spark}
2019-04-28 21:55:31 [main] [org.apache.spark.sql.internal.SharedState] [INFO] - loading hive config file: file:/E:/IDEA_work/firstscala/target/classes/hive-site.xml
2019-04-28 21:55:31 [main] [org.apache.spark.sql.internal.SharedState] [INFO] - Setting hive.metastore.warehouse.dir ('null') to the value of spark.sql.warehouse.dir ('file:/E:/IDEA_work/firstscala/spark-warehouse/').
2019-04-28 21:55:31 [main] [org.apache.spark.sql.internal.SharedState] [INFO] - Warehouse path is 'file:/E:/IDEA_work/firstscala/spark-warehouse/'.
2019-04-28 21:55:31 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@72ab05ed{/SQL,null,AVAILABLE,@Spark}
2019-04-28 21:55:31 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@c3c4c1c{/SQL/json,null,AVAILABLE,@Spark}
2019-04-28 21:55:31 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@6b7d1df8{/SQL/execution,null,AVAILABLE,@Spark}
2019-04-28 21:55:31 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@41d7b27f{/SQL/execution/json,null,AVAILABLE,@Spark}
2019-04-28 21:55:31 [main] [org.spark_project.jetty.server.handler.ContextHandler] [INFO] - Started o.s.j.s.ServletContextHandler@28952dea{/static/sql,null,AVAILABLE,@Spark}
2019-04-28 21:55:32 [main] [org.apache.spark.sql.hive.HiveUtils] [INFO] - Initializing HiveMetastoreConnection version 1.2.1 using Spark classes.
2019-04-28 21:55:33 [main] [org.apache.hadoop.hive.metastore.HiveMetaStore] [INFO] - 0: Opening raw store with implemenation class:org.apache.hadoop.hive.metastore.ObjectStore
2019-04-28 21:55:34 [main] [org.apache.hadoop.hive.metastore.ObjectStore] [INFO] - ObjectStore, initialize called
2019-04-28 21:55:34 [main] [DataNucleus.Persistence] [INFO] - Property hive.metastore.integral.jdo.pushdown unknown - will be ignored
2019-04-28 21:55:34 [main] [DataNucleus.Persistence] [INFO] - Property datanucleus.cache.level2 unknown - will be ignored
2019-04-28 21:55:35 [main] [org.apache.hadoop.hive.metastore.ObjectStore] [INFO] - Setting MetaStore object pin classes with hive.metastore.cache.pinobjtypes="Table,StorageDescriptor,SerDeInfo,Partition,Database,Type,FieldSchema,Order"
2019-04-28 21:55:36 [main] [DataNucleus.Datastore] [INFO] - The class "org.apache.hadoop.hive.metastore.model.MFieldSchema" is tagged as "embedded-only" so does not have its own datastore table.
2019-04-28 21:55:36 [main] [DataNucleus.Datastore] [INFO] - The class "org.apache.hadoop.hive.metastore.model.MOrder" is tagged as "embedded-only" so does not have its own datastore table.
2019-04-28 21:55:37 [main] [DataNucleus.Datastore] [INFO] - The class "org.apache.hadoop.hive.metastore.model.MFieldSchema" is tagged as "embedded-only" so does not have its own datastore table.
2019-04-28 21:55:37 [main] [DataNucleus.Datastore] [INFO] - The class "org.apache.hadoop.hive.metastore.model.MOrder" is tagged as "embedded-only" so does not have its own datastore table.
2019-04-28 21:55:37 [main] [DataNucleus.Query] [INFO] - Reading in results for query "org.datanucleus.store.rdbms.query.SQLQuery@0" since the connection used is closing
2019-04-28 21:55:37 [main] [org.apache.hadoop.hive.metastore.MetaStoreDirectSql] [INFO] - Using direct SQL, underlying DB is MYSQL
2019-04-28 21:55:37 [main] [org.apache.hadoop.hive.metastore.ObjectStore] [INFO] - Initialized ObjectStore
2019-04-28 21:55:37 [main] [org.apache.hadoop.hive.metastore.HiveMetaStore] [INFO] - Added admin role in metastore
2019-04-28 21:55:37 [main] [org.apache.hadoop.hive.metastore.HiveMetaStore] [INFO] - Added public role in metastore
2019-04-28 21:55:37 [main] [org.apache.hadoop.hive.metastore.HiveMetaStore] [INFO] - No user is added in admin role, since config is empty
2019-04-28 21:55:37 [main] [org.apache.hadoop.hive.metastore.HiveMetaStore] [INFO] - 0: get_all_databases
2019-04-28 21:55:37 [main] [org.apache.hadoop.hive.metastore.HiveMetaStore.audit] [INFO] - ugi=Administrator ip=unknown-ip-addr cmd=get_all_databases
2019-04-28 21:55:37 [main] [org.apache.hadoop.hive.metastore.HiveMetaStore] [INFO] - 0: get_functions: db=default pat=*
2019-04-28 21:55:37 [main] [org.apache.hadoop.hive.metastore.HiveMetaStore.audit] [INFO] - ugi=Administrator ip=unknown-ip-addr cmd=get_functions: db=default pat=*
2019-04-28 21:55:37 [main] [DataNucleus.Datastore] [INFO] - The class "org.apache.hadoop.hive.metastore.model.MResourceUri" is tagged as "embedded-only" so does not have its own datastore table.
2019-04-28 21:55:37 [main] [org.apache.hadoop.hive.metastore.HiveMetaStore] [INFO] - 0: get_functions: db=doudou_hive pat=*
2019-04-28 21:55:37 [main] [org.apache.hadoop.hive.metastore.HiveMetaStore.audit] [INFO] - ugi=Administrator ip=unknown-ip-addr cmd=get_functions: db=doudou_hive pat=*
2019-04-28 21:55:37 [main] [org.apache.hadoop.hive.metastore.HiveMetaStore] [INFO] - 0: get_functions: db=test pat=*
2019-04-28 21:55:37 [main] [org.apache.hadoop.hive.metastore.HiveMetaStore.audit] [INFO] - ugi=Administrator ip=unknown-ip-addr cmd=get_functions: db=test pat=*
Exception in thread "main" java.lang.IllegalArgumentException: Error while instantiating 'org.apache.spark.sql.hive.HiveSessionStateBuilder':
at org.apache.spark.sql.SparkSession$.org$apache$spark$sql$SparkSession$$instantiateSessionState(SparkSession.scala:1053)
at org.apache.spark.sql.SparkSession$$anonfun$sessionState$2.apply(SparkSession.scala:130)
at org.apache.spark.sql.SparkSession$$anonfun$sessionState$2.apply(SparkSession.scala:130)
at scala.Option.getOrElse(Option.scala:121)
at org.apache.spark.sql.SparkSession.sessionState$lzycompute(SparkSession.scala:129)
at org.apache.spark.sql.SparkSession.sessionState(SparkSession.scala:126)
at org.apache.spark.sql.SparkSession$Builder$$anonfun$getOrCreate$5.apply(SparkSession.scala:938)
at org.apache.spark.sql.SparkSession$Builder$$anonfun$getOrCreate$5.apply(SparkSession.scala:938)
at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:99)
at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:99)
at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:230)
at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:40)
at scala.collection.mutable.HashMap.foreach(HashMap.scala:99)
at org.apache.spark.sql.SparkSession$Builder.getOrCreate(SparkSession.scala:938)
at readhive.ReadHive$.main(ReadHive.scala:14)
at readhive.ReadHive.main(ReadHive.scala)
Caused by: org.apache.spark.sql.AnalysisException: java.lang.RuntimeException: java.lang.NullPointerException;
at org.apache.spark.sql.hive.HiveExternalCatalog.withClient(HiveExternalCatalog.scala:106)
at org.apache.spark.sql.hive.HiveExternalCatalog.databaseExists(HiveExternalCatalog.scala:193)
at org.apache.spark.sql.internal.SharedState.externalCatalog$lzycompute(SharedState.scala:105)
at org.apache.spark.sql.internal.SharedState.externalCatalog(SharedState.scala:93)
at org.apache.spark.sql.hive.HiveSessionStateBuilder.externalCatalog(HiveSessionStateBuilder.scala:39)
at org.apache.spark.sql.hive.HiveSessionStateBuilder.catalog$lzycompute(HiveSessionStateBuilder.scala:54)
at org.apache.spark.sql.hive.HiveSessionStateBuilder.catalog(HiveSessionStateBuilder.scala:52)
at org.apache.spark.sql.hive.HiveSessionStateBuilder.catalog(HiveSessionStateBuilder.scala:35)
at org.apache.spark.sql.internal.BaseSessionStateBuilder.build(BaseSessionStateBuilder.scala:289)
at org.apache.spark.sql.SparkSession$.org$apache$spark$sql$SparkSession$$instantiateSessionState(SparkSession.scala:1050)
... 15 more
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:522)
at org.apache.spark.sql.hive.client.HiveClientImpl.(HiveClientImpl.scala:191)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.spark.sql.hive.client.IsolatedClientLoader.createClient(IsolatedClientLoader.scala:264)
at org.apache.spark.sql.hive.HiveUtils$.newClientForMetadata(HiveUtils.scala:362)
at org.apache.spark.sql.hive.HiveUtils$.newClientForMetadata(HiveUtils.scala:266)
at org.apache.spark.sql.hive.HiveExternalCatalog.client$lzycompute(HiveExternalCatalog.scala:66)
at org.apache.spark.sql.hive.HiveExternalCatalog.client(HiveExternalCatalog.scala:65)
at org.apache.spark.sql.hive.HiveExternalCatalog$$anonfun$databaseExists$1.apply$mcZ$sp(HiveExternalCatalog.scala:194)
at org.apache.spark.sql.hive.HiveExternalCatalog$$anonfun$databaseExists$1.apply(HiveExternalCatalog.scala:194)
at org.apache.spark.sql.hive.HiveExternalCatalog$$anonfun$databaseExists$1.apply(HiveExternalCatalog.scala:194)
at org.apache.spark.sql.hive.HiveExternalCatalog.withClient(HiveExternalCatalog.scala:97)
... 24 more
Caused by: java.lang.NullPointerException
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1012)
at org.apache.hadoop.util.Shell.runCommand(Shell.java:505)
at org.apache.hadoop.util.Shell.run(Shell.java:478)
at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:738)
at org.apache.hadoop.util.Shell.execCommand(Shell.java:831)
at org.apache.hadoop.util.Shell.execCommand(Shell.java:814)
at org.apache.hadoop.fs.RawLocalFileSystem.setPermission(RawLocalFileSystem.java:664)
at org.apache.hadoop.fs.RawLocalFileSystem.mkdirs(RawLocalFileSystem.java:452)
at org.apache.hadoop.fs.FilterFileSystem.mkdirs(FilterFileSystem.java:309)
at org.apache.hadoop.hive.ql.session.SessionState.createPath(SessionState.java:639)
at org.apache.hadoop.hive.ql.session.SessionState.createSessionDirs(SessionState.java:567)
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:508)
... 38 more
2019-04-28 21:55:41 [Thread-1] [org.apache.spark.SparkContext] [INFO] - Invoking stop() from shutdown hook
2019-04-28 21:55:41 [Thread-1] [org.spark_project.jetty.server.AbstractConnector] [INFO] - Stopped Spark@c5130a7{HTTP/1.1,[http/1.1]}{0.0.0.0:4040}
2019-04-28 21:55:41 [Thread-1] [org.apache.spark.ui.SparkUI] [INFO] - Stopped Spark web UI at http://169.254.210.91:4040
2019-04-28 21:55:41 [dispatcher-event-loop-2] [org.apache.spark.MapOutputTrackerMasterEndpoint] [INFO] - MapOutputTrackerMasterEndpoint stopped!
2019-04-28 21:55:41 [Thread-1] [org.apache.spark.storage.memory.MemoryStore] [INFO] - MemoryStore cleared
2019-04-28 21:55:41 [Thread-1] [org.apache.spark.storage.BlockManager] [INFO] - BlockManager stopped
2019-04-28 21:55:41 [Thread-1] [org.apache.spark.storage.BlockManagerMaster] [INFO] - BlockManagerMaster stopped
2019-04-28 21:55:41 [dispatcher-event-loop-2] [org.apache.spark.scheduler.OutputCommitCoordinator$OutputCommitCoordinatorEndpoint] [INFO] - OutputCommitCoordinator stopped!
2019-04-28 21:55:41 [Thread-1] [org.apache.spark.SparkContext] [INFO] - Successfully stopped SparkContext
2019-04-28 21:55:41 [Thread-1] [org.apache.spark.util.ShutdownHookManager] [INFO] - Shutdown hook called
2019-04-28 21:55:41 [Thread-1] [org.apache.spark.util.ShutdownHookManager] [INFO] - Deleting directory C:\Users\Administrator.USER-20140612OG\AppData\Local\Temp\spark-cc18641f-5447-49fd-b099-1424aaaa0740
Process finished with exit code 1
[root@hadoop001 bin]# ./spark-shell --master local[2] --jars ../jars/mysql-connector-java.jar
Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).
19/04/28 21:46:32 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
19/04/28 21:46:58 ERROR ObjectStore: Version information found in metastore differs 1.1.0 from expected schema version 1.2.0. Schema verififcation is disabled hive.metastore.schema.verification so setting version.
19/04/28 21:47:03 WARN ObjectStore: Failed to get database global_temp, returning NoSuchObjectException
Spark context Web UI available at http://192.168.137.200:4040
Spark context available as 'sc' (master = local[2], app id = local-1556459198362).
Spark session available as 'spark'.
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 2.2.0
/_/
Using Scala version 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45)
Type in expressions to have them evaluated.
Type :help for more information.
scala> spark
spark spark_partition_id
scala> spark.sql("show databases").show
+------------+
|databaseName|
+------------+
| default|
| doudou_hive|
| test|
+------------+
object ReadHive {
def main(args: Array[String]): Unit = {
System.setProperty("hadoop.home.dir", "D:\\hadoop-common\\hadoop-common-2.2.0-bin-master")
val spark = SparkSession.builder()
.appName("ReadHive")
.master("local[2]")
.enableHiveSupport()
.getOrCreate()
val sqlDF = spark.sql("select * from emp")
sqlDF.show()
spark.stop()
}
}