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 <sean@crunchyroll.com> 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 <sean@crunchyroll.com> 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 <jamestaylor@apache.org> 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 <sean@crunchyroll.com> 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