amaliujia commented on a change in pull request #1707: [CALCITE-3649] Hints
should be propagated correctly in planner rules …
URL: https://github.com/apache/calcite/pull/1707#discussion_r362078231
##########
File path:
core/src/test/java/org/apache/calcite/test/SqlHintsConverterTest.java
##########
@@ -387,6 +389,25 @@ protected DiffRepository getDiffRepos() {
Collections.emptyList(), Collections.emptyList());
}
+ @Test public void testHintsPropagateWithDifferentKindOfRels() {
+ final String sql = "select /*+ AGG_STRATEGY(TWO_PHASE) */\n"
+ + "ename, avg(sal)\n"
+ + "from emp group by ename";
+ final RelNode rel = tester.convertSqlToRel(sql).rel;
+ final RelHint hint = RelHint.of(
+ Collections.emptyList(),
+ "AGG_STRATEGY",
+ Collections.singletonList("TWO_PHASE"));
+ // Validate Hep planner.
+ HepProgram program = new HepProgramBuilder()
+ .addRuleInstance(AggregateReduceFunctionsRule.INSTANCE)
Review comment:
Maybe write a mock rule (similar to `MockJoin`) to simulate the `Project +
Aggregate` split that you want to test?
I had a hard time to understand why `AggregateReduceFunctionsRule` will
trigger what expects be tested. Another benefit is this test will be stable
even if when changes are made on `AggregateReduceFunctionsRule`.
----------------------------------------------------------------
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