spark-未定义架构,在以下位置未找到Parquet数据文件或摘要文件 [英] spark - No schema defined, and no Parquet data file or summary file found under

查看:83
本文介绍了spark-未定义架构,在以下位置未找到Parquet数据文件或摘要文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先我开始

$SPARK_HOME/bin/pyspark

并编写此代码

sqlContext.load("jdbc", url="jdbc:mysql://IP:3306/test", driver="com.mysql.jdbc.Driver", dbtable="test.test_tb")

当我只写dbtable ="test_db"时,错误是相同的.

发生此错误后,

py4j.protocol.Py4JJavaError:调用o66.load时发生错误. :java.lang.AssertionError:断言失败:未定义架构,也没有在下找到Parquet数据文件或摘要文件. 在scala.Predef $ .assert(Predef.scala:179) 在org.apache.spark.sql.parquet.ParquetRelation2 $ MetadataCache.org $ apache $ spark $ sql $ parquet $ ParquetRelation2 $ MetadataCache $$ readSchema(newParquet.scala:429) .....

py4j.protocol.Py4JJavaError: An error occurred while calling o66.load. : java.lang.AssertionError: assertion failed: No schema defined, and no Parquet data file or summary file found under . at scala.Predef$.assert(Predef.scala:179) at org.apache.spark.sql.parquet.ParquetRelation2$MetadataCache.org$apache$spark$sql$parquet$ParquetRelation2$MetadataCache$$readSchema(newParquet.scala:429) .....

为什么会发生此错误? 我想知道并解决这个问题.

why this error was occured?? I want to know and solve this problem.

谢谢.

推荐答案

我不知道发生此错误的原因,但我偶然发现了该错误,然后找到了使同一事物起作用的方法.

I don't know the reason of this error, but I stumbled upon it, and then found a way to make the same thing work.

尝试一下:

df = sqlContext.read.format("jdbc").options(url="jdbc:mysql://server/table?user=usr&password=secret", dbtable="table_name").load()

我认为.load语法不再有效,或者不适用于jdbc.希望它能起作用!

I suppose the .load syntax is no longer working, or does not work for jdbc. Hope it works!

顺便说一句,我使用以下命令启动了控制台:

By the way, I started the console with this command:

SPARK_CLASSPATH=~/progs/postgresql-9.4-1205.jdbc42.jar pyspark

我的数据库位于postgres中,因此我按照文档中的建议下载了带有jdbc的jar,并将其添加到我的类路径中. http://spark.apache.org /docs/latest/sql-programming-guide.html#jdbc-to-other-databases

My db is in postgres, and so I downloaded the jar with the jdbc, and added it to my classpath as suggested in the documentation. http://spark.apache.org/docs/latest/sql-programming-guide.html#jdbc-to-other-databases

这篇关于spark-未定义架构,在以下位置未找到Parquet数据文件或摘要文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆