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

Xiao Li commented on SPARK-19129:
---------------------------------

This is a bug we need to fix. Let me try it. Thanks!

> alter table table_name drop partition with a empty string will drop the whole 
> table
> -----------------------------------------------------------------------------------
>
>                 Key: SPARK-19129
>                 URL: https://issues.apache.org/jira/browse/SPARK-19129
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.1.0
>            Reporter: lichenglin
>              Labels: correctness
>
> {code}
>     val spark = SparkSession
>       .builder
>       .appName("PartitionDropTest")
>       .master("local[2]").enableHiveSupport()
>       .getOrCreate()
>     val sentenceData = spark.createDataFrame(Seq(
>       (0, "a"),
>       (1, "b"),
>       (2, "c")))
>       .toDF("id", "name")
>     spark.sql("drop table if exists licllocal.partition_table")
>     
> sentenceData.write.mode(SaveMode.Overwrite).partitionBy("id").saveAsTable("licllocal.partition_table")
>     spark.sql("alter table licllocal.partition_table drop partition(id='')")
>     spark.table("licllocal.partition_table").show()
> {code}
> the result is 
> {code}
> |name| id|
> +----+---+
> +----+---+
> {code}
> Maybe the partition match have something wrong when the partition value is 
> set to empty string



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to