Search in sources :

Example 1 with DruidTableScanRule

use of io.druid.sql.calcite.rule.DruidTableScanRule in project druid by druid-io.

the class Rules method baseRuleSet.

private static List<RelOptRule> baseRuleSet(final QueryMaker queryMaker, final DruidOperatorTable operatorTable) {
    final PlannerConfig plannerConfig = queryMaker.getPlannerContext().getPlannerConfig();
    final ImmutableList.Builder<RelOptRule> rules = ImmutableList.builder();
    // Calcite rules.
    rules.addAll(DEFAULT_RULES);
    rules.addAll(MISCELLANEOUS_RULES);
    rules.addAll(CONSTANT_REDUCTION_RULES);
    rules.addAll(VOLCANO_ABSTRACT_RULES);
    rules.addAll(RELOPTUTIL_ABSTRACT_RULES);
    if (!plannerConfig.isUseApproximateCountDistinct()) {
        // We'll need this to expand COUNT DISTINCTs.
        // Avoid AggregateExpandDistinctAggregatesRule.INSTANCE; it uses grouping sets and we don't support those.
        rules.add(AggregateExpandDistinctAggregatesRule.JOIN);
    }
    if (plannerConfig.isUseFallback()) {
        rules.add(DruidRelToBindableRule.instance());
    }
    // Druid-specific rules.
    rules.add(new DruidTableScanRule(queryMaker));
    rules.add(new DruidFilterRule(operatorTable));
    if (plannerConfig.getMaxSemiJoinRowsInMemory() > 0) {
        rules.add(DruidSemiJoinRule.instance());
    }
    rules.addAll(SelectRules.rules(operatorTable));
    rules.addAll(GroupByRules.rules(operatorTable));
    return rules.build();
}
Also used : ImmutableList(com.google.common.collect.ImmutableList) DruidTableScanRule(io.druid.sql.calcite.rule.DruidTableScanRule) DruidFilterRule(io.druid.sql.calcite.rule.DruidFilterRule) RelOptRule(org.apache.calcite.plan.RelOptRule)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 DruidFilterRule (io.druid.sql.calcite.rule.DruidFilterRule)1 DruidTableScanRule (io.druid.sql.calcite.rule.DruidTableScanRule)1 RelOptRule (org.apache.calcite.plan.RelOptRule)1