Impala Public Jenkins has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/8051 )
Change subject: IMPALA-5668: Fix cast(X as timestamp) for negative subsecond Decimals ...................................................................... IMPALA-5668: Fix cast(X as timestamp) for negative subsecond Decimals The timestamp conversion from negative fractional Decimal types (interpreted as unix timestamp) was wrong - the whole part was rounded toward zero, and fractional part was being added instead of being subtracted. This is fixed by subtracting the fractional part in case of negative decimals. Example for the wrong behaviour: +-------------------------------------------------+ | cast(cast(-0.1 as decimal(18,10)) as timestamp) | +-------------------------------------------------+ | 1970-01-01 00:00:00.100000000 | +-------------------------------------------------+ while casting to double works correctly: +-----------------------------------------+ | cast(cast(-0.1 as double) as timestamp) | +-----------------------------------------+ | 1969-12-31 23:59:59.900000000 | +-----------------------------------------+ Change-Id: I8216f4c0f100c1bd68891cd6048236bfe4c205f0 Reviewed-on: http://gerrit.cloudera.org:8080/8051 Reviewed-by: Tim Armstrong <[email protected]> Tested-by: Impala Public Jenkins --- M be/src/exprs/decimal-operators-ir.cc M be/src/exprs/decimal-operators.h M be/src/exprs/expr-test.cc M be/src/runtime/decimal-value.h M be/src/runtime/timestamp-value.h 5 files changed, 45 insertions(+), 37 deletions(-) Approvals: Tim Armstrong: Looks good to me, approved Impala Public Jenkins: Verified -- To view, visit http://gerrit.cloudera.org:8080/8051 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I8216f4c0f100c1bd68891cd6048236bfe4c205f0 Gerrit-Change-Number: 8051 Gerrit-PatchSet: 7 Gerrit-Owner: Csaba Ringhofer <[email protected]> Gerrit-Reviewer: Csaba Ringhofer <[email protected]> Gerrit-Reviewer: Impala Public Jenkins Gerrit-Reviewer: Lars Volker <[email protected]> Gerrit-Reviewer: Tim Armstrong <[email protected]>
