Set explain attributes after the query is prepared#14490
Merged
zachjsh merged 6 commits intoapache:masterfrom Jul 6, 2023
Merged
Set explain attributes after the query is prepared#14490zachjsh merged 6 commits intoapache:masterfrom
zachjsh merged 6 commits intoapache:masterfrom
Conversation
2a8d2cb to
795851a
Compare
795851a to
59be19d
Compare
Contributor
|
This change would make the "explain clustered by" feature work in more cases, but it definitely still won't work in all cases, and IMO we don't want to make the entire
|
- Set the explain plan attributes after the query is prepared when the query is planned and we've the finalized output names in the root source rel node. - Adjust tests; add unit test for negative ordinal case. - Remove the exception / error handling logic from resolveClusteredBy function since the validations now happen before it comes to the function
80731ca to
1fadde6
Compare
Contributor
Author
|
@gianm, thanks for the review. Yes, I went ahead with 1 -- moving this logic to after the query is prepared enables us to extract the necessary output columns from |
WITH clause in explain plan clustered by columns
zachjsh
reviewed
Jul 5, 2023
sql/src/main/java/org/apache/druid/sql/calcite/parser/DruidSqlParserUtils.java
Show resolved
Hide resolved
zachjsh
reviewed
Jul 5, 2023
sql/src/main/java/org/apache/druid/sql/calcite/parser/DruidSqlParserUtils.java
Show resolved
Hide resolved
sergioferragut
pushed a commit
to sergioferragut/druid
that referenced
this pull request
Jul 21, 2023
* Add support for DML WITH AS. * One more UT for with as subquery. * Add a test with join query * Use root query prepared node instead of individual SqlNode types. - Set the explain plan attributes after the query is prepared when the query is planned and we've the finalized output names in the root source rel node. - Adjust tests; add unit test for negative ordinal case. - Remove the exception / error handling logic from resolveClusteredBy function since the validations now happen before it comes to the function * Update comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR:
rootQueryRel. This also gives us the benefit of going through all validation checks in the prepare phase.resolveClusteredByColumnsToOutputColumnsfunction for explain attributes as things are already validated and we just have one source list,rootQueryRel, containing the output column names; the existing unit tests work right out of the box. Added new unit tests usingJOINandWITH...ASto prove that the logic no longer depends on individualSqlNodetypes.Key changed/added classes in this PR
DruidSqlParserUtils.javaQueryHandler.javaDruidSqlParserUtilsTest.javaCalciteInsertDmlTest.javaThis PR has: