GitHub user gatorsmile opened a pull request:

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

    [SPARK-16935] [SQL] Verification of Function-related ExternalCatalog APIs

    ### What changes were proposed in this pull request?
    Function-related `HiveExternalCatalog` APIs do not have enough verification 
logics. After the PR, `HiveExternalCatalog` and `InMemoryCatalog` become 
consistent in the error handling. 
    
    For example, below is the exception we got when calling `renameFunction`. 
    ```
    15:13:40.369 WARN org.apache.hadoop.hive.metastore.ObjectStore: Failed to 
get database db1, returning NoSuchObjectException
    15:13:40.377 WARN org.apache.hadoop.hive.metastore.ObjectStore: Failed to 
get database db2, returning NoSuchObjectException
    15:13:40.739 ERROR DataNucleus.Datastore.Persist: Update of object 
"org.apache.hadoop.hive.metastore.model.MFunction@205629e9" using statement 
"UPDATE FUNCS SET FUNC_NAME=? WHERE FUNC_ID=?" failed : 
org.apache.derby.shared.common.error.DerbySQLIntegrityConstraintViolationException:
 The statement was aborted because it would have caused a duplicate key value 
in a unique or primary key constraint or unique index identified by 
'UNIQUEFUNCTION' defined on 'FUNCS'.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
Source)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
Source)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
Source)
    ```
    
    ### How was this patch tested?
    Improved the existing test cases to check whether the messages are right.

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

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

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

    https://github.com/apache/spark/pull/14521.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 #14521
    
----
commit e53809aeccb936ade39abbbaab408fccbe347b7f
Author: gatorsmile <[email protected]>
Date:   2016-08-04T22:45:09Z

    fix

commit 58cba4ba3658d2b0c5bb7bf7b0bfe929bec1aafd
Author: gatorsmile <[email protected]>
Date:   2016-08-06T15:32:22Z

    Merge remote-tracking branch 'upstream/master' into functionChecking

----


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to