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

Deepanker edited comment on SPARK-20236 at 9/19/18 3:03 PM:
------------------------------------------------------------

Hi Wenchen Fan,

Tested this even further and found out that it works for managed tables as 
well. But not for tables created via saveAsTable API of spark which is a bit 
surprising because saveAsTable also creates a managed table only. 
 
As a test i did the following:
 
saveAsTable(x) [Stored as ORC ] [Partitioned by arbitrary column] [Doesn't work 
for this]

Create Table like x [Using Beeline CLI] [Same properties as above table] [Works 
for this]

Create external Table like x [Using Beeline CLI] [Same properties as above 
table] [Works for this]

Is this the expected behaviour? I am using Spark 2.2 and Hive 1.1

If/When find time can you also confirm my hypothesis for the difference between 
two Jira in my previous post?


was (Author: deepanker):
Hi Wenchen Fan,

Tested this even further and found out that it works for managed tables as 
well. But not for tables created via saveAsTable API of spark. 
 As a test i did the following:
 saveAsTable [Stored as ORC ] [Partitioned by arbitrary column] [Doesn't work 
for this]

Create Table like x [Using Beeline CLI] [Same properties as above table] [Works 
for this]

Create external Table like x [Using Beeline CLI] [Same properties as above 
table] [Works for this]

Is this the expected behaviour? I am using Spark 2.2 and Hive 1.1

If/When find time can you also confirm my hypothesis for the difference between 
two Jira in my previous post?

> Overwrite a partitioned data source table should only overwrite related 
> partitions
> ----------------------------------------------------------------------------------
>
>                 Key: SPARK-20236
>                 URL: https://issues.apache.org/jira/browse/SPARK-20236
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 2.2.0
>            Reporter: Wenchen Fan
>            Assignee: Wenchen Fan
>            Priority: Major
>              Labels: releasenotes
>             Fix For: 2.3.0
>
>
> When we overwrite a partitioned data source table, currently Spark will 
> truncate the entire table to write new data, or truncate a bunch of 
> partitions according to the given static partitions.
> For example, {{INSERT OVERWRITE tbl ...}} will truncate the entire table, 
> {{INSERT OVERWRITE tbl PARTITION (a=1, b)}} will truncate all the partitions 
> that starts with {{a=1}}.
> This behavior is kind of reasonable as we can know which partitions will be 
> overwritten before runtime. However, hive has a different behavior that it 
> only overwrites related partitions, e.g. {{INSERT OVERWRITE tbl SELECT 
> 1,2,3}} will only overwrite partition {{a=2, b=3}}, assuming {{tbl}} has only 
> one data column and is partitioned by {{a}} and {{b}}.
> It seems better if we can follow hive's behavior.



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

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

Reply via email to