There is no secondary indexes.
The error can be easily recreated.
That is what I did to recreate the error on sqlline:
CREATE TABLE test1.EVENTS (
. . . . . . . . . . . . .> DATE TIMESTAMP NOT NULL,
. . . . . . . . . . . . .> EVENT_TYPE VARCHAR NOT NULL,
. . . . . . . . . . . . .> EVENT_NAME VARCHAR NOT NULL,
. . . . . . . . . . . . .> DEVICE VARCHAR NOT NULL,
. . . . . . . . . . . . .> AID VARCHAR NOT NULL,
. . . . . . . . . . . . .> USER.IP VARCHAR,
. . . . . . . . . . . . .> USER.REFERER VARCHAR,
. . . . . . . . . . . . .> USER.UID VARCHAR,
. . . . . . . . . . . . .> USER.AGENT VARCHAR,
. . . . . . . . . . . . .> USER.DETAIL VARCHAR,
. . . . . . . . . . . . .> EVENT.DETAIL VARCHAR
. . . . . . . . . . . . .> CONSTRAINT PK PRIMARY KEY (DATE, EVENT_TYPE,
EVENT_NAME, DEVICE, AID)
. . . . . . . . . . . . .> ) VERSIONS=2, SALT_BUCKETS = 36;
Found quorum: localhost:2181
0: jdbc:phoenix:localhost> select trunc(date,'DAY',7) as day ,device,
count(distinct uid) from test1.events where date >=
to_date('2014-02-05','yyyy-MM-dd') and date <
to_date('2014-03-05','yyyy-MM-dd') and uid is not null group by
trunc(date,'DAY',7), device;
java.lang.NullPointerException
at
org.apache.phoenix.schema.RowKeyValueAccessor.<init>(RowKeyValueAccessor.java:70)
at
org.apache.phoenix.compile.ExpressionCompiler.wrapGroupByExpression(ExpressionCompiler.java:435)
at
org.apache.phoenix.compile.ExpressionCompiler.visit(ExpressionCompiler.java:521)
at
org.apache.phoenix.compile.ExpressionCompiler.visit(ExpressionCompiler.java:109)
at org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:52)
at
org.apache.phoenix.compile.ProjectionCompiler.compile(ProjectionCompiler.java:223)
at
org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:273)
at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:126)
at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:113)
at
org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:47)
at
org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:42)
at
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.optimizePlan(PhoenixStatement.java:214)
at
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.executeQuery(PhoenixStatement.java:192)
at
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.execute(PhoenixStatement.java:203)
at
org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1029)
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)
On Mon, Mar 17, 2014 at 7:52 PM, James Taylor <[email protected]>wrote:
> Do you have any secondary indexes?
>
> Thanks,
> James
>
>
> On Mon, Mar 17, 2014 at 2:41 PM, Sean Huo <[email protected]> wrote:
>
>> The NPE happens immediately, so it has nothing to do with the actual
>> data, it is a parser error.
>>
>> Thanks
>> Sean
>>
>>
>> On Mon, Mar 17, 2014 at 2:36 PM, James Taylor <[email protected]>wrote:
>>
>>> Do you see any pattern regarding when you get this exception, as in how
>>> many rows you've already upserted or after a particular row was upserted?
>>> Does it happen every time?
>>>
>>> Thanks,
>>> James
>>>
>>>
>>> On Mon, Mar 17, 2014 at 1:41 PM, Sean Huo <[email protected]> wrote:
>>>
>>>> We are running on phoenix 3.0.
>>>>
>>>> Here is the approximate schema:
>>>>
>>>> CREATE TABLE BI.EVENTS (
>>>>
>>>>
>>>> DATE TIMESTAMP NOT NULL,
>>>>
>>>> EVENT_TYPE VARCHAR NOT NULL,
>>>>
>>>> EVENT_NAME VARCHAR NOT NULL,
>>>>
>>>> DEVICE VARCHAR NOT NULL,
>>>>
>>>> AID VARCHAR NOT NULL,
>>>>
>>>> USER.IP VARCHAR,
>>>>
>>>> USER.REFERER VARCHAR,
>>>>
>>>> USER.UID VARCHAR,
>>>>
>>>> USER.AGENT VARCHAR,
>>>>
>>>> USER.DETAIL VARCHAR,
>>>>
>>>> EVENT.DETAIL VARCHAR
>>>>
>>>> CONSTRAINT PK PRIMARY KEY (DATE, EVENT_TYPE, EVENT_NAME, DEVICE,
>>>> AID)
>>>>
>>>> ) VERSIONS=2, SALT_BUCKETS = 36;
>>>>
>>>>
>>>>
>>>>
>>>> On Mon, Mar 17, 2014 at 1:34 PM, Sean Huo <[email protected]> wrote:
>>>>
>>>>> The strang thing is that this query runs fine:
>>>>>
>>>>> select trunc(date,'DAY',7) as day, count(distinct uid) from
>>>>> bi.events where date >= to_date('2014-02-05','yyyy-MM-dd') and date <
>>>>> to_date('2014-03-05','yyyy-MM-dd') and uid is not null group by
>>>>> trunc(date,'DAY',7), device;
>>>>>
>>>>>
>>>>> On Mon, Mar 17, 2014 at 1:32 PM, James Taylor
>>>>> <[email protected]>wrote:
>>>>>
>>>>>> Hi Sean,
>>>>>> What version of Phoenix are you using? Would it be possible to post
>>>>>> your CREATE TABLE statement and also (if you have it), a series of UPSERT
>>>>>> statements that leads to repro-ing this issue?
>>>>>> Thanks,
>>>>>> James
>>>>>>
>>>>>>
>>>>>> On Mon, Mar 17, 2014 at 1:18 PM, Sean Huo <[email protected]>wrote:
>>>>>>
>>>>>>> Why do I get a NPE with this query on sqlline
>>>>>>>
>>>>>>> select trunc(date,'DAY',7) as day ,device, count(distinct uid)
>>>>>>> from bi.events where date >= to_date('2014-02-05','yyyy-MM-dd') and
>>>>>>> date <
>>>>>>> to_date('2014-03-05','yyyy-MM-dd') and uid is not null group by
>>>>>>> trunc(date,'DAY',7), device;
>>>>>>>
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.phoenix.schema.RowKeyValueAccessor.<init>(RowKeyValueAccessor.java:70)
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.phoenix.compile.ExpressionCompiler.wrapGroupByExpression(ExpressionCompiler.java:435)
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.phoenix.compile.ExpressionCompiler.visit(ExpressionCompiler.java:521)
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.phoenix.compile.ExpressionCompiler.visit(ExpressionCompiler.java:109)
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:52)
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.phoenix.compile.ProjectionCompiler.compile(ProjectionCompiler.java:223)
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:273)
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:126)
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:113)
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:47)
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:42)
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.optimizePlan(PhoenixStatement.java:214)
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.executeQuery(PhoenixStatement.java:192)
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.execute(PhoenixStatement.java:203)
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1029)
>>>>>>>
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>> Sean
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>