Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sql): fix error on select distinct with join #2989

Merged
merged 1 commit into from
Feb 14, 2023

Conversation

bziobrowski
Copy link
Contributor

Similar to #2980 but fixes select distinct column with join .

Following queries :

create table tab as (select x as id from long_sequence(3))

select distinct t1.id from  tab t1, tab t2;

select distinct t1.id 
from  tab t1 
join (select x as id from long_sequence(2)) t2 on (t1.id=t2.id);

trigger :
io.questdb.cairo.sql.InvalidColumnException
at io.questdb.cairo.sql.InvalidColumnException.(InvalidColumnException.java:28)
at io.questdb.cairo.sql.RecordMetadata.getColumnIndex(RecordMetadata.java:60)
at io.questdb.griffin.SqlCodeGenerator.generateSelectDistinct(SqlCodeGenerator.java:3053)
at io.questdb.griffin.SqlCodeGenerator.generateSelect(SqlCodeGenerator.java:2684)
at io.questdb.griffin.SqlCodeGenerator.generateQuery0(SqlCodeGenerator.java:2287)
at io.questdb.griffin.SqlCodeGenerator.generateQuery(SqlCodeGenerator.java:2274)
at io.questdb.griffin.SqlCodeGenerator.generate(SqlCodeGenerator.java:186)
at io.questdb.griffin.SqlCompiler.generate(SqlCompiler.java:2622)
at io.questdb.griffin.SqlCompiler.compileUsingModel(SqlCompiler.java:1292)
at io.questdb.griffin.SqlCompiler.compileInner(SqlCompiler.java:1241)
at io.questdb.griffin.SqlCompiler.compile(SqlCompiler.java:266)
at io.questdb.cutlass.http.processors.JsonQueryProcessor.compileQuery(JsonQueryProcessor.java:419)
at io.questdb.cutlass.http.processors.JsonQueryProcessor.execute0(JsonQueryProcessor.java:186)
at io.questdb.cutlass.http.processors.JsonQueryProcessor.onRequestComplete(JsonQueryProcessor.java:236)
at io.questdb.cutlass.http.HttpConnectionContext.handleClientRecv(HttpConnectionContext.java:600)
at io.questdb.cutlass.http.HttpConnectionContext.handleClientOperation(HttpConnectionContext.java:203)
at io.questdb.cutlass.http.HttpServer$1.lambda$$0(HttpServer.java:86)
at io.questdb.network.AbstractIODispatcher.processIOQueue(AbstractIODispatcher.java:178)
at io.questdb.cutlass.http.HttpServer$1.run(HttpServer.java:101)
at io.questdb.mp.Worker.run(Worker.java:118)

@ideoma
Copy link
Collaborator

ideoma commented Feb 14, 2023

[PR Coverage check]

😍 pass : 1 / 1 (100.00%)

file detail

path covered line new line coverage
🔵 io/questdb/griffin/SqlCodeGenerator.java 1 1 100.00%

@bziobrowski bziobrowski changed the title fix(sql): fixe error on select distinct with join fix(sql): fix error on select distinct with join Feb 14, 2023
@bluestreak01 bluestreak01 merged commit 61ceac7 into master Feb 14, 2023
@bluestreak01 bluestreak01 deleted the bz_fix_distinct_col_on_join branch February 14, 2023 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants