ttttttz has uploaded this change for review. ( https://gerrit.cloudera.org/25471
Change subject: IMPALA-15719: Trunc produces incorrect value for large negative scales ...................................................................... IMPALA-15719: Trunc produces incorrect value for large negative scales If the rounding position is further left than the storage type can represent as a power of ten, RoundDecimalNegativeScale() overflowed the scale multiplier and returned the input unchanged, e.g. trunc(1234, -10) returned 1234 instead of 0. The result is always zero when rounding_scale > output_precision, so return 0 directly. This matches Hive, which also returns zero when rounding beyond the most significant digit (FastHiveDecimalImpl. fastRoundIntegerDown/HalfUp). Testing: - Added round()/trunc() cases with large negative scales to exprs.test, covering the 4, 8 and 16 byte decimal paths. Change-Id: I2abcbb9ff1864a6fb883700d8f47b727db27a88e --- M be/src/exprs/decimal-operators-ir.cc M testdata/workloads/functional-query/queries/QueryTest/exprs.test 2 files changed, 26 insertions(+), 0 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/71/25471/1 -- To view, visit https://gerrit.cloudera.org/25471 To unsubscribe, visit https://gerrit.cloudera.org/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I2abcbb9ff1864a6fb883700d8f47b727db27a88e Gerrit-Change-Number: 25471 Gerrit-PatchSet: 1 Gerrit-Owner: ttttttz <[email protected]>
