Michael Smith has submitted this change and it was merged. ( 
https://gerrit.cloudera.org/25024 )

Change subject: IMPALA-15486: Fix DECIMAL scale result types
......................................................................

IMPALA-15486: Fix DECIMAL scale result types

Clamp Calcite DECIMAL scale to the input scale and zero, and derive
precision from the remaining digits. Use minimum precision 1 for
fractional-only truncation. Leave non-decimal inference unchanged.

Preserve the requested scale when deciding whether ROUND/DROUND can
carry, including negative scales on integer decimals. Apply this rule
to both planners and cap the result precision at 38.

Add shared SQL regressions and FE metadata and value checks.

Testing: nine focused FE tests, including 66 rounding type/value checks
across Original DECIMAL V1/V2 and Calcite V2. Both planner baselines fail
the new regression. Shared QueryTest parsing passed.

Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Assisted-by: gpt-6.1-sol
Reviewed-on: https://gerrit.cloudera.org/25024
Reviewed-by: Joe McDonnell <[email protected]>
Reviewed-by: Steve Carlin <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
---
M fe/src/main/java/org/apache/impala/analysis/FunctionCallExpr.java
M 
java/calcite-planner/src/main/java/org/apache/impala/calcite/operators/ImpalaAdjustScaleFunction.java
A 
java/calcite-planner/src/test/java/org/apache/impala/calcite/service/CalciteDecimalScaleTest.java
A testdata/workloads/functional-query/queries/QueryTest/decimal-scale.test
M tests/query_test/test_exprs.py
5 files changed, 357 insertions(+), 5 deletions(-)

Approvals:
  Joe McDonnell: Looks good to me, but someone else must approve
  Steve Carlin: Looks good to me, approved
  Impala Public Jenkins: Verified

--
To view, visit https://gerrit.cloudera.org/25024
To unsubscribe, visit https://gerrit.cloudera.org/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 6
Gerrit-Owner: Aleksandr Efimov <[email protected]>
Gerrit-Reviewer: Aleksandr Efimov <[email protected]>
Gerrit-Reviewer: Aman Sinha <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Joe McDonnell <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>
Gerrit-Reviewer: Steve Carlin <[email protected]>

Reply via email to