Invalid query accepted, then results in unexpected error
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.3k
- Forks
- 1.6k
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 28
Description
To reproduce
This small example uses a SELECT MAX to get a single-row result set, then wants to use that as a value in equality comparison. The compiler allows it, and then the query fails at execution time.
create table x (a_long LONG);
insert into x values (1), (2), (3);
WITH MaxLong AS ( SELECT MAX(a_long) AS max_long FROM x )
SELECT * FROM x WHERE a_long = (SELECT max_long FROM MaxLong);
2024-07-11T08:37:02.713197Z E i.q.g.e.t.AsyncFilteredRecordCursor filter error [ex=
io.questdb.cairo.CairoException: [-1] unexpected filter error
at io.questdb.cairo.CairoException.instance(CairoException.java:319)
at io.questdb.cairo.CairoException.nonCritical(CairoException.java:120)
at io.questdb.griffin.engine.table.AsyncFilteredRecordCursor.fetchNextFrame(AsyncFilteredRecordCursor.java:320)
at io.questdb.griffin.engine.table.AsyncFilteredRecordCursor.hasNext(AsyncFilteredRecordCursor.java:169)
at io.questdb.griffin.engine.QueryProgress$RegisteredRecordCursor.hasNext(QueryProgress.java:276)
at io.questdb.cutlass.http.processors.JsonQueryProcessorState.setupFirstRecord(JsonQueryProcessorState.java:823)
at io.questdb.cutlass.http.processors.JsonQueryProcessorState.onSetupFirstRecord(JsonQueryProcessorState.java:773)
at io.questdb.cutlass.http.processors.JsonQueryProcessorState.resume(JsonQueryProcessorState.java:929)
at io.questdb.cutlass.http.processors.JsonQueryProcessor.doResumeSend(JsonQueryProcessor.java:336)
at io.questdb.cutlass.http.processors.JsonQueryProcessor.executeSelect(JsonQueryProcessor.java:594)
at io.questdb.cutlass.http.processors.JsonQueryProcessor.executeNewSelect(JsonQueryProcessor.java:563)
at io.questdb.cutlass.http.processors.JsonQueryProcessor.compileAndExecuteQuery(JsonQueryProcessor.java:477)
at io.questdb.cutlass.http.processors.JsonQueryProcessor.execute0(JsonQueryProcessor.java:191)
at io.questdb.cutlass.http.processors.JsonQueryProcessor.onRequestComplete(JsonQueryProcessor.java:266)
at io.questdb.cutlass.http.HttpConnectionContext.handleClientRecv(HttpConnectionContext.java:915)
at io.questdb.cutlass.http.HttpConnectionContext.handleClientOperation(HttpConnectionContext.java:256)
at io.questdb.cutlass.http.HttpServer.handleClientOperation(HttpServer.java:307)
at io.questdb.cutlass.http.HttpServer$1.lambda$$0(HttpServer.java:114)
at io.questdb.network.AbstractIODispatcher.processIOQueue(AbstractIODispatcher.java:199)
at io.questdb.cutlass.http.HttpServer$1.run(HttpServer.java:118)
at io.questdb.mp.Worker.run(Worker.java:151)
]```
### QuestDB version:
8.0.1
### Full Name:
Marko Topolnik
### Affiliation:
QuestDB
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the SQL example against QuestDB 8.0.1, then inspect the query compiler path alongside the AsyncFilteredRecordCursor failure shown in the stack trace. The issue is done when this invalid query is rejected during compilation with a clear error instead of failing unexpectedly during execution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100