[
https://issues.apache.org/jira/browse/PHOENIX-1474?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Maryann Xue reassigned PHOENIX-1474:
------------------------------------
Assignee: Maryann Xue
> NPE when querying with WHERE clause
> -----------------------------------
>
> Key: PHOENIX-1474
> URL: https://issues.apache.org/jira/browse/PHOENIX-1474
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.2
> Environment: CentOS6, HBase 0.98.5, Phoenix 4.2
> Reporter: Jerry Chabot
> Assignee: Maryann Xue
> Attachments: NPE.PNG
>
>
> My queries worked with 4.1. I assume no code changes are required upgrading
> to 4.2. I used to copy the phoenix-4.1.0-server-hadoop2.jar to the HBase lib
> directory. I did not find instructions on how to install Phoenix 4.2. I
> assumed I had to copy the phoenix-4.2.0-server.jar. But, my queries are
> failing with an NPE.
> Here is a simple example that fails using sqlline.py. It fails as soon as I
> add the WHERE clause.
> 0: jdbc:phoenix:localhost> select * from "asset_metadata" as T1 inner join
> "asset_latest_rev" as T2 on T1.L=T2.L and T1.C=T2.C and T1.A=T2.A AND T1.R =
> T2.R;
> +------------+------------+------------+--------------+------------+-----------+
> | T1.L | T1.C | T1.A | T1.REVERSETS | T1.R | T1.W
> |
> +------------+------------+------------+--------------+------------+-----------+
> | 139359021902594048 | 139359004886302720 | 139359021973897216 |
> 9223370620364 |
> | 139359030865825792 | 139359004886302720 | 139359030958096384 |
> 9223370620364 |
> | 139359035940933632 | 139359004886302720 | 139359035974483968 |
> 9223370620364 |
> | 139359035940933632 | 139359004886302720 | 139359065401720832 |
> 9223370620364 |
> | 139359039808081920 | 139359004886302720 | 139359039824855040 |
> 9223370620364 |
> | 139359039808081920 | 139359004886302720 | 139359066852950016 |
> 9223370620364 |
> | 139359055830323200 | 139359042962194432 | 139359055851290624 |
> 9223370620364 |
> | 139359562284142592 | 139359547713126400 | 139359562313498624 |
> 9223370620364 |
> | 139359562284142592 | 139359547713126400 | 139359570307842048 |
> 9223370620364 |
> | 139359562284142592 | 139359547713126400 | 139359574065938432 |
> 9223370620364 |
> | 139359565945769984 | 139359547713126400 | 139359565975126016 |
> 9223370620364 |
> +------------+------------+------------+--------------+------------+-----------+
> 11 rows selected (0.384 seconds)
> 0: jdbc:phoenix:localhost> select * from "asset_metadata" as T1 inner join
> "asset_latest_rev" as T2 on T1.L=T2.L and T1.C=T2.C and T1.A=T2.A AND T1.R =
> T2.R WHERE T1.C=139359004886302720;
> java.lang.NullPointerException
> at
> org.apache.phoenix.compile.WhereOptimizer$KeyExpressionVisitor.andKeySlots(WhereOptimizer.java:643)
> at
> org.apache.phoenix.compile.WhereOptimizer$KeyExpressionVisitor.visitLeave(WhereOptimizer.java:825)
> at
> org.apache.phoenix.compile.WhereOptimizer$KeyExpressionVisitor.visitLeave(WhereOptimizer.java:440)
> at
> org.apache.phoenix.expression.AndExpression.accept(AndExpression.java:100)
> at
> org.apache.phoenix.compile.WhereOptimizer.pushKeyExpressionsToScan(WhereOptimizer.java:122)
> at
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:142)
> at
> org.apache.phoenix.execute.HashJoinPlan.iterator(HashJoinPlan.java:183)
> at
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:220)
> at
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:211)
> at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:210)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1040)
> at sqlline.SqlLine$Commands.execute(SqlLine.java:3673)
> at sqlline.SqlLine$Commands.sql(SqlLine.java:3584)
> at sqlline.SqlLine.dispatch(SqlLine.java:821)
> at sqlline.SqlLine.begin(SqlLine.java:699)
> at sqlline.SqlLine.mainWithInputRedirection(SqlLine.java:441)
> at sqlline.SqlLine.main(SqlLine.java:424)
> It also works if I changed the WHERE to T2.C=139359004886302720. That is T1
> did not work. These also worked.
> Reverse join
> select * from "asset_latest_rev" T2 inner join "asset_metadata" as T1 on
> T1.L=T2.L and T1.C=T2.C and T1.A=T2.A AND T1.R = T2.R WHERE
> T1.C=139359004886302720;
> Move where clause into join clause
> select * from "asset_latest_rev" T2 inner join "asset_metadata" as T1 on
> T1.L=T2.L and T1.C=T2.C and T1.A=T2.A AND T1.R = T2.R AND
> T1.C=139359004886302720;
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)