[
https://issues.apache.org/jira/browse/PHOENIX-2475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15069224#comment-15069224
]
ramkrishna.s.vasudevan commented on PHOENIX-2475:
-------------------------------------------------
Just to add on.. Once the BigDecimal is created for the 2nd child (ie. '1') we
do
{code}
public static Timestamp getTimestamp(BigDecimal bd) {
return DateUtil.getTimestamp(bd.longValue(),
((bd.remainder(BigDecimal.ONE).multiply(BigDecimal.valueOf(MILLIS_TO_NANOS_CONVERTOR))).intValue()));
}
{code}
And this yields a nano sec value of -9999 and hence the parsing of the
timestamp fails in
{code}
public static Timestamp getTimestamp(long millis, int nanos) {
if (nanos > MAX_ALLOWED_NANOS || nanos < 0) {
throw new IllegalArgumentException("nanos > " + MAX_ALLOWED_NANOS +
" or < 0");
}
{code}
> Date arithmetic broken for time and timestamp
> ---------------------------------------------
>
> Key: PHOENIX-2475
> URL: https://issues.apache.org/jira/browse/PHOENIX-2475
> Project: Phoenix
> Issue Type: New Feature
> Affects Versions: 4.6.0
> Reporter: Kevin Liew
> Priority: Minor
> Labels: date, newbie, phoenix, timestamp
> Fix For: 4.7.0
>
>
> Create a timestamp table and insert a timestamp
> {noformat}create table timestamp_table (ts timestamp primary key)upsert into
> timestamp_table values ('1995-05-02 01:01:01'){noformat}
> Example test case
> {noformat}select ts + 1 from timestamp_table{noformat}
> Expected result:
> The timestamp with one day added to it
> {noformat}1995-05-03 01:01:01{noformat}
> Actual result:
> the unmodified timestamp
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)