You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Ádám Szita (Jira)" <ji...@apache.org> on 2022/11/16 15:32:00 UTC

[jira] [Created] (HIVE-26745) HPL unable to handle Decimal or null values in hplsql mode

Ádám Szita created HIVE-26745:
---------------------------------

             Summary: 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


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)