Skip to content

Conversation

@JoshRosen
Copy link
Contributor

@JoshRosen JoshRosen commented Sep 1, 2016

What changes were proposed in this pull request?

Attempting to use Spark SQL's JDBC data source against the Hive ThriftServer results in a java.sql.SQLException: Method not supported exception from org.apache.hive.jdbc.HiveResultSetMetaData.isSigned. Here are two user reports of this issue:

I have filed HIVE-14684 to attempt to fix this in Hive by implementing the isSigned method, but in the meantime / for compatibility with older JDBC drivers I think we should add special-case error handling to work around this bug.

This patch updates JDBCRDD's ResultSetMetadata to schema conversion to catch the "Method not supported" exception from Hive and return isSigned = true. I believe that this is safe because, as far as I know, Hive does not support unsigned numeric types.

How was this patch tested?

Tested manually against a Spark Thrift Server.

@SparkQA
Copy link

SparkQA commented Sep 1, 2016

Test build #64761 has finished for PR 14911 at commit 6b56880.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@yhuai
Copy link
Contributor

yhuai commented Sep 1, 2016

LGTM

@JoshRosen
Copy link
Contributor Author

Alright, I'm going to merge this into master and branch-2.0.

asfgit pushed a commit that referenced this pull request Sep 1, 2016
…ned exception

## What changes were proposed in this pull request?

Attempting to use Spark SQL's JDBC data source against the Hive ThriftServer results in a `java.sql.SQLException: Method` not supported exception from `org.apache.hive.jdbc.HiveResultSetMetaData.isSigned`. Here are two user reports of this issue:

- https://stackoverflow.com/questions/34067686/spark-1-5-1-not-working-with-hive-jdbc-1-2-0
- https://stackoverflow.com/questions/32195946/method-not-supported-in-spark

I have filed [HIVE-14684](https://issues.apache.org/jira/browse/HIVE-14684) to attempt to fix this in Hive by implementing the isSigned method, but in the meantime / for compatibility with older JDBC drivers I think we should add special-case error handling to work around this bug.

This patch updates `JDBCRDD`'s `ResultSetMetadata` to schema conversion to catch the "Method not supported" exception from Hive and return `isSigned = true`. I believe that this is safe because, as far as I know, Hive does not support unsigned numeric types.

## How was this patch tested?

Tested manually against a Spark Thrift Server.

Author: Josh Rosen <[email protected]>

Closes #14911 from JoshRosen/hive-jdbc-workaround.

(cherry picked from commit 15539e5)
Signed-off-by: Josh Rosen <[email protected]>
@asfgit asfgit closed this in 15539e5 Sep 1, 2016
@JoshRosen JoshRosen deleted the hive-jdbc-workaround branch September 1, 2016 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants