You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "Aleksandr Efimov (Code Review)" <ge...@cloudera.org> on 2026/10/06 06:52:36 UTC

[Impala-ASF-CR] IMPALA-15486: Calcite planner: Fix DECIMAL return types for TRUNC and ROUND

Hello Steve Carlin, Michael Smith,

I'd like you to do a code review. Please visit

    http://gerrit.cloudera.org:8080/25024

to review the following change.


Change subject: IMPALA-15486: Calcite planner: Fix DECIMAL return types for TRUNC and ROUND
......................................................................

IMPALA-15486: Calcite planner: Fix DECIMAL return types for TRUNC and ROUND

Clamp DECIMAL scale to the input scale and zero, and derive precision
from the remaining digits. Add a carry digit only when ROUND/DROUND
reduce scale; use minimum precision 1 for fractional-only truncation.
Leave non-decimal inference unchanged.

Tests: 20 focused methods standalone, 27 with temporal TRUNC and 24260 PS6.
65 HS2 A/B/A2 cases (195 strict executions, codegen disabled) passed.
10 Calcite fractional-only cases and 10 dynamic codegen cases passed.
All 30 codegen executions matched values and full schemas.
Native 2f022a5; full upstream precommit remains unverified.

Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Assisted-by: GPT-6 (Codex)
---
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
2 files changed, 158 insertions(+), 0 deletions(-)



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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 1
Gerrit-Owner: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>

[Impala-ASF-CR] IMPALA-15486: Fix DECIMAL scale result types

Posted by "Steve Carlin (Code Review)" <ge...@cloudera.org>.
Steve Carlin has posted comments on this change. ( https://gerrit.cloudera.org/25024 )

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


Patch Set 5: Code-Review+2


-- 
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: comment
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 5
Gerrit-Owner: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>
Gerrit-Comment-Date: Tue, 17 Nov 2026 14:18:53 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-15486: Calcite planner: Fix DECIMAL return types for TRUNC and ROUND

Posted by "Steve Carlin (Code Review)" <ge...@cloudera.org>.
Steve Carlin has posted comments on this change. ( http://gerrit.cloudera.org:8080/25024 )

Change subject: IMPALA-15486: Calcite planner: Fix DECIMAL return types for TRUNC and ROUND
......................................................................


Patch Set 1: Code-Review+1

Does this test run on the original planner somewhere?

It would be good if we used one file for both so that we can verify the values are in sync for both planners.

If that's not easy to do or if it complicates this commit too much, we can file that as a separate Jira.


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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 1
Gerrit-Owner: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>
Gerrit-Comment-Date: Thu, 08 Oct 2026 23:23:36 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-15486: Fix DECIMAL scale result types

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( https://gerrit.cloudera.org/25024 )

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


Patch Set 5: Verified+1


-- 
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: comment
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 5
Gerrit-Owner: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>
Gerrit-Comment-Date: Tue, 17 Nov 2026 20:42:41 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-15486: Fix DECIMAL scale result types

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( https://gerrit.cloudera.org/25024 )

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


Patch Set 5:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/24777/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


-- 
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: comment
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 5
Gerrit-Owner: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>
Gerrit-Comment-Date: Mon, 02 Nov 2026 09:21:05 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-15486: Fix DECIMAL scale result types

Posted by "Aleksandr Efimov (Code Review)" <ge...@cloudera.org>.
Aleksandr Efimov has posted comments on this change. ( https://gerrit.cloudera.org/25024 )

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


Patch Set 5:

Gentle ping.


-- 
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: comment
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 5
Gerrit-Owner: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>
Gerrit-Comment-Date: Tue, 17 Nov 2026 08:59:02 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-15486: Fix Calcite DECIMAL scale types

Posted by "Aleksandr Efimov (Code Review)" <ge...@cloudera.org>.
Hello Steve Carlin, Michael Smith, Impala Public Jenkins, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/25024

to look at the new patch set (#3).

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

IMPALA-15486: Fix Calcite DECIMAL scale types

Clamp DECIMAL scale to the input scale and zero, and derive precision
from the remaining digits. Add a carry digit only when ROUND/DROUND
reduce scale; use minimum precision 1 for fractional-only truncation.
Leave non-decimal inference unchanged.

Add one shared QueryTest file for Original and Calcite, covering scale
changes, NULLs, negative values and precision boundaries. Reuse its
queries to compare full HS2 result schemas with fallback disabled.

Testing: focused pytest passed with both planners. The shared test
fails on the parent during Calcite type inference.
Full upstream precommit remains unverified.

Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
---
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/calcite-decimal-scale.test
M tests/query_test/test_calcite_planner.py
4 files changed, 320 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/24/25024/3
-- 
To view, visit http://gerrit.cloudera.org:8080/25024
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 3
Gerrit-Owner: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>

[Impala-ASF-CR] IMPALA-15486: Fix DECIMAL scale result types

Posted by "Aleksandr Efimov (Code Review)" <ge...@cloudera.org>.
Aleksandr Efimov has posted comments on this change. ( https://gerrit.cloudera.org/25024 )

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


Patch Set 4:

(1 comment)

https://gerrit.cloudera.org/#/c/25024/4/java/calcite-planner/src/main/java/org/apache/impala/calcite/operators/ImpalaAdjustScaleFunction.java
File java/calcite-planner/src/main/java/org/apache/impala/calcite/operators/ImpalaAdjustScaleFunction.java:

https://gerrit.cloudera.org/#/c/25024/4/java/calcite-planner/src/main/java/org/apache/impala/calcite/operators/ImpalaAdjustScaleFunction.java@104
PS4, Line 104:       int resultScale = Math.max(0, Math.min(decimalType.decimalScale(), scale));
             :       int integerDigits = decimalType.decimalPrecision() - decimalType.decimalScale();
             :       // Rounding can carry only when reducing the fractional scale.
             :       if ((getName().equals("ROUND") || getName().equals("DROUND"))
             :           && resultScale < decimalType.decimalScale()) {
             :         ++integerDigits;
             :       }
> There is an issue with negative scales for round. round(cast(9995 as decima
Fixed in PS5 for both planners. ROUND/DROUND now keep the carry digit for negative scales, capped at precision 38. Added type and value tests.



-- 
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: comment
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 4
Gerrit-Owner: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>
Gerrit-Comment-Date: Mon, 02 Nov 2026 08:59:55 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-15486: Fix Calcite DECIMAL scale types

Posted by "Aleksandr Efimov (Code Review)" <ge...@cloudera.org>.
Aleksandr Efimov has posted comments on this change. ( http://gerrit.cloudera.org:8080/25024 )

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


Patch Set 2:

The Java test compares both planners' metadata. PS2 adds a shared .test file for values and checks the HS2 schemas too.


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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 2
Gerrit-Owner: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>
Gerrit-Comment-Date: Fri, 09 Oct 2026 08:08:06 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-15486: Fix Calcite DECIMAL scale types

Posted by "Aleksandr Efimov (Code Review)" <ge...@cloudera.org>.
Hello Steve Carlin, Michael Smith, Impala Public Jenkins, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/25024

to look at the new patch set (#2).

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

IMPALA-15486: Fix Calcite DECIMAL scale types

Clamp DECIMAL scale to the input scale and zero, and derive precision
from the remaining digits. Add a carry digit only when ROUND/DROUND
reduce scale; use minimum precision 1 for fractional-only truncation.
Leave non-decimal inference unchanged.

Add one shared QueryTest file for Original and Calcite, covering scale
changes, NULLs, negative values and precision boundaries. Reuse its
queries to compare full HS2 result schemas with fallback disabled.

Testing: focused pytest passed with both planners. The shared test
fails on the parent during Calcite type inference.
Full upstream precommit remains unverified.

Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
---
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/calcite-decimal-scale.test
M tests/query_test/test_calcite_planner.py
4 files changed, 320 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/24/25024/2
-- 
To view, visit http://gerrit.cloudera.org:8080/25024
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 2
Gerrit-Owner: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>

[Impala-ASF-CR] IMPALA-15486: Fix Calcite DECIMAL scale types

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/25024 )

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


Patch Set 2:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/24444/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 2
Gerrit-Owner: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>
Gerrit-Comment-Date: Fri, 09 Oct 2026 08:33:09 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-15486: Fix DECIMAL scale types in Calcite

Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Joe McDonnell has posted comments on this change. ( http://gerrit.cloudera.org:8080/25024 )

Change subject: IMPALA-15486: Fix DECIMAL scale types in Calcite
......................................................................


Patch Set 4:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/25024/4/java/calcite-planner/src/main/java/org/apache/impala/calcite/operators/ImpalaAdjustScaleFunction.java
File java/calcite-planner/src/main/java/org/apache/impala/calcite/operators/ImpalaAdjustScaleFunction.java:

http://gerrit.cloudera.org:8080/#/c/25024/4/java/calcite-planner/src/main/java/org/apache/impala/calcite/operators/ImpalaAdjustScaleFunction.java@104
PS4, Line 104:       int resultScale = Math.max(0, Math.min(decimalType.decimalScale(), scale));
             :       int integerDigits = decimalType.decimalPrecision() - decimalType.decimalScale();
             :       // Rounding can carry only when reducing the fractional scale.
             :       if ((getName().equals("ROUND") || getName().equals("DROUND"))
             :           && resultScale < decimalType.decimalScale()) {
             :         ++integerDigits;
             :       }
There is an issue with negative scales for round. round(cast(9995 as decimal(4,0)),-1) should be able to produce a decimal(5,0) with 10000. 

We're clamping the result scale to zero, but negative scales can result in an extra digit.

This would require handling cases where the result can exceed the max precision (i.e. round(decimal(38,0), -1) should stay at decimal(38,0)).

The original planner has the same issue in FunctionCallExpr's resolveDecimalReturnType().


http://gerrit.cloudera.org:8080/#/c/25024/4/testdata/workloads/functional-query/queries/QueryTest/decimal-scale.test
File testdata/workloads/functional-query/queries/QueryTest/decimal-scale.test:

http://gerrit.cloudera.org:8080/#/c/25024/4/testdata/workloads/functional-query/queries/QueryTest/decimal-scale.test@18
PS4, Line 18:   trunc(d,-1) as negative_scale,
I was looking at what happens for trunc with a larger numbers and a larger negative scale. I found a bug in other code that applies to the original planner and Calcite.
trunc(1234, -11) is not zero. It's 1234, which is wrong.

I see that as separate to this change, so I filed IMPALA-15719 for that



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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 4
Gerrit-Owner: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>
Gerrit-Comment-Date: Fri, 30 Oct 2026 22:24:31 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-15486: Calcite planner: Fix DECIMAL return types for TRUNC and ROUND

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/25024 )

Change subject: IMPALA-15486: Calcite planner: Fix DECIMAL return types for TRUNC and ROUND
......................................................................


Patch Set 1:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/24339/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 1
Gerrit-Owner: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>
Gerrit-Comment-Date: Tue, 06 Oct 2026 07:15:57 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-15486: Fix Calcite DECIMAL scale types

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/25024 )

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


Patch Set 3:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/24505/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 3
Gerrit-Owner: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>
Gerrit-Comment-Date: Tue, 13 Oct 2026 16:01:09 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-15486: Fix DECIMAL scale result types

Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Joe McDonnell has posted comments on this change. ( https://gerrit.cloudera.org/25024 )

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


Patch Set 5: Code-Review+1

This is looking good to me


-- 
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: comment
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 5
Gerrit-Owner: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>
Gerrit-Comment-Date: Fri, 06 Nov 2026 00:51:14 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-15486: Fix DECIMAL scale result types

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( https://gerrit.cloudera.org/25024 )

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


Patch Set 5:

Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/14512/ DRY_RUN=true


-- 
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: comment
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 5
Gerrit-Owner: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>
Gerrit-Comment-Date: Tue, 17 Nov 2026 15:55:26 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-15486: Fix DECIMAL scale result types

Posted by "Aleksandr Efimov (Code Review)" <ge...@cloudera.org>.
Hello Aman Sinha, Steve Carlin, Michael Smith, Joe McDonnell, Impala Public Jenkins, 

I'd like you to reexamine a change. Please visit

    https://gerrit.cloudera.org/25024

to look at the new patch set (#5).

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
---
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(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/24/25024/5
-- 
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: newpatchset
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 5
Gerrit-Owner: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>

[Impala-ASF-CR] IMPALA-15486: Fix DECIMAL scale types in Calcite

Posted by "Aleksandr Efimov (Code Review)" <ge...@cloudera.org>.
Hello Aman Sinha, Steve Carlin, Michael Smith, Joe McDonnell, Impala Public Jenkins, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/25024

to look at the new patch set (#4).

Change subject: IMPALA-15486: Fix DECIMAL scale types in Calcite
......................................................................

IMPALA-15486: Fix DECIMAL scale types in Calcite

Clamp DECIMAL scale to the input scale and zero, and derive precision
from the remaining digits. Add a carry digit only when ROUND/DROUND
reduce scale; use minimum precision 1 for fractional-only truncation.
Leave non-decimal inference unchanged.

Add SQL regression cases to the shared expression suite. Keep exact
result metadata parity checks in CalciteDecimalScaleTest.

Testing: QueryTest parsing and eight focused metadata parity tests.

Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
---
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
4 files changed, 266 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/24/25024/4
-- 
To view, visit http://gerrit.cloudera.org:8080/25024
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 4
Gerrit-Owner: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>

[Impala-ASF-CR] IMPALA-15486: Fix DECIMAL scale types in Calcite

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/25024 )

Change subject: IMPALA-15486: Fix DECIMAL scale types in Calcite
......................................................................


Patch Set 4:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/24728/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8f6e6e2eaa7fe6eeab88b4143ed6b73e65220333
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 4
Gerrit-Owner: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>
Gerrit-Comment-Date: Wed, 28 Oct 2026 18:44:24 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-15486: Fix DECIMAL scale result types

Posted by "Michael Smith (Code Review)" <ge...@cloudera.org>.
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 <jo...@cloudera.com>
Reviewed-by: Steve Carlin <sc...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
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 <dz...@gmail.com>
Gerrit-Reviewer: Aleksandr Efimov <dz...@gmail.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>