Java Spark sql数据集<行>写镶木地板

时间:2019-02-06 15:49:21

标签: java apache-spark apache-spark-sql parquet

将数据集<行>写入Parquet时出现以下错误。

data.write().option("compression",snappy").format("parquet").mode(SaveMode.Overwrite).save(filePath);
  

java.lang.NoClassDefFoundError:无法初始化类   org.apache.spark.sql.execution.datasources.parquet.ParquetOptions $在   org.apache.spark.sql.execution.datasources.parquet.ParquetOptions。(ParquetOptions.scala:55)     在   org.apache.spark.sql.execution.datasources.parquet.ParquetOptions。(ParquetOptions.scala:39)     在   org.apache.spark.sql.execution.datasources.parquet.ParquetFileFormat.prepareWrite(ParquetFileFormat.scala:80)     在   org.apache.spark.sql.execution.datasources.FileFormatWriter $ .write(FileFormatWriter.scala:103)     在   org.apache.spark.sql.execution.datasources.InsertIntoHadoopFsRelationCommand.run(InsertIntoHadoopFsRelationCommand.scala:159)     在   org.apache.spark.sql.execution.command.DataWritingCommandExec.sideEffectResult $ lzycompute(commands.scala:104)     在   org.apache.spark.sql.execution.command.DataWritingCommandExec.sideEffectResult(commands.scala:102)     在   org.apache.spark.sql.execution.command.DataWritingCommandExec.doExecute(commands.scala:122)     在   org.apache.spark.sql.execution.SparkPlan $$ anonfun $ execute $ 1.apply(SparkPlan.scala:131)     在   org.apache.spark.sql.execution.SparkPlan $$ anonfun $ execute $ 1.apply(SparkPlan.scala:127)     在   org.apache.spark.sql.execution.SparkPlan $$ anonfun $ executeQuery $ 1.apply(SparkPlan.scala:155)     在   org.apache.spark.rdd.RDDOperationScope $ .withScope(RDDOperationScope.scala:151)     在   org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:152)     在   org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:127)     在   org.apache.spark.sql.execution.QueryExecution.toRdd $ lzycompute(QueryExecution.scala:80)     在   org.apache.spark.sql.execution.QueryExecution.toRdd(QueryExecution.scala:80)     在   org.apache.spark.sql.DataFrameWriter $$ anonfun $ runCommand $ 1.apply(DataFrameWriter.scala:668)     在   org.apache.spark.sql.DataFrameWriter $$ anonfun $ runCommand $ 1.apply(DataFrameWriter.scala:668)     在   org.apache.spark.sql.execution.SQLExecution $$ anonfun $ withNewExecutionId $ 1.apply(SQLExecution.scala:78)     在   org.apache.spark.sql.execution.SQLExecution $ .withSQLConfPropagated(SQLExecution.scala:125)     在   org.apache.spark.sql.execution.SQLExecution $ .withNewExecutionId(SQLExecution.scala:73)     在   org.apache.spark.sql.DataFrameWriter.runCommand(DataFrameWriter.scala:668)     在   org.apache.spark.sql.DataFrameWriter.saveToV1Source(DataFrameWriter.scala:276)     在   org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:270)     在   org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:228)     在   package.common.dao.service.spark.utils.SparkDataBaseUtilImpl.writeParquetFile(SparkDataBaseUtilImpl.java:121)     在   package.common.dao.service.spark.SparkImportServiceImpl.csvFileImport(SparkImportServiceImpl.java:29)     在   package.common.dao.service.spark.SparkDaoServiceImpl.dataImport(SparkDaoServiceImpl.java:70)     在   package.common.dao.service.spark.SparkDaoServiceImpl.executeOperations(SparkDaoServiceImpl.java:37)     在   package.controller.ServiceDao.fetchJobDetailsByJobId(ServiceDao.java:28)     在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     在   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:498)在   com.sun.jersey.spi.container.JavaMethodInvokerFactory $ 1.invoke(JavaMethodInvokerFactory.java:60)     在   com.sun.jersey.server.impl.model.method.dispatch.Abs​​tractResourceMethodDispatchProvider $ TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)     在   com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)     在   com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)     在   com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)     在   com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)     在   com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)     在   com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)     在   com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)     在   com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)     在   com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)     在   com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)     在   com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)     在   com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540)     在   com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:742)   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)     在   org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)     在   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)     在   org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)     在   org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)     在   org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)     在   org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)     在   org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)     在   org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)     在   org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)     在   org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)     在   org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)     在   org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)     在   org.apache.coyote.AbstractProtocol $ ConnectionHandler.process(AbstractProtocol.java:806)     在   org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun(NioEndpoint.java:1498)     在   org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)     在   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)     在   java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624)     在   org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61)     在java.lang.Thread.run(Thread.java:748)

我检查了所有依赖关系,一切似乎都很好。我使用的是最新的Spark版本2.4.0。

0 个答案:

没有答案