spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hyukjin Kwon (JIRA)" <>
Subject [jira] [Commented] (SPARK-19713) saveAsTable
Date Tue, 28 Feb 2017 23:33:46 GMT


Hyukjin Kwon commented on SPARK-19713:

Hi [~balaramraju] Could you update the title?

> saveAsTable
> -----------
>                 Key: SPARK-19713
>                 URL:
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.6.1
>            Reporter: Balaram R Gadiraju
> Hi,
> I just observed that when we use dataframe.saveAsTable("table") -- In oldversions
> and dataframe.write.saveAsTable("table") -- in the newer versions
>                 When using the method “df3.saveAsTable("brokentable")” in scale code.
This creates a folder in hdfs and doesn’t update hive-metastore that it plans to create
the table. So if anything goes wrong in between the folder still exists and hive is not aware
of the folder creation. This will block the users from creating the table “brokentable”
as the folder already exists, we can remove the folder using “hadoop fs –rmr /data/hive/databases/testdb.db/brokentable”.
 So below is the workaround which will enable to you to continue the development work.
> Current Code:
> val df3 = sqlContext.sql("select * fromtesttable")
> df3.saveAsTable("brokentable")
> By registering the DataFrame as table and then using sql command to load the data will
resolve the issue. EX:
> val df3 = sqlContext.sql("select * from testtable").registerTempTable("df3")
> sqlContext.sql("CREATE TABLE brokentable AS SELECT * FROM df3")

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message