use of org.apache.flink.table.connector.source.abilities.SupportsLimitPushDown in project flink by apache.
the class PushLimitIntoTableSourceScanRule method matches.
@Override
public boolean matches(RelOptRuleCall call) {
Sort sort = call.rel(0);
TableSourceTable tableSourceTable = call.rel(1).getTable().unwrap(TableSourceTable.class);
// a limit can be pushed down only if it satisfies the two conditions: 1) do not have order
// by keys, 2) have limit.
boolean onlyLimit = sort.getCollation().getFieldCollations().isEmpty() && sort.fetch != null;
return onlyLimit && tableSourceTable != null && tableSourceTable.tableSource() instanceof SupportsLimitPushDown && Arrays.stream(tableSourceTable.abilitySpecs()).noneMatch(spec -> spec instanceof LimitPushDownSpec);
}
Aggregations