You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Dongjoon Hyun (Jira)" <ji...@apache.org> on 2020/03/11 17:44:00 UTC

[jira] [Commented] (SPARK-29295) Duplicate result when dropping partition of an external table and then overwriting

    [ https://issues.apache.org/jira/browse/SPARK-29295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17057261#comment-17057261 ] 

Dongjoon Hyun commented on SPARK-29295:
---------------------------------------

Hi, [~viirya]. Could you make a backport against branch-2.4?

> Duplicate result when dropping partition of an external table and then overwriting
> ----------------------------------------------------------------------------------
>
>                 Key: SPARK-29295
>                 URL: https://issues.apache.org/jira/browse/SPARK-29295
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.4.4
>            Reporter: feiwang
>            Assignee: L. C. Hsieh
>            Priority: Major
>              Labels: correctness
>             Fix For: 3.0.0
>
>
> When we drop a partition of a external table and then overwrite it, if we set CONVERT_METASTORE_PARQUET=true(default value), it will overwrite this partition.
> But when we set CONVERT_METASTORE_PARQUET=false, it will give duplicate result.
> Here is a reproduce code below(you can add it into SQLQuerySuite in hive module):
> {code:java}
>   test("spark gives duplicate result when dropping a partition of an external partitioned table" +
>     " firstly and they overwrite it") {
>     withTable("test") {
>       withTempDir { f =>
>         sql("create external table test(id int) partitioned by (name string) stored as " +
>           s"parquet location '${f.getAbsolutePath}'")
>         withSQLConf(HiveUtils.CONVERT_METASTORE_PARQUET.key -> false.toString) {
>           sql("insert overwrite table test partition(name='n1') select 1")
>           sql("ALTER TABLE test DROP PARTITION(name='n1')")
>           sql("insert overwrite table test partition(name='n1') select 2")
>           checkAnswer( sql("select id from test where name = 'n1' order by id"),
>             Array(Row(1), Row(2)))
>         }
>         withSQLConf(HiveUtils.CONVERT_METASTORE_PARQUET.key -> true.toString) {
>           sql("insert overwrite table test partition(name='n1') select 1")
>           sql("ALTER TABLE test DROP PARTITION(name='n1')")
>           sql("insert overwrite table test partition(name='n1') select 2")
>           checkAnswer( sql("select id from test where name = 'n1' order by id"),
>             Array(Row(2)))
>         }
>       }
>     }
>   }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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