-
Notifications
You must be signed in to change notification settings - Fork 3.8k
WINDOWING - Fix 2 nodes with same digest causing mapping issue #16301
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
1904ae4
94243f6
87f8985
c80eb59
5241793
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 |
|---|---|---|
|
|
@@ -240,11 +240,16 @@ public static Windowing fromCalciteStuff( | |
|
|
||
| // Apply windowProject, if present. | ||
| if (partialQuery.getWindowProject() != null) { | ||
| // We know windowProject is a mapping due to the isMapping() check in DruidRules. Check for null anyway, | ||
| // as defensive programming. | ||
| // We know windowProject is a mapping due to the isMapping() check in DruidRules. | ||
| // check anyway as defensive programming. | ||
| Preconditions.checkArgument(partialQuery.getWindowProject().isMapping()); | ||
|
Member
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. possibly extracting |
||
| final Mappings.TargetMapping mapping = Preconditions.checkNotNull( | ||
| partialQuery.getWindowProject().getMapping(), | ||
| "mapping for windowProject[%s]", partialQuery.getWindowProject() | ||
| Project.getPartialMapping( | ||
| partialQuery.getWindowProject().getInput().getRowType().getFieldCount(), | ||
| partialQuery.getWindowProject().getProjects() | ||
| ), | ||
| "mapping for windowProject[%s]", | ||
| partialQuery.getWindowProject() | ||
| ); | ||
|
|
||
| final List<String> windowProjectOutputColumns = new ArrayList<>(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ | |
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import com.fasterxml.jackson.databind.ObjectMapper; | ||
| import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; | ||
| import com.google.common.collect.ImmutableList; | ||
| import com.google.common.collect.ImmutableMap; | ||
| import org.apache.druid.jackson.DefaultObjectMapper; | ||
| import org.apache.druid.java.util.common.ISE; | ||
|
|
@@ -37,6 +38,7 @@ | |
| import org.apache.druid.sql.calcite.QueryVerification.QueryResultsVerifier; | ||
| import org.apache.druid.sql.calcite.planner.PlannerContext; | ||
| import org.junit.Assert; | ||
| import org.junit.jupiter.api.Test; | ||
| import org.junit.jupiter.params.ParameterizedTest; | ||
| import org.junit.jupiter.params.provider.MethodSource; | ||
|
|
||
|
|
@@ -231,6 +233,25 @@ public void windowQueryTestWithCustomContextMaxSubqueryBytes(String filename) th | |
| } | ||
| } | ||
|
|
||
| @Test | ||
| public void testWindow() | ||
| { | ||
| testBuilder() | ||
| .sql("SELECT\n" + | ||
|
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. A test case in MSQ window functions would also be helpful.
Member
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. great idea :) |
||
| "(rank() over (order by count(*) desc)),\n" + | ||
| "(rank() over (order by count(*) desc))\n" + | ||
| "FROM \"wikipedia\"") | ||
| .queryContext(ImmutableMap.of( | ||
| PlannerContext.CTX_ENABLE_WINDOW_FNS, true, | ||
| QueryContexts.ENABLE_DEBUG, true, | ||
| QueryContexts.WINDOWING_STRICT_VALIDATION, false | ||
| )) | ||
| .expectedResults(ImmutableList.of( | ||
| new Object[]{1L, 1L} | ||
| )) | ||
| .run(); | ||
| } | ||
|
|
||
| private WindowOperatorQuery getWindowOperatorQuery(List<Query<?>> queries) | ||
| { | ||
| assertEquals(1, queries.size()); | ||
|
|
||
Check notice
Code scanning / CodeQL
Useless parameter