Skip to content

NPE when preparing async group by #6122

@nwoolmer

Description

@nwoolmer

To reproduce

From demo:

2025-09-10T08:48:52.771328Z C i.q.c.h.p.JsonQueryProcessorState [2351813555243] internal error [ex=^M
java.lang.NullPointerException: Cannot invoke "io.questdb.griffin.engine.functions.GroupByFunction.setAllocator(io.questdb.griffin.engine.groupby.GroupByAllocator)" because the return value of "io.questdb.st
d.ObjList.getQuick(int)" is null^M
        at io.questdb.griffin.engine.groupby.GroupByUtils.setAllocator(GroupByUtils.java:461)^M
        at io.questdb.griffin.engine.table.AsyncGroupByNotKeyedAtom.getFunctionUpdater(AsyncGroupByNotKeyedAtom.java:191)^M
        at io.questdb.griffin.engine.table.AsyncGroupByNotKeyedAtom.clear(AsyncGroupByNotKeyedAtom.java:136)^M
        at io.questdb.cairo.sql.async.PageFrameSequence.clear(PageFrameSequence.java:207)^M
        at io.questdb.cairo.sql.async.PageFrameSequence.close(PageFrameSequence.java:222)^M
        at io.questdb.std.Misc.free(Misc.java:63)^M
        at io.questdb.griffin.engine.table.AsyncGroupByNotKeyedRecordCursorFactory._close(AsyncGroupByNotKeyedRecordCursorFactory.java:292)^M
        at io.questdb.cairo.AbstractRecordCursorFactory.close(AbstractRecordCursorFactory.java:39)^M
        at io.questdb.std.Misc.free(Misc.java:63)^M
        at io.questdb.griffin.SqlCodeGenerator.generateSetFactory(SqlCodeGenerator.java:5615)^M
        at io.questdb.griffin.SqlCodeGenerator.generateQuery(SqlCodeGenerator.java:3731)^M
        at io.questdb.griffin.SqlCodeGenerator.generateSubQuery(SqlCodeGenerator.java:5625)^M
        at io.questdb.griffin.SqlCodeGenerator.generateSelectChoose(SqlCodeGenerator.java:4256)^M
        at io.questdb.griffin.SqlCodeGenerator.generateSelect(SqlCodeGenerator.java:4226)^M
        at io.questdb.griffin.SqlCodeGenerator.generateQuery0(SqlCodeGenerator.java:3741)^M
        at io.questdb.griffin.SqlCodeGenerator.generateQuery(SqlCodeGenerator.java:3729)^M
        at io.questdb.griffin.SqlCodeGenerator.generate(SqlCodeGenerator.java:559)^M
        at io.questdb.griffin.SqlCompilerImpl.generateSelectOneShot(SqlCompilerImpl.java:4121)^M
        at io.questdb.griffin.SqlCompilerImpl.generateSelectWithRetries(SqlCompilerImpl.java:473)^M
        at io.questdb.griffin.SqlCompilerImpl.compileUsingModel(SqlCompilerImpl.java:3080)^M
        at io.questdb.griffin.SqlCompilerImpl.compileInner(SqlCompilerImpl.java:2480)^M
        at io.questdb.griffin.SqlCompilerImpl.compile(SqlCompilerImpl.java:355)^M
        at io.questdb.cairo.pool.SqlCompilerPool$C.compile(SqlCompilerPool.java:139)^M
        at io.questdb.cutlass.http.processors.JsonQueryProcessor.compileAndExecuteQuery(JsonQueryProcessor.java:504)^M
        at io.questdb.cutlass.http.processors.JsonQueryProcessor.execute0(JsonQueryProcessor.java:215)^M
        at io.questdb.cutlass.http.processors.JsonQueryProcessor.onRequestComplete(JsonQueryProcessor.java:292)^M
        at io.questdb.cutlass.http.HttpConnectionContext.handleClientRecv(HttpConnectionContext.java:910)^M
        at io.questdb.cutlass.http.HttpConnectionContext.handleClientOperation(HttpConnectionContext.java:307)^M
        at io.questdb.cutlass.http.HttpServer.handleClientOperation(HttpServer.java:343)^M
        at io.questdb.cutlass.http.HttpServer$1.lambda$$0(HttpServer.java:129)^M
        at io.questdb.network.AbstractIODispatcher.processIOQueue(AbstractIODispatcher.java:217)^M
        at io.questdb.cutlass.http.HttpServer$1.run(HttpServer.java:133)^M
        at io.questdb.mp.Worker.run(Worker.java:152)^M
, q=`with t AS
( select * from trades where timestamp in yesterday()),
d as (select * from t order by timestamp desc)
select first(timestamp::integer) as timestamp from t
UNION ALL
select first_value(timestamp) over (order by timestamp desc) from d
UNION ALL
(select timestamp from d LIMIT 1)
order by timestamp`]^M

QuestDB version:

9.0.3+

OS, in case of Docker specify Docker and the Host OS:

N/A

File System, in case of Docker specify Host File System:

N/A

Full Name:

Nick Woolmer

Affiliation:

QuestDB

Have you followed Linux, MacOs kernel configuration steps to increase Maximum open files and Maximum virtual memory areas limit?

  • Yes, I have

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIncorrect or unexpected behaviorSQLIssues or changes relating to SQL execution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions