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

Csaba Skrabak commented on PHOENIX-3893:
----------------------------------------

I have tried the failing query with the where clause on a Phoenix version 4.7. 
I didn't get any NullPointerException. 

With 4.10 code, the stack trace was like this:

java.lang.NullPointerException
        at 
org.apache.phoenix.compile.JoinCompiler$JoinTableConstructor.resolveTable(JoinCompiler.java:181)
        at 
org.apache.phoenix.compile.JoinCompiler$JoinTableConstructor.visit(JoinCompiler.java:218)
        at 
org.apache.phoenix.compile.JoinCompiler$JoinTableConstructor.visit(JoinCompiler.java:175)
        at 
org.apache.phoenix.parse.DerivedTableNode.accept(DerivedTableNode.java:49)
        at 
org.apache.phoenix.compile.JoinCompiler$JoinTableConstructor.visit(JoinCompiler.java:195)
        at 
org.apache.phoenix.compile.JoinCompiler$JoinTableConstructor.visit(JoinCompiler.java:175)
        at org.apache.phoenix.parse.JoinTableNode.accept(JoinTableNode.java:81)
        at 
org.apache.phoenix.compile.JoinCompiler.compile(JoinCompiler.java:135)
        at 
org.apache.phoenix.compile.JoinCompiler.optimize(JoinCompiler.java:1164)
        at 
org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:194)
        at 
org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:157)
        at 
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:420)
        at 
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:394)
        at 
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:280)
        at 
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:270)
        at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
        at 
org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:269)
        at 
org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:1479)

> Using the TO_TIMESTAMP function in a WHERE statement causes an error.
> ---------------------------------------------------------------------
>
>                 Key: PHOENIX-3893
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3893
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.10.0
>            Reporter: seoungho park
>
> {code}
> SELECT 
>   "type", COUNT(DISTINCT "offset")
> FROM "log"
> LEFT OUTER JOIN (SELECT TO_TIMESTAMP('2017-05-29 02:53:00') AS "start") AS 
> "s" ON 1=1
> LEFT OUTER JOIN (SELECT TO_TIMESTAMP('2017-05-29 02:55:00') AS "end") AS "e" 
> ON 1=1
> WHERE "date" >= "start" AND "date" < "end"
> GROUP BY "type"
> {code}
> -> It return the correct result
> {code}
> SELECT 
>   "type", COUNT(DISTINCT "offset")
> FROM "log"
> WHERE "date" >= TO_TIMESTAMP('2017-05-29 02:53:00') AND "date" < 
> TO_TIMESTAMP('2017-05-29 02:55:00')
> GROUP BY "type"
> {code}
> -> It return the java.lang.NullPointerException
> The second query should return the same result as above, and why is this 
> issue happening?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to