You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by hvanhovell <gi...@git.apache.org> on 2017/04/21 10:43:29 UTC

[GitHub] spark pull request #17716: [SPARK-19952][SQL] Remove various analysis except...

GitHub user hvanhovell opened a pull request:

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

    [SPARK-19952][SQL] Remove various analysis exceptions

    ## What changes were proposed in this pull request?
    We currently have quite a few analysis exception subclasses, the problem with these is that they are not well supported throughout Spark (in pySpark for example) and that the added value is limited. This PR removes the `no such object` and the `already exists` exceptions, and replaces them by a factory methods that create analysis exceptions with the required error messages.
    
    ## How was this patch tested?
    Modified existing tests.

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

    $ git pull https://github.com/hvanhovell/spark SPARK-19952

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

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

----


---
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 #17716: [SPARK-19952][SQL] Remove various analysis exceptions

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

    https://github.com/apache/spark/pull/17716
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/76031/
    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 pull request #17716: [SPARK-19952][SQL] Remove various analysis except...

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

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


---
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 #17716: [SPARK-19952][SQL] Remove various analysis exceptions

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

    https://github.com/apache/spark/pull/17716
  
    **[Test build #76031 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76031/testReport)** for PR 17716 at commit [`6dc3204`](https://github.com/apache/spark/commit/6dc3204979517a85d468809a03b9bd0ee9b6c385).


---
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 #17716: [SPARK-19952][SQL] Remove various analysis exceptions

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

    https://github.com/apache/spark/pull/17716
  
    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 #17716: [SPARK-19952][SQL] Remove various analysis exceptions

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

    https://github.com/apache/spark/pull/17716
  
    **[Test build #76039 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76039/testReport)** for PR 17716 at commit [`79ee4a6`](https://github.com/apache/spark/commit/79ee4a6603e48e8a755afadfe714d87f15dacac3).
     * 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 #17716: [SPARK-19952][SQL] Remove various analysis exceptions

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

    https://github.com/apache/spark/pull/17716
  
    cc @cloud-fan @ueshin @rxin


---
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 #17716: [SPARK-19952][SQL] Remove various analysis except...

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/17716#discussion_r112697855
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala ---
    @@ -636,17 +636,16 @@ class Analyzer(
             defaultDatabase: Option[String] = None): LogicalPlan = {
           val tableIdentWithDb = u.tableIdentifier.copy(
             database = u.tableIdentifier.database.orElse(defaultDatabase))
    -      try {
    -        catalog.lookupRelation(tableIdentWithDb)
    -      } catch {
    -        case _: NoSuchTableException =>
    -          u.failAnalysis(s"Table or view not found: ${tableIdentWithDb.unquotedString}")
    -        // If the database is defined and that database is not found, throw an AnalysisException.
    +      if (!tableIdentWithDb.database.exists(catalog.databaseExists)) {
    --- End diff --
    
    how about
    ```
    try {
      catalog.lookupRelation(tableIdentWithDb)
    } catch {
      case a: AnalysisException => u.failAnalysis(a.message)
    }
    ```


---
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 #17716: [SPARK-19952][SQL] Remove various analysis exceptions

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

    https://github.com/apache/spark/pull/17716
  
    **[Test build #76031 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76031/testReport)** for PR 17716 at commit [`6dc3204`](https://github.com/apache/spark/commit/6dc3204979517a85d468809a03b9bd0ee9b6c385).
     * 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 pull request #17716: [SPARK-19952][SQL] Remove various analysis except...

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

    https://github.com/apache/spark/pull/17716#discussion_r112804650
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala ---
    @@ -160,7 +159,7 @@ abstract class SQLViewSuite extends QueryTest with SQLTestUtils {
       }
     
       private def assertNoSuchTable(query: String): Unit = {
    -    intercept[NoSuchTableException] {
    +    intercept[AnalysisException] {
    --- End diff --
    
    `AnalysisException` is a pretty general Exception in Spark SQL. The future refactoring might introduce bugs without trigger any test case failure. 
    
    Could we check the error messages? 


---
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 #17716: [SPARK-19952][SQL] Remove various analysis exceptions

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

    https://github.com/apache/spark/pull/17716
  
    @hvanhovell, how is it going?


---
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 #17716: [SPARK-19952][SQL] Remove various analysis exceptions

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

    https://github.com/apache/spark/pull/17716
  
    **[Test build #76039 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76039/testReport)** for PR 17716 at commit [`79ee4a6`](https://github.com/apache/spark/commit/79ee4a6603e48e8a755afadfe714d87f15dacac3).


---
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 #17716: [SPARK-19952][SQL] Remove various analysis exceptions

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

    https://github.com/apache/spark/pull/17716
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/76039/
    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 pull request #17716: [SPARK-19952][SQL] Remove various analysis except...

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

    https://github.com/apache/spark/pull/17716#discussion_r112662001
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala ---
    @@ -636,17 +636,16 @@ class Analyzer(
             defaultDatabase: Option[String] = None): LogicalPlan = {
           val tableIdentWithDb = u.tableIdentifier.copy(
             database = u.tableIdentifier.database.orElse(defaultDatabase))
    -      try {
    -        catalog.lookupRelation(tableIdentWithDb)
    -      } catch {
    -        case _: NoSuchTableException =>
    -          u.failAnalysis(s"Table or view not found: ${tableIdentWithDb.unquotedString}")
    -        // If the database is defined and that database is not found, throw an AnalysisException.
    +      if (!tableIdentWithDb.database.exists(catalog.databaseExists)) {
    --- End diff --
    
    Perhaps we should move this into `catalog.lookupRelation` and attach the location 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 #17716: [SPARK-19952][SQL] Remove various analysis exceptions

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

    https://github.com/apache/spark/pull/17716
  
    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 pull request #17716: [SPARK-19952][SQL] Remove various analysis except...

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

    https://github.com/apache/spark/pull/17716#discussion_r112829206
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala ---
    @@ -160,7 +159,7 @@ abstract class SQLViewSuite extends QueryTest with SQLTestUtils {
       }
     
       private def assertNoSuchTable(query: String): Unit = {
    -    intercept[NoSuchTableException] {
    +    intercept[AnalysisException] {
    --- End diff --
    
    Will do


---
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 #17716: [SPARK-19952][SQL] Remove various analysis except...

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

    https://github.com/apache/spark/pull/17716#discussion_r112698843
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala ---
    @@ -636,17 +636,16 @@ class Analyzer(
             defaultDatabase: Option[String] = None): LogicalPlan = {
           val tableIdentWithDb = u.tableIdentifier.copy(
             database = u.tableIdentifier.database.orElse(defaultDatabase))
    -      try {
    -        catalog.lookupRelation(tableIdentWithDb)
    -      } catch {
    -        case _: NoSuchTableException =>
    -          u.failAnalysis(s"Table or view not found: ${tableIdentWithDb.unquotedString}")
    -        // If the database is defined and that database is not found, throw an AnalysisException.
    +      if (!tableIdentWithDb.database.exists(catalog.databaseExists)) {
    --- End diff --
    
    Yeah, could work. This change is also causing the tests to fail, so I am revisiting it.


---
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 #17716: [SPARK-19952][SQL] Remove various analysis exceptions

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

    https://github.com/apache/spark/pull/17716
  
    ping @hvanhovell Are you still working on this?


---
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