danny0405 commented on a change in pull request #1460: [CALCITE-3352]
ProjectToWindowRule sets wrong collation on generated Window
URL: https://github.com/apache/calcite/pull/1460#discussion_r326442320
##########
File path: core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java
##########
@@ -6122,6 +6122,54 @@ private Sql checkSubQuery(String sql) {
checkPlanning(FilterJoinRule.FILTER_ON_JOIN, query);
}
+ @Test public void testWindowOnSortedInput() {
+ // Create a customized test with RelCollation trait in the test cluster.
+ Tester tester = new TesterImpl(getDiffRepos(), true, true, false, false,
+ true, null, null) {
+ @Override public RelOptPlanner createPlanner() {
+ return new MockRelOptPlanner(Contexts.empty()) {
+ @Override public List<RelTraitDef> getRelTraitDefs() {
+ return ImmutableList.of(RelCollationTraitDef.INSTANCE);
+ }
+ @Override public RelTraitSet emptyTraitSet() {
+ return RelTraitSet.createEmpty().plus(
+ RelCollationTraitDef.INSTANCE.getDefault());
+ }
+ };
+ }
+ };
+
+ final HepProgram preProgram = new HepProgramBuilder()
+ .addRuleInstance(SortProjectTransposeRule.INSTANCE)
+ .build();
+ final HepProgram program = HepProgram.builder()
+ .addRuleInstance(ProjectToWindowRule.PROJECT)
+ .build();
Review comment:
From the tests you gave, i couldn't figure out what you are fixing, because
both the input and output nodes collation are the same.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services