Arnab Karmakar has posted comments on this change. ( https://gerrit.cloudera.org/25184 )
Change subject: IMPALA-15611: Convert VARIANT decimals in typed variant_get() ...................................................................... Patch Set 1: (4 comments) Thanks for working on this! https://gerrit.cloudera.org/#/c/25184/1//COMMIT_MSG Commit Message: https://gerrit.cloudera.org/#/c/25184/1//COMMIT_MSG@24 PS1, Line 24: as in the JSON serializer I think the serializer currently only checks the scale and not the precision. https://gerrit.cloudera.org/#/c/25184/1/be/src/exprs/variant-functions-ir.cc File be/src/exprs/variant-functions-ir.cc: https://gerrit.cloudera.org/#/c/25184/1/be/src/exprs/variant-functions-ir.cc@137 PS1, Line 137: bool GetDecimal(const VariantValue& sub, Decimal16Value* dv, int* scale) { I think there's an issue, not within this CR. We check and reject when unscaled > MAX_UNSCALED_DECIMAL* here but not in the serialization code in VariantJsonSerializer::Write() for decimal https://github.com/apache/impala/blob/c2b187038aeaf63567f888528eefba1e11eb6312/be/src/runtime/variant-value.cc#L697-L737. I think this can cause wrong results to be written as DecimalValue::ToString() assumes the unscaled value fits in precision digits. https://gerrit.cloudera.org/#/c/25184/1/be/src/exprs/variant-functions-ir.cc@138 PS1, Line 138: __int128_t unscaled; The callers guard it currently but I think we could make it safer as the comment says "must be a PRIMITIVE" by adding: DCHECK(sub.GetBasicType() == VariantBasicType::PRIMITIVE); https://gerrit.cloudera.org/#/c/25184/1/be/src/exprs/variant-functions-test.cc File be/src/exprs/variant-functions-test.cc: https://gerrit.cloudera.org/#/c/25184/1/be/src/exprs/variant-functions-test.cc@479 PS1, Line 479: // 127.5 rounds to 128, which overflows TINYINT; 3000000000 overflows INT. can we also try out the negative side -128.5 to TINYINT, which rounds to -129? -- 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: comment Gerrit-Change-Id: Id7ba21c38e19440cf0a5161c7f1d753f570d8009 Gerrit-Change-Number: 25184 Gerrit-PatchSet: 1 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-Comment-Date: Fri, 13 Nov 2026 18:54:38 +0000 Gerrit-HasComments: Yes
