GitHub user gatorsmile opened a pull request:

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

    [SPARK-17234] [SQL] Table Existence Checking when Index Table with the Same 
Name Exists

    ### What changes were proposed in this pull request?
    Hive Index tables are not supported by Spark SQL. Thus, we issue an 
exception when users try to access Hive Index tables. When the internal 
function `tableExists` tries to access Hive Index tables, it always gets the 
same error message: ```Hive index table is not supported```. This message could 
be confusing to users, since their SQL operations could be completely unrelated 
to Hive Index tables. For example, when users try to alter a table to a new 
name and there exists an index table with the same name, the expected exception 
should be a `TableAlreadyExistsException`.
    
    This PR made the following changes:
    - Introduced a new `AnalysisException` type: 
`SQLFeatureNotSupportedException`. When users try to access an `Index Table`, 
we will issue a `SQLFeatureNotSupportedException`.
    - `tableExists` returns `true` when hitting a 
`SQLFeatureNotSupportedException` and the feature is `Hive index table`.
    - Add a checking `requireTableNotExists` for `SessionCatalog`'s 
`createTable` API; otherwise, the current implementation relies on the Hive's 
internal checking.
    
    ### How was this patch tested?
    Added a test case

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

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

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

    https://github.com/apache/spark/pull/14801.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 #14801
    
----
commit 1af428b68c4341192bf8f66af7c434a7b89be61d
Author: gatorsmile <gatorsm...@gmail.com>
Date:   2016-08-25T06:26:00Z

    fix

commit 664d6f1caa9b3d62eafbddb292991def722910ae
Author: gatorsmile <gatorsm...@gmail.com>
Date:   2016-08-25T06:34:16Z

    improve test cases

commit c400c5292a32549cea80861adfaefeb41f4d90b3
Author: gatorsmile <gatorsm...@gmail.com>
Date:   2016-08-25T07:12:57Z

    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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to