@Override public boolean matches(RelOptRuleCall call) { final LimitPrel limit = call.rel(0); // We do not fire this rule if fetch() is null (indicating we have to fetch all the // remaining rows starting from offset. return !limit.isPushDown() && limit.getFetch() != null; } };
@Override public boolean matches(RelOptRuleCall call) { LimitPrel limitPrel = call.rel(0); ProjectPrel projectPrel = call.rel(1); // pushdown only apply limit but not offset, // so if getFetch() return null no need to run this rule. // Do not push across Project containing CONVERT_FROMJSON for limit 0 queries. For limit 0 queries, this would // mess up the schema since Convert_FromJson() is different from other regular functions in that it only knows // the output schema after evaluation is performed. When input has 0 row, Drill essentially does not have a way // to know the output type. if (!limitPrel.isPushDown() && (limitPrel.getFetch() != null) && (!DrillRelOptUtil.isLimit0(limitPrel.getFetch()) || !DrillRelOptUtil.isProjectOutputSchemaUnknown(projectPrel))) { return true; } return false; } };
@Override public boolean matches(RelOptRuleCall call) { final ScanPrel scan = call.rel(1); final LimitPrel limit = call.rel(0); // pushdown only apply limit but not offset, // so if getFetch() return null no need to run this rule. if (scan.getGroupScan().supportsLimitPushdown() && !limit.isPushDown() && limit.getFetch() != null) { if ((scan.getGroupScan() instanceof JsonTableGroupScan && ((JsonTableGroupScan) scan.getGroupScan()).isIndexScan()) || (scan.getGroupScan() instanceof RestrictedJsonTableGroupScan)) { return true; } } return false; } };
@Override public boolean matches(RelOptRuleCall call) { final LimitPrel limit = call.rel(0); // We do not fire this rule if fetch() is null (indicating we have to fetch all the // remaining rows starting from offset. return !limit.isPushDown() && limit.getFetch() != null; } };
@Override public Prel prepareForLateralUnnestPipeline(List<RelNode> children) { return new LimitPrel(this.getCluster(), this.traitSet, children.get(0), getOffset(), getFetch(), isPushDown(), true); } }
@Override public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) { return new LimitPrel(getCluster(), traitSet, sole(inputs), offset, fetch, isPushDown(), isPartitioned); }
@Override public boolean matches(RelOptRuleCall call) { final LimitPrel limit = (LimitPrel) call.rel(0); final ExchangePrel exchange = (ExchangePrel) call.rel(1); //this rule now works for two exchanges only: UnionExchangePrel and SingleMergeExchangePrel if (!(exchange instanceof UnionExchangePrel) && !(exchange instanceof SingleMergeExchangePrel)) { return false; } // Two situations we do not fire this rule: // 1) limit has been pushed down to its child, // 2) the fetch() is null (indicating we have to fetch all the remaining rows starting from offset. if (!limit.isPushDown() && limit.getFetch() != null) { if (!(exchange instanceof SingleMergeExchangePrel) || !findRowKeyJoin(exchange)) { return true; } } return false; }
@Override public boolean matches(RelOptRuleCall call) { LimitPrel limitPrel = call.rel(0); ProjectPrel projectPrel = call.rel(1); // pushdown only apply limit but not offset, // so if getFetch() return null no need to run this rule. // Do not push across Project containing CONVERT_FROMJSON for limit 0 queries. For limit 0 queries, this would // mess up the schema since Convert_FromJson() is different from other regular functions in that it only knows // the output schema after evaluation is performed. When input has 0 row, Drill essentially does not have a way // to know the output type. if (!limitPrel.isPushDown() && (limitPrel.getFetch() != null) && (!DrillRelOptUtil.isLimit0(limitPrel.getFetch()) || !DrillRelOptUtil.isProjectOutputSchemaUnknown(projectPrel))) { return true; } return false; } };
@Override public boolean matches(RelOptRuleCall call) { final ScanPrel scan = call.rel(1); final LimitPrel limit = call.rel(0); // pushdown only apply limit but not offset, // so if getFetch() return null no need to run this rule. if (scan.getGroupScan().supportsLimitPushdown() && !limit.isPushDown() && limit.getFetch() != null) { if ((scan.getGroupScan() instanceof JsonTableGroupScan && ((JsonTableGroupScan) scan.getGroupScan()).isIndexScan()) || (scan.getGroupScan() instanceof RestrictedJsonTableGroupScan)) { return true; } } return false; } };