@Override public boolean matches(RelOptRuleCall call) { final ScanPrel scan = (ScanPrel) call.rel(1); if (scan.getGroupScan() instanceof BinaryTableGroupScan || scan.getGroupScan() instanceof JsonTableGroupScan) { return super.matches(call); } return false; } };
@Override public boolean matches(RelOptRuleCall call) { final ScanPrel scan = (ScanPrel) call.rel(2); if (scan.getGroupScan() instanceof BinaryTableGroupScan || scan.getGroupScan() instanceof JsonTableGroupScan) { return super.matches(call); } return false; } };
@Override public void onMatch(RelOptRuleCall call) { final FilterPrel filter = call.rel(0); final ScanPrel scan = call.rel(1); final RexNode condition = filter.getCondition(); if (scan.getGroupScan() instanceof BinaryTableGroupScan) { BinaryTableGroupScan groupScan = (BinaryTableGroupScan)scan.getGroupScan(); doPushFilterIntoBinaryGroupScan(call, filter, null, scan, groupScan, condition); } else { assert(scan.getGroupScan() instanceof JsonTableGroupScan); JsonTableGroupScan groupScan = (JsonTableGroupScan)scan.getGroupScan(); doPushFilterIntoJsonGroupScan(call, filter, null, scan, groupScan, condition); } }
@Override public void onMatch(RelOptRuleCall call) { final ProjectPrel project = call.rel(0); final ScanPrel scan = call.rel(1); if (scan.getGroupScan() instanceof JsonTableGroupScan) { JsonTableGroupScan groupScan = (JsonTableGroupScan) scan.getGroupScan(); doPushProjectIntoGroupScan(call, project, scan, groupScan); } }
@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 ScanPrel scan = call.rel(1); // See class level comments above for why only JsonGroupScan is considered if (scan.getGroupScan() instanceof JsonTableGroupScan) { return super.matches(call); } return false; } };
@Override public boolean matches(RelOptRuleCall call) { final ScanPrel scan = (ScanPrel) call.rel(2); if (scan.getGroupScan() instanceof HBaseGroupScan) { return super.matches(call); } return false; } };
@Override public boolean matches(RelOptRuleCall call) { final ScanPrel scan = (ScanPrel) call.rel(1); if (scan.getGroupScan() instanceof KafkaGroupScan) { return super.matches(call); } return false; } }
@Override public boolean matches(RelOptRuleCall call) { final ScanPrel scan = (ScanPrel) call.rel(1); if (scan.getGroupScan() instanceof HBaseGroupScan) { return super.matches(call); } return false; } };
@Override public void onMatch(RelOptRuleCall call) { final FilterPrel filter = call.rel(0); final ProjectPrel project = call.rel(1); final ScanPrel scan = call.rel(2); // convert the filter to one that references the child of the project final RexNode condition = RelOptUtil.pushPastProject(filter.getCondition(), project); if (scan.getGroupScan() instanceof BinaryTableGroupScan) { BinaryTableGroupScan groupScan = (BinaryTableGroupScan)scan.getGroupScan(); doPushFilterIntoBinaryGroupScan(call, filter, project, scan, groupScan, condition); } else { assert(scan.getGroupScan() instanceof JsonTableGroupScan); JsonTableGroupScan groupScan = (JsonTableGroupScan)scan.getGroupScan(); doPushFilterIntoJsonGroupScan(call, filter, project, scan, groupScan, condition); } }
@Override public void onMatch(RelOptRuleCall call) { final LimitPrel limit = call.rel(0); final ScanPrel scan = call.rel(1); doPushLimitIntoGroupScan(call, limit, null, scan, scan.getGroupScan()); }
Map<String, StatisticsPayload> payloadMap; if ((scanRel instanceof DrillScanRel && ((DrillScanRel)scanRel).getGroupScan() instanceof DbGroupScan) || (scanRel instanceof ScanPrel && ((ScanPrel)scanRel).getGroupScan() instanceof DbGroupScan)) { if (condition == null && fullTableScanPayload != null) { return fullTableScanPayload.getRowCount();
Map<String, StatisticsPayload> payloadMap; if ((scanRel instanceof DrillScanRel && ((DrillScanRel)scanRel).getGroupScan() instanceof DbGroupScan) || (scanRel instanceof ScanPrel && ((ScanPrel)scanRel).getGroupScan() instanceof DbGroupScan)) { if (condition == null && fullTableScanPayload != null) { return fullTableScanPayload.getLeadingRowCount();
@Override public void onMatch(RelOptRuleCall call) { final ScanPrel scan = (ScanPrel) call.rel(1); final FilterPrel filter = (FilterPrel) call.rel(0); final RexNode condition = filter.getCondition(); HBaseGroupScan groupScan = (HBaseGroupScan)scan.getGroupScan(); if (groupScan.isFilterPushedDown()) { /* * The rule can get triggered again due to the transformed "scan => filter" sequence * created by the earlier execution of this rule when we could not do a complete * conversion of Optiq Filter's condition to HBase Filter. In such cases, we rely upon * this flag to not do a re-processing of the rule on the already transformed call. */ return; } doPushFilterToScan(call, filter, null, scan, groupScan, condition); }
@Override public void onMatch(RelOptRuleCall call) { final ScanPrel scan = (ScanPrel) call.rel(2); final ProjectPrel project = (ProjectPrel) call.rel(1); final FilterPrel filter = (FilterPrel) call.rel(0); HBaseGroupScan groupScan = (HBaseGroupScan)scan.getGroupScan(); if (groupScan.isFilterPushedDown()) { /* * The rule can get triggered again due to the transformed "scan => filter" sequence * created by the earlier execution of this rule when we could not do a complete * conversion of Optiq Filter's condition to HBase Filter. In such cases, we rely upon * this flag to not do a re-processing of the rule on the already transformed call. */ return; } // convert the filter to one that references the child of the project final RexNode condition = RelOptUtil.pushPastProject(filter.getCondition(), project); doPushFilterToScan(call, filter, project, scan, groupScan, condition); }
protected void doPushLimitIntoGroupScan(RelOptRuleCall call, LimitPrel limit, final ProjectPrel project, ScanPrel scan, GroupScan groupScan) { try { final GroupScan newGroupScan = getGroupScanWithLimit(groupScan, limit); if (newGroupScan == null) { return; } final ScanPrel newScan = new ScanPrel(scan.getCluster(), scan.getTraitSet(), newGroupScan, scan.getRowType(), scan.getTable()); final RelNode newChild; if (project != null) { final ProjectPrel newProject = new ProjectPrel(project.getCluster(), project.getTraitSet(), newScan, project.getProjects(), project.getRowType()); newChild = newProject; } else { newChild = newScan; } call.transformTo(newChild); logger.debug("pushLimitIntoGroupScan: Converted to a new ScanPrel " + newScan.getGroupScan()); } catch (Exception e) { logger.warn("pushLimitIntoGroupScan: Exception while trying limit pushdown!", e); } }
@Override public void onMatch(RelOptRuleCall call) { final ScanPrel scan = call.rel(1); final FilterPrel filter = call.rel(0); final RexNode condition = filter.getCondition(); LogicalExpression conditionExp = DrillOptiq.toDrill(new DrillParseContext(PrelUtil.getPlannerSettings(call.getPlanner())), scan, condition); KafkaGroupScan groupScan = (KafkaGroupScan) scan.getGroupScan(); logger.info("Partitions ScanSpec before pushdown: " + groupScan.getPartitionScanSpecList()); KafkaPartitionScanSpecBuilder builder = new KafkaPartitionScanSpecBuilder(groupScan, conditionExp); List<KafkaPartitionScanSpec> newScanSpec = null; newScanSpec = builder.parseTree(); builder.close(); //Close consumer //No pushdown if(newScanSpec == null) { return; } logger.info("Partitions ScanSpec after pushdown: " + newScanSpec); GroupScan newGroupScan = groupScan.cloneWithNewSpec(newScanSpec); final ScanPrel newScanPrel = new ScanPrel(scan.getCluster(), filter.getTraitSet(), newGroupScan, scan.getRowType(), scan.getTable()); call.transformTo(filter.copy(filter.getTraitSet(), ImmutableList.of(newScanPrel))); }
@Override public void onMatch(RelOptRuleCall call) { final LimitPrel limit = call.rel(0); final ScanPrel scan = call.rel(1); doPushLimitIntoGroupScan(call, limit, null, scan, scan.getGroupScan()); }
public boolean match(RelOptRuleCall call) { final OrderedRel sort = call.rel(0); final ScanPrel scan = call.rel(3); return sort instanceof Prel && checkScan(scan.getGroupScan()) && isRemovableRel(sort); }
@Override protected Object clone() throws CloneNotSupportedException { return new ScanPrel(this.getCluster(), this.getTraitSet(), getCopy(this.getGroupScan()), this.rowType, this.getTable()); }