use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.core.Project in project hive by apache.
the class HiveProjectFilterPullUpConstantsRule method onMatch.
public void onMatch(RelOptRuleCall call) {
final Project project = call.rel(0);
final Filter filter = call.rel(1);
final RelBuilder builder = call.builder();
List<RexNode> projects = project.getProjects();
List<RexNode> newProjects = rewriteProjects(projects, filter.getCondition(), builder);
if (newProjects == null) {
return;
}
RelNode newProjRel = builder.push(filter).project(newProjects, project.getRowType().getFieldNames()).build();
call.transformTo(newProjRel);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.core.Project in project hive by apache.
the class HiveProjectMergeRule method onMatch.
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.getProjects(), null);
if (topRefs.isEmpty()) {
RelBuilder relBuilder = call.builder();
relBuilder.push(bottomProject.getInput());
relBuilder.project(topProject.getProjects());
call.transformTo(relBuilder.build());
return;
}
super.onMatch(call);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.core.Project in project hive by apache.
the class HiveFilterProjectTransposeRule method onMatch.
public void onMatch(RelOptRuleCall call) {
final Filter filter = call.rel(0);
final Project origproject = call.rel(1);
RexNode filterCondToPushBelowProj = filter.getCondition();
RexNode unPushedFilCondAboveProj = null;
if (RexUtil.containsCorrelation(filterCondToPushBelowProj)) {
// Correlate from being de-correlated.
return;
}
if (RexOver.containsOver(origproject.getProjects(), null)) {
RexNode origFilterCond = filterCondToPushBelowProj;
filterCondToPushBelowProj = null;
if (pushThroughWindowing) {
Set<Integer> commonPartitionKeys = getCommonPartitionCols(origproject.getProjects());
List<RexNode> newPartKeyFilConds = new ArrayList<>();
List<RexNode> unpushedFilConds = new ArrayList<>();
// from t1 where value < 10)t1)t2
if (!commonPartitionKeys.isEmpty()) {
for (RexNode ce : RelOptUtil.conjunctions(origFilterCond)) {
RexNode newCondition = RelOptUtil.pushPastProject(ce, origproject);
if (HiveCalciteUtil.isDeterministicFuncWithSingleInputRef(newCondition, commonPartitionKeys)) {
newPartKeyFilConds.add(ce);
} else {
unpushedFilConds.add(ce);
}
}
if (!newPartKeyFilConds.isEmpty()) {
filterCondToPushBelowProj = RexUtil.composeConjunction(filter.getCluster().getRexBuilder(), newPartKeyFilConds, true);
}
if (!unpushedFilConds.isEmpty()) {
unPushedFilCondAboveProj = RexUtil.composeConjunction(filter.getCluster().getRexBuilder(), unpushedFilConds, true);
}
}
}
}
if (filterCondToPushBelowProj != null && !isRedundantIsNotNull(origproject, filterCondToPushBelowProj)) {
RelNode newProjRel = getNewProject(filterCondToPushBelowProj, unPushedFilCondAboveProj, origproject, filter.getCluster().getTypeFactory(), call.builder());
call.transformTo(newProjRel);
}
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.core.Project in project hive by apache.
the class HiveAntiSemiJoinRule method onMatch.
// is null filter over a left join.
public void onMatch(final RelOptRuleCall call) {
final Project project = call.rel(0);
final Filter filter = call.rel(1);
final Join join = call.rel(2);
perform(call, project, filter, join);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.core.Project in project hive by apache.
the class HiveMaterializedViewFilterScanRule method onMatch.
//~ Methods ----------------------------------------------------------------
public void onMatch(RelOptRuleCall call) {
final Project project = call.rel(0);
final Filter filter = call.rel(1);
final TableScan scan = call.rel(2);
apply(call, project, filter, scan);
}
Aggregations