Hello Arnab Karmakar, Peter Rozsa, Csaba Ringhofer, Impala Public Jenkins,
I'd like you to reexamine a change. Please visit
https://gerrit.cloudera.org/25184
to look at the new patch set (#2).
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.
DECIMAL(p,s) is not a supported target type yet (IMPALA-15811). Until
then the STRING target gives the exact value: like the JSON form, it
has every digit of the decimal.
A decimal whose scale or unscaled value exceeds the precision of its
physical type is not convertible. The JSON serializer checked only the
scale and printed wrong digits for a larger unscaled value. Now it
rejects such values as malformed too.
Testing:
- Added BE and EE tests for decimal to DOUBLE, FLOAT and integer
conversions, including rounding, overflow and malformed decimals.
- Added BE tests for decimals with out-of-range unscaled values in the
JSON serializer, and for reading decimals as STRING.
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 be/src/runtime/variant-value.cc
M be/src/util/variant-util-test.cc
M
testdata/workloads/functional-query/queries/QueryTest/iceberg-v3-variant-get.test
5 files changed, 306 insertions(+), 6 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/84/25184/2
--
To view, visit https://gerrit.cloudera.org/25184
To unsubscribe, visit https://gerrit.cloudera.org/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id7ba21c38e19440cf0a5161c7f1d753f570d8009
Gerrit-Change-Number: 25184
Gerrit-PatchSet: 2
Gerrit-Owner: Zoltan Borok-Nagy <[email protected]>
Gerrit-Reviewer: Arnab Karmakar <[email protected]>
Gerrit-Reviewer: Csaba Ringhofer <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Peter Rozsa <[email protected]>