You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by gatorsmile <gi...@git.apache.org> on 2017/04/03 06:52:37 UTC

[GitHub] spark pull request #17518: [SPARK-20198] [SQL] Remove the inconsistency when...

GitHub user gatorsmile opened a pull request:

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

    [SPARK-20198] [SQL] Remove the inconsistency when table/function name definitions in SparkSession.Catalog APIs

    ### What changes were proposed in this pull request?
    Observed by @felixcheung , in `SparkSession`.`Catalog` APIs, we have different conventions/rules for table/function identifiers/names. Most APIs accept the qualified name (i.e., `databaseName`.`tableName` or `databaseName`.`functionName`). However, the following five APIs do not accept it.  
    - def listColumns(tableName: String): Dataset[Column]
    - def getTable(tableName: String): Table 
    - def getFunction(functionName: String): Function
    - def tableExists(tableName: String): Boolean
    - def functionExists(functionName: String): Boolean
    
    To make them consistent with the other Catalog APIs, this PR does the changes, updates the function/API comments and adds the `@params` to clarify the inputs we allow.
    
    ### How was this patch tested?
    Added the test cases .

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

    $ git pull https://github.com/gatorsmile/spark tableIdentifier

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

    https://github.com/apache/spark/pull/17518.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 #17518
    
----
commit 8581d5bd6c0acfdecd4d873ca85efcb02fc23e39
Author: Xiao Li <ga...@gmail.com>
Date:   2017-04-03T06:37:31Z

    fix.

----


---
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 #17518: [SPARK-20198] [SQL] Remove the inconsistency in t...

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

    https://github.com/apache/spark/pull/17518#discussion_r109350128
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/internal/CatalogSuite.scala ---
    @@ -413,11 +425,15 @@ class CatalogSuite
     
             // Find a qualified table
             assert(spark.catalog.tableExists(db, "tbl_y"))
    +        assert(spark.catalog.tableExists(s"$db.tbl_y"))
     
             // Find an unqualified table using the current database
             assert(!spark.catalog.tableExists("tbl_y"))
             spark.catalog.setCurrentDatabase(db)
             assert(spark.catalog.tableExists("tbl_y"))
    +
    +        // Unable to find the table, although the temp view with the given name exists
    +        assert(!spark.catalog.tableExists(db, "tbl_x"))
    --- End diff --
    
    This new test case is not related to this PR. Just to improve the existing test case coverage.


---
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 #17518: [SPARK-20198] [SQL] Remove the inconsistency in table/fu...

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

    https://github.com/apache/spark/pull/17518
  
    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 #17518: [SPARK-20198] [SQL] Remove the inconsistency in table/fu...

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

    https://github.com/apache/spark/pull/17518
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/75474/
    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 #17518: [SPARK-20198] [SQL] Remove the inconsistency in table/fu...

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

    https://github.com/apache/spark/pull/17518
  
    @rxin I think these API changes make sense, it's more intuitive to return columns for `tbl1` in `db1` when calling `listColumns("db1.tbl1")`, instead of a special table named `db1.tbl1`, the previous behavior is kind of bugy and not consistent with other interfaces in `Catalog`.
    
    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 #17518: [SPARK-20198] [SQL] Remove the inconsistency in table/fu...

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

    https://github.com/apache/spark/pull/17518
  
    **[Test build #75474 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/75474/testReport)** for PR 17518 at commit [`b3e81b4`](https://github.com/apache/spark/commit/b3e81b4dc49451bfefd469ccefccf5c9764ecb98).
     * 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 #17518: [SPARK-20198] [SQL] Remove the inconsistency in table/fu...

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

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


---
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 #17518: [SPARK-20198] [SQL] Remove the inconsistency in table/fu...

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

    https://github.com/apache/spark/pull/17518
  
    **[Test build #75473 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/75473/testReport)** for PR 17518 at commit [`dc9fefa`](https://github.com/apache/spark/commit/dc9fefa2d387b38641bd47e9b9e7c22d75d476b2).
     * This patch **fails Scala style 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 #17518: [SPARK-20198] [SQL] Remove the inconsistency in table/fu...

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

    https://github.com/apache/spark/pull/17518
  
    Is this an API change or just a documentation change? The title suggests you are changing public facing APIs?



---
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 #17518: [SPARK-20198] [SQL] Remove the inconsistency in table/fu...

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

    https://github.com/apache/spark/pull/17518
  
    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 #17518: [SPARK-20198] [SQL] Remove the inconsistency in t...

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

    https://github.com/apache/spark/pull/17518#discussion_r109350146
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/internal/CatalogSuite.scala ---
    @@ -439,11 +456,15 @@ class CatalogSuite
     
             // Find a qualified function
             assert(spark.catalog.functionExists(db, "fn2"))
    +        assert(spark.catalog.functionExists(s"$db.fn2"))
     
             // Find an unqualified function using the current database
             assert(!spark.catalog.functionExists("fn2"))
             spark.catalog.setCurrentDatabase(db)
             assert(spark.catalog.functionExists("fn2"))
    +
    +        // Unable to find the function, although the temp function with the given name exists
    +        assert(!spark.catalog.functionExists(db, "fn1"))
    --- End diff --
    
    This new test case is not related to this PR. Just to improve the existing test case coverage.


---
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 #17518: [SPARK-20198] [SQL] Remove the inconsistency in table/fu...

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

    https://github.com/apache/spark/pull/17518
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/75473/
    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 #17518: [SPARK-20198] [SQL] Remove the inconsistency in t...

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

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


---
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 #17518: [SPARK-20198] [SQL] Remove the inconsistency in table/fu...

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

    https://github.com/apache/spark/pull/17518
  
    cc @rxin @hvanhovell @cloud-fan @felixcheung 


---
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 #17518: [SPARK-20198] [SQL] Remove the inconsistency in table/fu...

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

    https://github.com/apache/spark/pull/17518
  
    @rxin This is an API change. After this PR, the following APIs will accept the qualified table/function names.
    
    - def listColumns(tableName: String): Dataset[Column]
    - def getTable(tableName: String): Table
    - def getFunction(functionName: String): Function
    - def tableExists(tableName: String): Boolean
    - def functionExists(functionName: String): Boolean
    
    Before this PR, `listColumns("db1.tab")` will search a table having the name `db1.tab`. After this PR, it will search the table having the name `tab` in the database `db1`


---
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 #17518: [SPARK-20198] [SQL] Remove the inconsistency in t...

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/17518#discussion_r109630541
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/catalog/Catalog.scala ---
    @@ -383,36 +439,48 @@ abstract class Catalog {
        * preserved database `global_temp`, and we must use the qualified name to refer a global temp
        * view, e.g. `SELECT * FROM global_temp.view1`.
        *
    -   * @param viewName the name of the view to be dropped.
    +   * @param viewName the unqualified name of the temporary view to be dropped.
        * @return true if the view is dropped successfully, false otherwise.
        * @since 2.1.0
        */
       def dropGlobalTempView(viewName: String): Boolean
    --- End diff --
    
    hmm, just realized we don't have `dropTable` in `Catalog`...


---
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 #17518: [SPARK-20198] [SQL] Remove the inconsistency in table/fu...

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

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


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