Impala Public Jenkins has submitted this change and it was merged. ( https://gerrit.cloudera.org/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. 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) Reviewed-on: https://gerrit.cloudera.org/25184 Reviewed-by: Csaba Ringhofer <[email protected]> Reviewed-by: Arnab Karmakar <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> --- 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(-) Approvals: Csaba Ringhofer: Looks good to me, approved Arnab Karmakar: Looks good to me, but someone else must approve Impala Public Jenkins: Verified -- 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: merged Gerrit-Change-Id: Id7ba21c38e19440cf0a5161c7f1d753f570d8009 Gerrit-Change-Number: 25184 Gerrit-PatchSet: 6 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]> Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>
