[
https://issues.apache.org/jira/browse/HIVE-26745?focusedWorklogId=826576&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-826576
]
ASF GitHub Bot logged work on HIVE-26745:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 16/Nov/22 17:07
Start Date: 16/Nov/22 17:07
Worklog Time Spent: 10m
Work Description: zeroflag commented on code in PR #3769:
URL: https://github.com/apache/hive/pull/3769#discussion_r1024278069
##########
service/src/java/org/apache/hive/service/cli/operation/hplsql/HplSqlQueryExecutor.java:
##########
@@ -133,6 +138,11 @@ public <T> T get(int columnIndex, Class<T> type) {
if (type == Byte.class)
return type.cast(((Number) current[columnIndex]).byteValue());
}
+ // RowSet can never return BigDecimal or HiveDecimal instances, they'd
get converted to String
+ if (type == BigDecimal.class &&
Review Comment:
Does this check work for the HiveDecimal case too? If yes, then LGTM.
Issue Time Tracking
-------------------
Worklog Id: (was: 826576)
Remaining Estimate: 0h
Time Spent: 10m
> HPL unable to handle Decimal or null values in hplsql mode
> ----------------------------------------------------------
>
> Key: HIVE-26745
> URL: https://issues.apache.org/jira/browse/HIVE-26745
> Project: Hive
> Issue Type: Bug
> Reporter: Ádám Szita
> Assignee: Ádám Szita
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Decimal or null values coming from Hive service side are not handled properly
> in HPL.
> When we're using beeline in HPL mode then the results of queries such as
> SELECT CAST are returned in RowSet objects directly from HS2 code. This is
> due to HplSqlQueryExecutor expecting RowSet type in OperationRowResult. For
> this RowSet interface, a ColumnBasedSet class brings the imlementation which
> holds a ColumnBuffer list to hold the result data.
> The internal representation however cannot hold BigDecimal values, as seen
> here:
> https://github.com/apache/hive/blob/master/serde/src/java/org/apache/hadoop/hive/serde2/thrift/ColumnBuffer.java#L396
> so while the SELECT CAST query will produce a HiveBigDecimal instance, it
> will be converted to String at
> https://github.com/apache/hive/blob/master/service/src/java/org/apache/hive/service/cli/ColumnBasedSet.java#L110-L112
> before we add this piece of data to the result set.
> Further down the line we will see class java.lang.String cannot be casted to
> class java.math.BigDecimal.
> ColumnBuffer seems like a pretty commonly used code and I don't think we
> would want to try and extend this with the ability the carry decimal types.
> Perhaps we could create a Jira to recreate the BigDecimal value from the
> String representation arriving on the HPL side.
> Since the two issues are both about value conversion I'm aiming to fix these
> in one go.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)