use of org.apache.beam.sdk.extensions.sql.impl.rule.BeamCalcRule in project beam by apache.
the class ZetaSQLQueryPlanner method modifyRuleSetsForZetaSql.
private static Collection<RuleSet> modifyRuleSetsForZetaSql(Collection<RuleSet> ruleSets, Collection<RelOptRule> calc) {
ImmutableList.Builder<RuleSet> ret = ImmutableList.builder();
for (RuleSet ruleSet : ruleSets) {
ImmutableList.Builder<RelOptRule> bd = ImmutableList.builder();
for (RelOptRule rule : ruleSet) {
// requires the JoinCommuteRule, which doesn't work without struct flattening.
if (rule instanceof JoinCommuteRule) {
continue;
} else if (rule instanceof FilterCalcMergeRule || rule instanceof ProjectCalcMergeRule) {
// planning result eventually.
continue;
} else if (rule instanceof BeamCalcRule) {
bd.addAll(calc);
} else if (rule instanceof BeamUnnestRule) {
bd.add(BeamZetaSqlUnnestRule.INSTANCE);
} else if (rule instanceof BeamUncollectRule) {
bd.add(BeamZetaSqlUncollectRule.INSTANCE);
} else {
bd.add(rule);
}
}
ret.add(RuleSets.ofList(bd.build()));
}
return ret.build();
}
Aggregations