You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by huaxingao <gi...@git.apache.org> on 2017/09/17 00:32:56 UTC

[GitHub] spark pull request #19256: [SPARK-21338][SQL]implement isCascadingTruncateTa...

GitHub user huaxingao opened a pull request:

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

    [SPARK-21338][SQL]implement isCascadingTruncateTable() method in Aggr…

    …egatedDialect
    
    ## What changes were proposed in this pull request?
    
    org.apache.spark.sql.jdbc.JdbcDialect's method:
    def isCascadingTruncateTable(): Option[Boolean] = None
    is not overriden in org.apache.spark.sql.jdbc.AggregatedDialect class.
    Because of this issue, when you add more than one dialect Spark doesn't truncate table because isCascadingTruncateTable always returns default None for Aggregated Dialect. 
    Will implement isCascadingTruncateTable in AggregatedDialect class in this PR. 
    
    ## How was this patch tested?
    
    In JDBCSuite, inside test("Aggregated dialects"), will add one line to test AggregatedDialect.isCascadingTruncateTable


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

    $ git pull https://github.com/huaxingao/spark spark-21338

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

    https://github.com/apache/spark/pull/19256.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 #19256
    
----

----


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

    https://github.com/apache/spark/pull/19256
  
    ok to test


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

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


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

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


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

    https://github.com/apache/spark/pull/19256
  
    @gatorsmile Thanks a lot for your help!!!


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

    https://github.com/apache/spark/pull/19256
  
    It looks good, but the actual code should be very simple if you are writing using the Scala way


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

    https://github.com/apache/spark/pull/19256
  
    Thanks! Merged to master


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

    https://github.com/apache/spark/pull/19256
  
    retest this please


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

    https://github.com/apache/spark/pull/19256
  
    Thanks @gatorsmile 
    Does the following logic look good to you?
    ```
    if(any dialect's isCascadingTruncateTable returns true)
      return Some(true)
    else
      if (any dialect's isCascadingTruncateTable returns false)
         return Some(false)
      else // None of the dialect implements this method, return the superclass default value
         return None
    ```



---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

    https://github.com/apache/spark/pull/19256
  
    Let me correct what I said above. The logics should be 
    > If any dialect's `isCascadingTruncateTable` returns `true`, we should return `true`. 


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

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


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

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


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

    https://github.com/apache/spark/pull/19256
  
    **[Test build #81859 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81859/testReport)** for PR 19256 at commit [`7b9d6fc`](https://github.com/apache/spark/commit/7b9d6fcec61cd72ffb257abf17eb0e9d6c462f9e).


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

    https://github.com/apache/spark/pull/19256
  
    **[Test build #81848 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81848/testReport)** for PR 19256 at commit [`7b9d6fc`](https://github.com/apache/spark/commit/7b9d6fcec61cd72ffb257abf17eb0e9d6c462f9e).
     * This patch **fails due to an unknown error code, -9**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark pull request #19256: [SPARK-21338][SQL]implement isCascadingTruncateTa...

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

    https://github.com/apache/spark/pull/19256#discussion_r139313120
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/jdbc/AggregatedDialect.scala ---
    @@ -41,4 +41,8 @@ private class AggregatedDialect(dialects: List[JdbcDialect]) extends JdbcDialect
       override def getJDBCType(dt: DataType): Option[JdbcType] = {
         dialects.flatMap(_.getJDBCType(dt)).headOption
       }
    +
    +  override def isCascadingTruncateTable(): Option[Boolean] = {
    +    dialects.flatMap(_.isCascadingTruncateTable).headOption
    --- End diff --
    
    Both getCatalystType and getJDBCType(dt: DataType) use the first one. Also, in the class header, it has the following:
    /**
     * AggregatedDialect can unify multiple dialects into one virtual Dialect.
     * Dialects are tried in order, and the first dialect that does not return a
     * neutral element will will.
     *
     * @param dialects List of dialects.
     */
    It has a typo, I guess it means "the first dialect that does not return a
     neutral element will return"


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

    https://github.com/apache/spark/pull/19256
  
    BTW, could you update the PR title?


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

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


---

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


[GitHub] spark pull request #19256: [SPARK-21338][SQL]implement isCascadingTruncateTa...

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

    https://github.com/apache/spark/pull/19256#discussion_r139302993
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/jdbc/AggregatedDialect.scala ---
    @@ -41,4 +41,8 @@ private class AggregatedDialect(dialects: List[JdbcDialect]) extends JdbcDialect
       override def getJDBCType(dt: DataType): Option[JdbcType] = {
         dialects.flatMap(_.getJDBCType(dt)).headOption
       }
    +
    +  override def isCascadingTruncateTable(): Option[Boolean] = {
    +    dialects.flatMap(_.isCascadingTruncateTable).headOption
    --- End diff --
    
    Why using the first one?


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

    https://github.com/apache/spark/pull/19256
  
    **[Test build #81859 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81859/testReport)** for PR 19256 at commit [`7b9d6fc`](https://github.com/apache/spark/commit/7b9d6fcec61cd72ffb257abf17eb0e9d6c462f9e).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark pull request #19256: [SPARK-21338][SQL]implement isCascadingTruncateTa...

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

    https://github.com/apache/spark/pull/19256#discussion_r139315660
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/jdbc/AggregatedDialect.scala ---
    @@ -41,4 +41,8 @@ private class AggregatedDialect(dialects: List[JdbcDialect]) extends JdbcDialect
       override def getJDBCType(dt: DataType): Option[JdbcType] = {
         dialects.flatMap(_.getJDBCType(dt)).headOption
       }
    +
    +  override def isCascadingTruncateTable(): Option[Boolean] = {
    +    dialects.flatMap(_.isCascadingTruncateTable).headOption
    --- End diff --
    
    This one is different from `getCatalystType ` and `getJDBCType `. Instead, we should follow [canHandle](https://github.com/huaxingao/spark/blob/7b9d6fcec61cd72ffb257abf17eb0e9d6c462f9e/sql/core/src/main/scala/org/apache/spark/sql/jdbc/AggregatedDialect.scala#L33-L34).


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

    https://github.com/apache/spark/pull/19256
  
    **[Test build #81898 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81898/testReport)** for PR 19256 at commit [`bd8e2b9`](https://github.com/apache/spark/commit/bd8e2b95a6c8be0bf1f201e9cccb0b22c14abc96).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

    https://github.com/apache/spark/pull/19256
  
    Can one of the admins verify this patch?


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

    https://github.com/apache/spark/pull/19256
  
    Thanks @gatorsmile 
    I will change both the implementation and the PR title. 


---

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


[GitHub] spark pull request #19256: [SPARK-21338][SQL]implement isCascadingTruncateTa...

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

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


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

    https://github.com/apache/spark/pull/19256
  
    LGTM pending Jenkins


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

    https://github.com/apache/spark/pull/19256
  
    **[Test build #81848 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81848/testReport)** for PR 19256 at commit [`7b9d6fc`](https://github.com/apache/spark/commit/7b9d6fcec61cd72ffb257abf17eb0e9d6c462f9e).


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

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


---

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


[GitHub] spark issue #19256: [SPARK-21338][SQL]implement isCascadingTruncateTable() m...

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

    https://github.com/apache/spark/pull/19256
  
    **[Test build #81898 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81898/testReport)** for PR 19256 at commit [`bd8e2b9`](https://github.com/apache/spark/commit/bd8e2b95a6c8be0bf1f201e9cccb0b22c14abc96).


---

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