use of org.apache.flink.table.planner.plan.nodes.physical.batch.BatchPhysicalGroupAggregateBase in project flink by apache.
the class PushLocalSortAggWithSortAndCalcIntoScanRule method onMatch.
@Override
public void onMatch(RelOptRuleCall call) {
BatchPhysicalGroupAggregateBase localSortAgg = call.rel(1);
BatchPhysicalCalc calc = call.rel(3);
BatchPhysicalTableSourceScan oldScan = call.rel(4);
int[] calcRefFields = getRefFiledIndex(calc);
pushLocalAggregateIntoScan(call, localSortAgg, oldScan, calcRefFields);
}
use of org.apache.flink.table.planner.plan.nodes.physical.batch.BatchPhysicalGroupAggregateBase in project flink by apache.
the class PushLocalSortAggWithSortAndCalcIntoScanRule method matches.
@Override
public boolean matches(RelOptRuleCall call) {
BatchPhysicalGroupAggregateBase localAggregate = call.rel(1);
BatchPhysicalCalc calc = call.rel(3);
BatchPhysicalTableSourceScan tableSourceScan = call.rel(4);
return isInputRefOnly(calc) && isProjectionNotPushedDown(tableSourceScan) && canPushDown(call, localAggregate, tableSourceScan);
}
use of org.apache.flink.table.planner.plan.nodes.physical.batch.BatchPhysicalGroupAggregateBase in project flink by apache.
the class PushLocalAggIntoScanRuleBase method canPushDown.
protected boolean canPushDown(RelOptRuleCall call, BatchPhysicalGroupAggregateBase aggregate, BatchPhysicalTableSourceScan tableSourceScan) {
TableConfig tableConfig = ShortcutUtils.unwrapContext(call.getPlanner()).getTableConfig();
if (!tableConfig.getConfiguration().getBoolean(OptimizerConfigOptions.TABLE_OPTIMIZER_SOURCE_AGGREGATE_PUSHDOWN_ENABLED)) {
return false;
}
if (aggregate.isFinal() || aggregate.getAggCallList().isEmpty()) {
return false;
}
List<AggregateCall> aggCallList = JavaScalaConversionUtil.toJava(aggregate.getAggCallList());
for (AggregateCall aggCall : aggCallList) {
if (aggCall.isDistinct() || aggCall.isApproximate() || aggCall.getArgList().size() > 1 || aggCall.hasFilter() || !aggCall.getCollation().getFieldCollations().isEmpty()) {
return false;
}
}
TableSourceTable tableSourceTable = tableSourceScan.tableSourceTable();
// we can not push aggregates twice
return tableSourceTable != null && tableSourceTable.tableSource() instanceof SupportsAggregatePushDown && Arrays.stream(tableSourceTable.abilitySpecs()).noneMatch(spec -> spec instanceof AggregatePushDownSpec);
}
use of org.apache.flink.table.planner.plan.nodes.physical.batch.BatchPhysicalGroupAggregateBase in project flink by apache.
the class PushLocalSortAggWithSortIntoScanRule method onMatch.
@Override
public void onMatch(RelOptRuleCall call) {
BatchPhysicalGroupAggregateBase localSortAgg = call.rel(1);
BatchPhysicalTableSourceScan oldScan = call.rel(3);
pushLocalAggregateIntoScan(call, localSortAgg, oldScan);
}
use of org.apache.flink.table.planner.plan.nodes.physical.batch.BatchPhysicalGroupAggregateBase in project flink by apache.
the class PushLocalSortAggWithSortIntoScanRule method matches.
@Override
public boolean matches(RelOptRuleCall call) {
BatchPhysicalGroupAggregateBase localAggregate = call.rel(1);
BatchPhysicalTableSourceScan tableSourceScan = call.rel(3);
return canPushDown(call, localAggregate, tableSourceScan);
}
Aggregations