-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Fix assertion error in sql planning for latest aggregators #13151
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -998,6 +998,56 @@ public void testStringLatestGroupBy() | |
| ); | ||
| } | ||
|
|
||
| @Test | ||
| public void testStringLatestGroupByWithAlwaysFalseCondition() | ||
| { | ||
| testQuery( | ||
| "SELECT LATEST(dim4, 10),dim2 FROM numfoo WHERE (dim1 = 'something' AND dim1 IN( 'something else') ) GROUP BY dim2", | ||
| ImmutableList.of( | ||
| Druids.newScanQueryBuilder() | ||
| .dataSource(InlineDataSource.fromIterable( | ||
| ImmutableList.of(), | ||
| RowSignature.builder() | ||
| .add("EXPR$0", ColumnType.STRING) | ||
| .add("dim2", ColumnType.STRING) | ||
| .build() | ||
| )) | ||
| .intervals(querySegmentSpec(Filtration.eternity())) | ||
| .columns("EXPR$0", "dim2") | ||
| .context(QUERY_CONTEXT_DEFAULT) | ||
| .resultFormat(ResultFormat.RESULT_FORMAT_COMPACTED_LIST) | ||
| .legacy(false) | ||
| .build() | ||
| ), | ||
| ImmutableList.of() | ||
| ); | ||
| } | ||
|
|
||
| @Test | ||
| public void testStringLatestByGroupByWithAlwaysFalseCondition() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Maybe also add a test case to verify error message?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was not able to figure out a query that gets me that error message. This query is not an invalid query. It just goes through a bad stage and doesn't recover before this fix. Now it can.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that SQL will generate a different error and fails even before reaching the SqlAggregagtor. |
||
| { | ||
| testQuery( | ||
| "SELECT LATEST_BY(dim4, __time, 10),dim2 FROM numfoo WHERE (dim1 = 'something' AND dim1 IN( 'something else') ) GROUP BY dim2", | ||
| ImmutableList.of( | ||
| Druids.newScanQueryBuilder() | ||
| .dataSource(InlineDataSource.fromIterable( | ||
| ImmutableList.of(), | ||
| RowSignature.builder() | ||
| .add("EXPR$0", ColumnType.STRING) | ||
| .add("dim2", ColumnType.STRING) | ||
| .build() | ||
| )) | ||
| .intervals(querySegmentSpec(Filtration.eternity())) | ||
| .columns("EXPR$0", "dim2") | ||
| .context(QUERY_CONTEXT_DEFAULT) | ||
| .resultFormat(ResultFormat.RESULT_FORMAT_COMPACTED_LIST) | ||
| .legacy(false) | ||
| .build() | ||
| ), | ||
| ImmutableList.of() | ||
| ); | ||
| } | ||
|
|
||
| // This test the off-heap (buffer) version of the EarliestAggregator (Double/Float/Long) | ||
| @Test | ||
| public void testPrimitiveEarliestInSubquery() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the docs, it seems that
maxBytesPerStringis always the second argument, i.e.rexNodes.get(1)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For
EARLIEST_BY/LATEST_BY, it's the third argument. For non_BYaggregators, it's second argument.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed the error message though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification, I was looking at an older doc in the original PR.