Aleksandr Efimov created IMPALA-15486:
-----------------------------------------
Summary: Calcite planner: Fix DECIMAL return types for TRUNC and
ROUND
Key: IMPALA-15486
URL: https://issues.apache.org/jira/browse/IMPALA-15486
Project: IMPALA
Issue Type: Bug
Reporter: Aleksandr Efimov
Assignee: Aleksandr Efimov
For DECIMAL(15,3) with scale 2, Calcite returns DECIMAL(15,2) for TRUNC and
DECIMAL(16,2) for ROUND, instead of DECIMAL(14,2) and DECIMAL(15,2). Clamp
result scale and derive precision from the remaining digits, adding a carry
digit only when rounding reduces scale. Use minimum precision 1 where native
truncation reports DECIMAL(0,0). Cover all five aliases; leave non-decimal
inference unchanged.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)