@Override public boolean matches(RelOptRuleCall call) { final Aggregate aggregate = call.rel(0); // Rule cannot be applied if there are GroupingSets if (aggregate.indicator) { return false; } return super.matches(call); }
@Override public boolean matches(RelOptRuleCall call) { final Filter filterRel = call.rel(0); RexNode condition = filterRel.getCondition(); if (!HiveCalciteUtil.isDeterministic(condition)) { return false; } return super.matches(call); } }
@Override public boolean matches(RelOptRuleCall call) { Filter filterRel = call.rel(0); RexNode condition = filterRel.getCondition(); if (!HiveCalciteUtil.isDeterministic(condition)) { return false; } return super.matches(call); }
new PushProjector( origProj, join.getCondition(), preserveExprCondition, call.builder()); if (pushProject.locateAllRefs()) { return; pushProject.createProjectRefsAndExprs( join.getLeft(), true, false); RelNode rightProjRel = pushProject.createProjectRefsAndExprs( join.getRight(), true, int[] adjustments = pushProject.getAdjustments(); if (join.getCondition() != null) { List<RelDataTypeField> projJoinFieldList = new ArrayList<>(); rightProjRel.getRowType().getFieldList()); newJoinFilter = pushProject.convertRefsAndExprs( join.getCondition(), projJoinFieldList, pushProject.createNewProject(newJoinRel, adjustments);
hepPgmBldr.addRuleInstance(new JoinToMultiJoinRule(HiveJoin.class)); hepPgmBldr.addRuleInstance(new LoptOptimizeJoinRule(HiveRelFactories.HIVE_BUILDER)); calciteOptimizedPlan = hepPlan(calciteOptimizedPlan, false, mdProvider.getMetadataProvider(), null, HepMatchOrder.BOTTOM_UP, ProjectRemoveRule.INSTANCE, new ProjectMergeRule(false, HiveRelFactories.HIVE_BUILDER)); calciteOptimizedPlan = hepPlan(calciteOptimizedPlan, true, mdProvider.getMetadataProvider(), null, HiveFilterProjectTSTransposeRule.INSTANCE, HiveFilterProjectTSTransposeRule.INSTANCE_DRUID,
final RelNode swapped = JoinCommuteRule.swap(join,true); if (swapped == null) { return;
project.getRowType()); if (ProjectRemoveRule.isTrivial(newProj) &&
@Override public boolean matches(RelOptRuleCall call) { final Filter filterRel = call.rel(0); RexNode condition = filterRel.getCondition(); if (this.onlyDeterministic && !HiveCalciteUtil.isDeterministic(condition)) { return false; } return super.matches(call); }
@Override public boolean matches(RelOptRuleCall call) { // Currently we do not support merging windowing functions with other // windowing functions i.e. embedding windowing functions within each // other final Project topProject = call.rel(0); final Project bottomProject = call.rel(1); for (RexNode expr : topProject.getChildExps()) { if (expr instanceof RexOver) { Set<Integer> positions = HiveCalciteUtil.getInputRefs(expr); for (int pos : positions) { if (bottomProject.getChildExps().get(pos) instanceof RexOver) { return false; } } } } return super.matches(call); }
@Override public boolean matches(RelOptRuleCall call) { final Aggregate aggregate = call.rel(0); // Rule cannot be applied if there are GroupingId because it will change the // value as the position will be changed. for (AggregateCall aggCall : aggregate.getAggCallList()) { if (aggCall.getAggregation().equals(HiveGroupingID.INSTANCE)) { return false; } } return super.matches(call); }
public void onMatch(RelOptRuleCall call) { final Project topProject = call.rel(0); final Project bottomProject = call.rel(1); // If top project does not reference any column at the bottom project, // we can just remove botton project final ImmutableBitSet topRefs = RelOptUtil.InputFinder.bits(topProject.getChildExps(), null); if (topRefs.isEmpty()) { RelBuilder relBuilder = call.builder(); relBuilder.push(bottomProject.getInput()); relBuilder.project(topProject.getChildExps()); call.transformTo(relBuilder.build()); return; } super.onMatch(call); }
hepPgmBldr.addRuleInstance(new JoinToMultiJoinRule(HiveJoin.class)); hepPgmBldr.addRuleInstance(new LoptOptimizeJoinRule(HiveRelFactories.HIVE_BUILDER)); calciteOptimizedPlan = hepPlan(calciteOptimizedPlan, false, mdProvider.getMetadataProvider(), null, HepMatchOrder.BOTTOM_UP, ProjectRemoveRule.INSTANCE, new ProjectMergeRule(false, HiveRelFactories.HIVE_BUILDER)); calciteOptimizedPlan = hepPlan(calciteOptimizedPlan, true, mdProvider.getMetadataProvider(), null, HiveFilterProjectTSTransposeRule.INSTANCE, HiveFilterProjectTSTransposeRule.INSTANCE_DRUID,
final RelNode swapped = JoinCommuteRule.swap(join,true); if (swapped == null) { return;
@Override public boolean matches(RelOptRuleCall call) { Filter filterRel = call.rel(0); RexNode condition = filterRel.getCondition(); if (!HiveCalciteUtil.isDeterministic(condition)) { return false; } return super.matches(call); } }
@Override public boolean matches(RelOptRuleCall call) { final Filter filterRel = call.rel(0); // The condition fetched here can reference a udf that is not deterministic, but defined // as part of the select list when a view is in play. But the condition after the pushdown // will resolve to using the udf from select list. The check here for deterministic filters // should be based on the resolved expression. Refer to test case cbo_ppd_non_deterministic.q. RexNode condition = RelOptUtil.pushPastProject(filterRel.getCondition(), call.rel(1)); if (this.onlyDeterministic && !HiveCalciteUtil.isDeterministic(condition)) { return false; } return super.matches(call); }
@Override public boolean matches(RelOptRuleCall call) { final Aggregate aggregate = call.rel(0); // Rule cannot be applied if there are GroupingSets if (aggregate.getGroupType() != Group.SIMPLE) { return false; } return super.matches(call); }
@Override public boolean matches(RelOptRuleCall call) { final Filter filterRel = call.rel(0); RexNode condition = filterRel.getCondition(); if (!HiveCalciteUtil.isDeterministic(condition)) { return false; } return super.matches(call); } }
@Override public boolean matches(RelOptRuleCall call) { // Currently we do not support merging windowing functions with other // windowing functions i.e. embedding windowing functions within each // other final Project topProject = call.rel(0); final Project bottomProject = call.rel(1); for (RexNode expr : topProject.getChildExps()) { if (expr instanceof RexOver) { Set<Integer> positions = HiveCalciteUtil.getInputRefs(expr); for (int pos : positions) { if (bottomProject.getChildExps().get(pos) instanceof RexOver) { return false; } } } } return super.matches(call); }
RelNode swapped = JoinCommuteRule.swap(join, true); assert swapped != null;
RelNode swapped = JoinCommuteRule.swap(join, true); assert swapped != null;