You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Zikun (JIRA)" <ji...@apache.org> on 2018/01/19 19:57:00 UTC

[jira] [Updated] (SPARK-21994) Spark 2.2 can not read Parquet table created by itself

     [ https://issues.apache.org/jira/browse/SPARK-21994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zikun updated SPARK-21994:
--------------------------
    Attachment: Srinivasa Reddy Vundela.url

> Spark 2.2 can not read Parquet table created by itself
> ------------------------------------------------------
>
>                 Key: SPARK-21994
>                 URL: https://issues.apache.org/jira/browse/SPARK-21994
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.2.0
>         Environment: Spark 2.2 on Cloudera CDH 5.10.1, Hive 1.1
>            Reporter: Jurgis Pods
>            Priority: Major
>         Attachments: Srinivasa Reddy Vundela.url
>
>
> This seems to be a new bug introduced in Spark 2.2, since it did not occur under Spark 2.1.
> When writing a dataframe to a table in Parquet format, Spark SQL does not write the 'path' of the table to the Hive metastore, unlike in previous versions.
> As a consequence, Spark 2.2 is not able to read the table it just created. It just outputs the table header without any row content. 
> A parallel installation of Spark 1.6 at least produces an appropriate error trace:
> {code:java}
> 17/09/13 10:22:12 WARN metastore.ObjectStore: Version information not found in metastore. hive.metastore.schema.verification is not enabled so recording the schema version 1.1.0
> 17/09/13 10:22:12 WARN metastore.ObjectStore: Failed to get database default, returning NoSuchObjectException
> org.spark-project.guava.util.concurrent.UncheckedExecutionException: java.util.NoSuchElementException: key not found: path
> [...]
> {code}
> h3. Steps to reproduce:
> Run the following in spark2-shell:
> {code:java}
> scala> val df = spark.sql("show databases")
> scala> df.show()
> +--------------------+
> |        databaseName|
> +--------------------+
> |               mydb1|
> |               mydb2|
> |             default|
> |                test|
> +--------------------+
> scala> df.write.format("parquet").saveAsTable("test.spark22_test")
> scala> spark.sql("select * from test.spark22_test").show()
> +------------+
> |databaseName|
> +------------+
> +------------+{code}
> When manually setting the path (causing the data to be saved as external table), it works:
> {code:java}
> scala> df.write.option("path", "/hadoop/eco/hive/warehouse/test.db/spark22_parquet_with_path").format("parquet").saveAsTable("test.spark22_parquet_with_path")
> scala> spark.sql("select * from test.spark22_parquet_with_path").show()
> +--------------------+
> |        databaseName|
> +--------------------+
> |               mydb1|
> |               mydb2|
> |             default|
> |                test|
> +--------------------+
> {code}
> A second workaround is to update the metadata of the managed table created by Spark 2.2:
> {code}
> spark.sql("alter table test.spark22_test set SERDEPROPERTIES ('path'='hdfs://my-cluster-name:8020/hadoop/eco/hive/warehouse/test.db/spark22_test')")
> spark.catalog.refreshTable("test.spark22_test")
> spark.sql("select * from test.spark22_test").show()
> +--------------------+
> |        databaseName|
> +--------------------+
> |               mydb1|
> |               mydb2|
> |             default|
> |                test|
> +--------------------+
> {code}
> It is kind of a disaster that we are not able to read tables created by the very same Spark version and have to manually specify the path as an explicit option.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org