GitHub user liancheng opened a pull request:
https://github.com/apache/spark/pull/9911
[WIP][SPARK-9686][SQL] Redirect JDBC metadata calls to Spark SQL metadata
Hive client
This PR is based on the patch @navis provided in [SPARK-9686][1].
Basically, it overrides all JDBC metadata related methods in
`SparkSQLCLIService`, overrides session `HiveConf` with proper configurations,
and wraps the original calls with `hiveContext.metadataHive.withHiveState`, so
that metadata stored in the real Hive metastore can be retrieved.
Unfortunately, both @navis and I observed that this approach doesn't play
well with embedded metastore, because Hive somehow tries to establish multiple
connections to the local Derby metastore database while Derby doesn't support
multi-connection.
I've being digging this for a while, but failed to figure out a valid
fix/workaround for this issue. (So the test case added in this PR doesn't
pass.) My impression is that, somehow the `HiveMetaStoreClient` belongs to
metadata Hive client got a snapshot of the `HiveConf` of the execution Hive
client, thus makes Hive try to establish a new connection instead of reusing
the existing connection because this `HiveConf` is considered to be
"[incompatible][2]" with the session `HiveConf`.
[1]: https://issues.apache.org/jira/browse/SPARK-9686
[2]:
https://github.com/apache/hive/blob/release-1.2.1/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java#L279-L297
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/liancheng/spark spark-9686.jdbc-metadata
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/9911.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 #9911
----
commit 65aa390e5fc60fc7da7dcc83a7ef0033c7795db7
Author: Cheng Lian <[email protected]>
Date: 2015-11-21T09:10:12Z
WIP
----
---
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]