Spark 2.0.0 - 镶木地板读空表

时间:2016-09-08 22:23:15

标签: r scala apache-spark parquet sparkr

我刚刚更新到Spark 2.0.0,我想在SparkR中阅读我的镶木地板文件:

library(SparkR, lib.loc = c(file.path(Sys.getenv("SPARK_HOME"), "R", "lib")))
sparkR.session(master = "local[*]", sparkConfig = list(spark.driver.memory = "2g"), sparkPackages = "com.databricks:spark-avro_2.11:3.0.0")

df1 <- read.parquet("my.parquet")

但是SparkDataFrame返回空。当我收集它时,我得到我的变量/列,但没有行。但是,此代码适用于我使用parquet生成的Spark 1.6.2

这个镶木地板文件是在另一个file.scala和Spark 2.0.0

中生成的
myDf.write.format("parquet").mode("overwrite")
.option("header", "true")
.option("parquet.enable.summary-metadata","true").save("my.parquet") 

Release Notes开始,“在编写Parquet文件时,默认情况下不会写入摘要文件。要重新启用它,用户必须将“parquet.enable.summary-metadata”设置为true.”,我那样。

myDf不为空,因为我可以用show()将其打印出来,并且文件通常由写入来创建:

./_common_metadata
./_metadata
./_SUCCESS
./part-r-00000-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00001-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00002-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00003-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00004-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00005-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00006-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00007-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00008-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00009-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00010-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00011-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00012-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00013-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00014-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00015-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00016-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00017-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00018-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00019-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00020-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00021-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00022-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00023-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00024-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00025-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00026-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00027-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00028-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet
./part-r-00029-6235ae25-fb7b-472b-9f0e-139907759393.snappy.parquet

myDF写得正确但未正确加载,或者写得不正确。对可能发生的事情的任何见解?

1 个答案:

答案 0 :(得分:1)

确实没有正确地写下镶木地板。

我在命令行中使用--packages "com.databricks:spark-csv_2.10:1.2.0"运行我的工作。但是,现在spark-csv中包含了Spark 2.0.0,而我正在调用它的错误版本。删除packages命令修复它。