You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "James Taylor (JIRA)" <ji...@apache.org> on 2014/07/08 17:17:04 UTC

[jira] [Commented] (PHOENIX-1061) PhoenixSQLParser can't handle Long.MIN_VALUE (-9223372036854775808) as a literal.

    [ https://issues.apache.org/jira/browse/PHOENIX-1061?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14055036#comment-14055036 ] 

James Taylor commented on PHOENIX-1061:
---------------------------------------

Related to PHOENIX-385. The reason is that we don't parse negative numbers directly as tokens, but instead only the positive part and treat it as number * -1. Because a long can't store 9223372036854775807 as a positive number since it's bigger than LONG.MAX_VALUE, this fails.

When attempting to capture negative numbers directly as tokens instead, I was running into problems with parsing expressions like this: a-1 AND a - -1

> PhoenixSQLParser can't handle Long.MIN_VALUE (-9223372036854775808) as a literal.
> ---------------------------------------------------------------------------------
>
>                 Key: PHOENIX-1061
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1061
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Kyle Buzsaki
>            Priority: Minor
>
> The PhoenixSQLParser throws a syntax error when the value -9223372036854775808 is used as an integer literal in a select expression. This is Long.MIN_VALUE, so my assumption is that the parser is attempting to parse the sign and magnitude separately and then throwing an error that the magnitude is too large.
> An easy workaround is to replace all uses of -9223372036854775808 with some expression that evaluates to the same value but doesn't use the literal directly. For example, (-9223372036854775807 + -1).
> This issue does not appear to affect upsert expressions.



--
This message was sent by Atlassian JIRA
(v6.2#6252)