-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-28474][SQL] Hive 0.12 JDBC client can not handle binary type #25379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,8 @@ | |
| import org.apache.hive.service.cli.thrift.TI64Value; | ||
| import org.apache.hive.service.cli.thrift.TStringValue; | ||
|
|
||
| import org.apache.spark.unsafe.types.UTF8String; | ||
|
|
||
| /** | ||
| * Protocols before HIVE_CLI_SERVICE_PROTOCOL_V6 (used by RowBasedSet) | ||
| * | ||
|
|
@@ -195,7 +197,8 @@ public static TColumnValue toTColumnValue(Type type, Object value) { | |
| case DECIMAL_TYPE: | ||
| return stringValue(((HiveDecimal)value)); | ||
| case BINARY_TYPE: | ||
| return stringValue((String)value); | ||
| String strVal = value == null ? null : UTF8String.fromBytes((byte[])value).toString(); | ||
| return stringValue(strVal); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wangyum, #25480 this might be the cause. It actually reads bytes with UTF-8. IIRC, Java mangles the data if it's not conformed as specified encoding. BTW, we should allow arbitrary binary, for instance, for the use case like images. If you are unable to find the root cause, we can partially revert to the failed protocols for now. |
||
| case ARRAY_TYPE: | ||
| case MAP_TYPE: | ||
| case STRUCT_TYPE: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.