Zoltan Borok-Nagy has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/25184


Change subject: IMPALA-15611: Convert VARIANT decimals in typed variant_get()
......................................................................

IMPALA-15611: Convert VARIANT decimals in typed variant_get()

The typed form of variant_get(v, path, type) rejected VARIANT values of
the DECIMAL4, DECIMAL8 and DECIMAL16 physical types for every numeric
target type: variant_get() raised "not convertible" and
try_variant_get() returned NULL. Spark's parse_json() stores JSON
numbers with a fractional part as decimals, so this affected most such
values written by Spark.

Decimals now convert like the matching CAST:
- DOUBLE and FLOAT convert like CAST(decimal AS DOUBLE/FLOAT).
- The integer types round half away from zero, like CAST(decimal AS
  BIGINT). A rounded value outside the range of the target type is an
  out-of-range error, or NULL for try_variant_get(). Spark truncates
  instead.

A decimal whose scale or unscaled value exceeds the precision of its
physical type is not convertible, as in the JSON serializer.

Testing:
- Added BE and EE tests for decimal to DOUBLE, FLOAT and integer
  conversions, including rounding, overflow and malformed decimals.

Change-Id: Id7ba21c38e19440cf0a5161c7f1d753f570d8009
Assisted-by: Claude Opus 5.5 (Claude Code)
---
M be/src/exprs/variant-functions-ir.cc
M be/src/exprs/variant-functions-test.cc
M 
testdata/workloads/functional-query/queries/QueryTest/iceberg-v3-variant-get.test
3 files changed, 228 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/84/25184/1
--
To view, visit http://gerrit.cloudera.org:8080/25184
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id7ba21c38e19440cf0a5161c7f1d753f570d8009
Gerrit-Change-Number: 25184
Gerrit-PatchSet: 1
Gerrit-Owner: Zoltan Borok-Nagy <[email protected]>

Reply via email to