[ https://issues.apache.org/jira/browse/PHOENIX-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14351295#comment-14351295 ]
James Taylor commented on PHOENIX-1577: --------------------------------------- Thanks for the patch, [~samarthjain]. LGTM. Couple of questions/comments: - Looks like only white space changes (unless I'm missing something). If so, please revert: {code} diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java index 9a82cc0..c71db44 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestamp.java @@ -108,8 +108,7 @@ public class PTimestamp extends PDataType<Timestamp> { * of time stamp to be present both in the LONG and INT bytes. Having the <100000 check * makes this serialization fix backward compatible. */ - v.setNanos( - nanosDeserialized < 1000000 ? v.getNanos() + nanosDeserialized : nanosDeserialized); + v.setNanos(nanosDeserialized < 1000000 ? v.getNanos() + nanosDeserialized : nanosDeserialized); return v; } else if (equalsAny(actualType, PDate.INSTANCE, PUnsignedDate.INSTANCE, PTime.INSTANCE, PUnsignedTime.INSTANCE, PLong.INSTANCE, PUnsignedLong.INSTANCE)) { {code} - Would your test fail without this patch? - Have you tried the test case/repro linked to the JIRA and does it pass now (maybe this is the distilled version)? > java.lang.IllegalArgumentException: nanos > 999999999 or < 0 while use > Calendar > ------------------------------------------------------------------------------- > > Key: PHOENIX-1577 > URL: https://issues.apache.org/jira/browse/PHOENIX-1577 > Project: Phoenix > Issue Type: Bug > Affects Versions: 4.2 > Reporter: Kylin Soong > Assignee: Samarth Jain > Attachments: PHOENIX-1577.patch > > > I use the link [1] code, there always nanos > 999999999 or < 0 error throw. > If execute insert, the error looks like: > ~~~ > Exception in thread "main" java.lang.IllegalArgumentException: nanos > > 999999999 or < 0 > at java.sql.Timestamp.setNanos(Timestamp.java:386) > at org.apache.phoenix.util.DateUtil.getTimestamp(DateUtil.java:142) > at > org.apache.phoenix.jdbc.PhoenixPreparedStatement.setTimestamp(PhoenixPreparedStatement.java:489) > ~~~ > and select the error looks > ~~~ > xception in thread "main" java.lang.IllegalArgumentException: nanos > > 999999999 or < 0 > at java.sql.Timestamp.setNanos(Timestamp.java:386) > at org.apache.phoenix.util.DateUtil.getTimestamp(DateUtil.java:142) > at > org.apache.phoenix.jdbc.PhoenixResultSet.getTimestamp(PhoenixResultSet.java:638) > ~~~ > Does this can be a bug? > [1] > https://github.com/kylinsoong/data/blob/master/phoenix-quickstart/src/test/java/org/apache/phoenix/examples/BugReproduce.java -- This message was sent by Atlassian JIRA (v6.3.4#6332)