Hello Lars Volker, Tim Armstrong,

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

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

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

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


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/51/8051/5
--
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: newpatchset
Gerrit-Change-Id: I8216f4c0f100c1bd68891cd6048236bfe4c205f0
Gerrit-Change-Number: 8051
Gerrit-PatchSet: 5
Gerrit-Owner: Csaba Ringhofer <csringho...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <csringho...@cloudera.com>
Gerrit-Reviewer: Lars Volker <l...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <tarmstr...@cloudera.com>

Reply via email to