Skip to content

Planning correctly for order by queries on time which previously thre…#13965

Merged
cheddar merged 4 commits intoapache:masterfrom
somu-imply:order_by_planning
Apr 4, 2023
Merged

Planning correctly for order by queries on time which previously thre…#13965
cheddar merged 4 commits intoapache:masterfrom
somu-imply:order_by_planning

Conversation

@somu-imply
Copy link
Copy Markdown
Contributor

@somu-imply somu-imply commented Mar 22, 2023

Queries such as the one below fail with Cannot convert query parts into an actual query in and post 2022.05 Druid versions.

SELECT __time,channel FROM wikipedia
WHERE
(
cityName is not null
and channel in
(
SELECT channel FROM wikipedia
))
ORDER BY __time DESC

This bug comes from regression on #12418 should also fix the issue reported in #13163 and also modifies #13173

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

);
return null;
}
if (!dataSource.isConcrete()) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a change in #12418 that was reverted. Since we are using a table data source and not a query data source now the isConcrete() check is not needed and can be removed

Comment on lines +7319 to +7328
) : aggregators(
new LongMaxAggregatorFactory("_a0", "a0"),
new LongMinAggregatorFactory("_a1", "a0"),
new LongSumAggregatorFactory("_a2:sum", "a0"),
new FilteredAggregatorFactory(
new CountAggregatorFactory("_a2:count"),
not(selector("a0", null, null))
),
new LongMaxAggregatorFactory("_a3", "d0"),
new CountAggregatorFactory("_a4")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this change generate this adjustment to the plan?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No clue but in the case of the useDefault=false it uses the same thing but with a check of not null so thought it was kind of correct

@cheddar cheddar merged commit ca94f71 into apache:master Apr 4, 2023
@clintropolis clintropolis added this to the 26.0 milestone Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants