You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by ericl <gi...@git.apache.org> on 2016/10/31 23:42:59 UTC

[GitHub] spark pull request #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVER...

GitHub user ericl opened a pull request:

    https://github.com/apache/spark/pull/15705

    [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] TABLE ... PARTITION for Datasource tables

    ## What changes were proposed in this pull request?
    
    There are a couple issues with the current 2.1 behavior when inserting into Datasource tables with partitions managed by Hive.
    
    (1) OVERWRITE TABLE ... PARTITION will actually overwrite the entire table instead of just the specified partition.
    (2) INSERT|OVERWRITE does not work with partitions that have custom locations.
    
    This PR fixes both of these issues for Datasource tables managed by Hive. The behavior for legacy tables or when `manageFilesourcePartitions = false` is unchanged.
    
    ## How was this patch tested?
    
    Unit tests.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ericl/spark sc-4942

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/15705.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #15705
    
----
commit dee4b9e107cc84f67640523fa277b31947661042
Author: Eric Liang <ek...@databricks.com>
Date:   2016-10-27T21:44:04Z

    Thu Oct 27 14:44:04 PDT 2016

commit d99afacfc80e731d17af4ae25c548e45d948cd11
Author: Eric Liang <ek...@databricks.com>
Date:   2016-10-28T21:20:28Z

    Fri Oct 28 14:20:28 PDT 2016

commit 137aeb295bc02e26755d7c18c89bd0117371676e
Author: Eric Liang <ek...@databricks.com>
Date:   2016-10-31T19:16:44Z

    Merge branch 'master' into sc-4942

commit 8da8b0f7f70291cd86bd0a103758c5f88f714a27
Author: Eric Liang <ek...@databricks.com>
Date:   2016-10-31T21:29:58Z

    wip

commit d5a7bd3931dc6f3f1673d9edff0f0aa77ad9d138
Author: Eric Liang <ek...@databricks.com>
Date:   2016-10-31T23:14:56Z

    implement custom locations

commit a833a19d20f6b891cf42cf4a0f544c72abb982cd
Author: Eric Liang <ek...@databricks.com>
Date:   2016-10-31T23:32:16Z

    Mon Oct 31 16:32:15 PDT 2016

commit 587b85e83f569ad8acae3de82c695b0fad4041db
Author: Eric Liang <ek...@databricks.com>
Date:   2016-10-31T23:34:47Z

    Mon Oct 31 16:34:47 PDT 2016

commit 669e6cce48bfe903f473f14f20e1857ababc27be
Author: Eric Liang <ek...@databricks.com>
Date:   2016-10-31T23:41:40Z

    Mon Oct 31 16:41:40 PDT 2016

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    **[Test build #67849 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/67849/consoleFull)** for PR 15705 at commit [`07c6787`](https://github.com/apache/spark/commit/07c67876c372369def5128ce919cbb74e4f0d30d).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/67911/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    **[Test build #67864 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/67864/consoleFull)** for PR 15705 at commit [`0daff74`](https://github.com/apache/spark/commit/0daff7475e456754538e65b9f324773218f4f943).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    **[Test build #67848 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/67848/consoleFull)** for PR 15705 at commit [`fec7c9e`](https://github.com/apache/spark/commit/fec7c9e9df5fc7ceb1231fa71303fbf5a1a6b3d9).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/67849/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    **[Test build #67846 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/67846/consoleFull)** for PR 15705 at commit [`669e6cc`](https://github.com/apache/spark/commit/669e6cce48bfe903f473f14f20e1857ababc27be).
     * This patch **fails to build**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVER...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15705#discussion_r85890184
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/CatalogFileIndex.scala ---
    @@ -67,7 +67,10 @@ class CatalogFileIndex(
           val selectedPartitions = sparkSession.sessionState.catalog.listPartitionsByFilter(
             table.identifier, filters)
           val partitions = selectedPartitions.map { p =>
    -        PartitionPath(p.toRow(partitionSchema), p.storage.locationUri.get)
    +        val path = new Path(p.storage.locationUri.get)
    +        val fs = path.getFileSystem(hadoopConf)
    +        PartitionPath(
    +          p.toRow(partitionSchema), path.makeQualified(fs.getUri, fs.getWorkingDirectory))
    --- End diff --
    
    But we will qualify it before writing to it at [here](https://github.com/apache/spark/pull/15705/files#diff-f9858c2d9d1a3c3e48753ef675bc865aR69), doesn't it work?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/67846/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    **[Test build #67864 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/67864/consoleFull)** for PR 15705 at commit [`0daff74`](https://github.com/apache/spark/commit/0daff7475e456754538e65b9f324773218f4f943).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    LGTM, merging to master!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    **[Test build #67911 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/67911/consoleFull)** for PR 15705 at commit [`ca31f35`](https://github.com/apache/spark/commit/ca31f351387b4e60c0f7dd310ba4246caaba7b26).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `  class TaskCommitMessage(obj: Any) extends Serializable`
      * `abstract class FileCommitProtocol `
      * `class HadoopCommitProtocolWrapper(path: String, isAppend: Boolean)`
      * `        logInfo(s\"Using user defined output committer class $`
      * `    logInfo(s\"Using output committer class $`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    **[Test build #67911 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/67911/consoleFull)** for PR 15705 at commit [`ca31f35`](https://github.com/apache/spark/commit/ca31f351387b4e60c0f7dd310ba4246caaba7b26).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    **[Test build #67849 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/67849/consoleFull)** for PR 15705 at commit [`07c6787`](https://github.com/apache/spark/commit/07c67876c372369def5128ce919cbb74e4f0d30d).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVER...

Posted by ericl <gi...@git.apache.org>.
Github user ericl commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15705#discussion_r85875944
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/CatalogFileIndex.scala ---
    @@ -67,7 +67,10 @@ class CatalogFileIndex(
           val selectedPartitions = sparkSession.sessionState.catalog.listPartitionsByFilter(
             table.identifier, filters)
           val partitions = selectedPartitions.map { p =>
    -        PartitionPath(p.toRow(partitionSchema), p.storage.locationUri.get)
    +        val path = new Path(p.storage.locationUri.get)
    +        val fs = path.getFileSystem(hadoopConf)
    +        PartitionPath(
    +          p.toRow(partitionSchema), path.makeQualified(fs.getUri, fs.getWorkingDirectory))
    --- End diff --
    
    Apparently not. The unit test actually fails if you do that, since the path seems to be missing the `file:` prefix.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVER...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15705#discussion_r85870248
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala ---
    @@ -173,12 +175,22 @@ case class DataSourceAnalysis(conf: CatalystConf) extends Rule[LogicalPlan] {
             case LogicalRelation(r: HadoopFsRelation, _, _) => r.location.rootPaths
           }.flatten
     
    -      val mode = if (overwrite) SaveMode.Overwrite else SaveMode.Append
    -      if (overwrite && inputPaths.contains(outputPath)) {
    +      val mode = if (overwrite.enabled) SaveMode.Overwrite else SaveMode.Append
    +      if (overwrite.enabled && inputPaths.contains(outputPath)) {
             throw new AnalysisException(
               "Cannot overwrite a path that is also being read from.")
           }
     
    +      val overwritePartitionPath = if (overwrite.specificPartition.isDefined &&
    --- End diff --
    
    can we just pass the partition path as `outputPath` to `InsertIntoHadoopFsRelationCommand` and set partition columns to `Nil`, then we don't need to add an extra parameter to `InsertIntoHadoopFsRelationCommand`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    **[Test build #67848 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/67848/consoleFull)** for PR 15705 at commit [`fec7c9e`](https://github.com/apache/spark/commit/fec7c9e9df5fc7ceb1231fa71303fbf5a1a6b3d9).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVER...

Posted by ericl <gi...@git.apache.org>.
Github user ericl commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15705#discussion_r85993725
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala ---
    @@ -173,12 +175,22 @@ case class DataSourceAnalysis(conf: CatalystConf) extends Rule[LogicalPlan] {
             case LogicalRelation(r: HadoopFsRelation, _, _) => r.location.rootPaths
           }.flatten
     
    -      val mode = if (overwrite) SaveMode.Overwrite else SaveMode.Append
    -      if (overwrite && inputPaths.contains(outputPath)) {
    +      val mode = if (overwrite.enabled) SaveMode.Overwrite else SaveMode.Append
    +      if (overwrite.enabled && inputPaths.contains(outputPath)) {
             throw new AnalysisException(
               "Cannot overwrite a path that is also being read from.")
           }
     
    +      val overwritePartitionPath = if (overwrite.specificPartition.isDefined &&
    --- End diff --
    
    Yeah, that seems a little cleaner.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVER...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15705#discussion_r85869751
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/CatalogFileIndex.scala ---
    @@ -67,7 +67,10 @@ class CatalogFileIndex(
           val selectedPartitions = sparkSession.sessionState.catalog.listPartitionsByFilter(
             table.identifier, filters)
           val partitions = selectedPartitions.map { p =>
    -        PartitionPath(p.toRow(partitionSchema), p.storage.locationUri.get)
    +        val path = new Path(p.storage.locationUri.get)
    +        val fs = path.getFileSystem(hadoopConf)
    +        PartitionPath(
    +          p.toRow(partitionSchema), path.makeQualified(fs.getUri, fs.getWorkingDirectory))
    --- End diff --
    
    why this change? Doesn't `new Path` qualify the path string?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVER...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15705#discussion_r85859910
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala ---
    @@ -345,18 +346,32 @@ case class BroadcastHint(child: LogicalPlan) extends UnaryNode {
       override lazy val statistics: Statistics = super.statistics.copy(isBroadcastable = true)
     }
     
    +/**
    + * Options for writing new data into a table.
    + *
    + * @param enabled whether to overwrite existing data in the table.
    --- End diff --
    
    it's pretty confusing we call it `enabled`, can we just use `overwrite`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/67864/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by ericl <gi...@git.apache.org>.
Github user ericl commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    I think you don't have to since this is just the test suite.
    
    On Tue, Nov 1, 2016, 8:49 PM Wenchen Fan <no...@github.com> wrote:
    
    > *@cloud-fan* commented on this pull request.
    > ------------------------------
    >
    > In
    > sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/PlanParserSuite.scala
    > <https://github.com/apache/spark/pull/15705#pullrequestreview-6745958>:
    >
    > > @@ -180,7 +180,16 @@ class PlanParserSuite extends PlanTest {
    >          partition: Map[String, Option[String]],
    >          overwrite: Boolean = false,
    >          ifNotExists: Boolean = false): LogicalPlan =
    > -      InsertIntoTable(table("s"), partition, plan, overwrite, ifNotExists)
    > +      InsertIntoTable(
    > +        table("s"), partition, plan,
    > +        OverwriteOptions(
    > +          overwrite,
    > +          if (overwrite && partition.nonEmpty) {
    > +            Some(partition.map(kv => (kv._1, kv._2.get)))
    >
    > do we need to consider dynamic partition here?
    >
    > \u2014
    > You are receiving this because you authored the thread.
    > Reply to this email directly, view it on GitHub
    > <https://github.com/apache/spark/pull/15705#pullrequestreview-6745958>,
    > or mute the thread
    > <https://github.com/notifications/unsubscribe-auth/AAA6SpEB-R5k4u55HP0Wt6z9i1OihpNSks5q6AhJgaJpZM4KlpEq>
    > .
    >



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVER...

Posted by ericl <gi...@git.apache.org>.
Github user ericl commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15705#discussion_r85990912
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/CatalogFileIndex.scala ---
    @@ -67,7 +67,10 @@ class CatalogFileIndex(
           val selectedPartitions = sparkSession.sessionState.catalog.listPartitionsByFilter(
             table.identifier, filters)
           val partitions = selectedPartitions.map { p =>
    -        PartitionPath(p.toRow(partitionSchema), p.storage.locationUri.get)
    +        val path = new Path(p.storage.locationUri.get)
    +        val fs = path.getFileSystem(hadoopConf)
    +        PartitionPath(
    +          p.toRow(partitionSchema), path.makeQualified(fs.getUri, fs.getWorkingDirectory))
    --- End diff --
    
    The issue is that the user can store arbitrary string paths with `ALTER TABLE PARTITIONS SET LOCATION`. Therefore, we must manually qualify the locations that come from the catalog or else they might not necessarily match up with the paths read from the filesystem.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVER...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/15705


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVER...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15705#discussion_r86069348
  
    --- Diff: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/PlanParserSuite.scala ---
    @@ -180,7 +180,16 @@ class PlanParserSuite extends PlanTest {
             partition: Map[String, Option[String]],
             overwrite: Boolean = false,
             ifNotExists: Boolean = false): LogicalPlan =
    -      InsertIntoTable(table("s"), partition, plan, overwrite, ifNotExists)
    +      InsertIntoTable(
    +        table("s"), partition, plan,
    +        OverwriteOptions(
    +          overwrite,
    +          if (overwrite && partition.nonEmpty) {
    +            Some(partition.map(kv => (kv._1, kv._2.get)))
    --- End diff --
    
    do we need to consider dynamic partition here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    **[Test build #67846 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/67846/consoleFull)** for PR 15705 at commit [`669e6cc`](https://github.com/apache/spark/commit/669e6cce48bfe903f473f14f20e1857ababc27be).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by ericl <gi...@git.apache.org>.
Github user ericl commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    cc @cloud-fan @yhuai 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #15705: [SPARK-18183] [SPARK-18184] Fix INSERT [INTO|OVERWRITE] ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15705
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/67848/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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