Package org.eigenbase.rex

Examples of org.eigenbase.rex.RexNode


    List<Integer> leftKeys = Lists.newArrayList();
    List<Integer> rightKeys = Lists.newArrayList();
    int numLeftFields = convertedLeft.getRowType().getFieldCount();

    boolean addFilter = false;
    RexNode origJoinCondition = join.getCondition();
    RexNode newJoinCondition = origJoinCondition;

    RexNode remaining = RelOptUtil.splitJoinCondition(convertedLeft, convertedRight, origJoinCondition, leftKeys, rightKeys);
    boolean hasEquijoins = (leftKeys.size() == rightKeys.size() && leftKeys.size() > 0) ? true : false;

    // If the join involves equijoins and non-equijoins, then we can process the non-equijoins through
    // a filter right after the join
    // DRILL-1337: We can only pull up a non-equivjoin filter for INNER join.
    // For OUTER join, pulling up a non-eqivjoin filter will lead to incorrectly discarding qualified rows.
    if (! remaining.isAlwaysTrue()) {
      if (hasEquijoins && join.getJoinType()== JoinRelType.INNER) {
        addFilter = true;
        List<RexNode> equijoinList = Lists.newArrayList();
        List<RelDataTypeField> leftTypes = convertedLeft.getRowType().getFieldList();
        List<RelDataTypeField> rightTypes = convertedRight.getRowType().getFieldList();
View Full Code Here


    return limit;
  }

  public static DrillLimitRel convert(Limit limit, ConversionContext context) throws InvalidRelException{
    RelNode input = context.toRel(limit.getInput());
    RexNode first = context.getRexBuilder().makeExactLiteral(BigDecimal.valueOf(limit.getFirst()), context.getTypeFactory().createSqlType(SqlTypeName.INTEGER));
    RexNode last = context.getRexBuilder().makeExactLiteral(BigDecimal.valueOf(limit.getLast()), context.getTypeFactory().createSqlType(SqlTypeName.INTEGER));
    return new DrillLimitRel(context.getCluster(), context.getLogicalTraits(), input, first, last);
  }
View Full Code Here

    } else {
      origProj = null;
      filterRel = call.rel(0);
    }
    RelNode rel = filterRel.getChild();
    RexNode origFilter = filterRel.getCondition();

    if ((origProj != null) && RexOver.containsOver(origProj.getProjects(), null)) {
      // Cannot push project through filter if project contains a windowed
      // aggregate -- it will affect row counts. Abort this rule
      // invocation; pushdown will be considered after the windowed
View Full Code Here

import org.eigenbase.relopt.RelOptRuleCall;
import org.eigenbase.rex.RexNode;

public class PartitionPruningUtil {
  public static void rewritePlan(RelOptRuleCall call, DrillFilterRel filterRel, DrillProjectRel projectRel, DrillScanRel scanRel, GroupScan newScan, DirPathBuilder builder) {
    RexNode origFilterCondition = filterRel.getCondition();
    RexNode newFilterCondition = builder.getFinalCondition();

    if (newFilterCondition.isAlwaysTrue()) {

      final DrillScanRel newScanRel =
          new DrillScanRel(scanRel.getCluster(),
              scanRel.getTraitSet().plus(DrillRel.DRILL_LOGICAL),
              scanRel.getTable(),
View Full Code Here

    List<RexNode> exprList = new ArrayList<>();
    boolean rewrite = false;

    for (RexNode rex : project.getChildExps()) {
      RexNode newExpr = rex;
      if (rex instanceof RexCall) {
        RexCall function = (RexCall) rex;
        String functionName = function.getOperator().getName();
        int nArgs = function.getOperands().size();
View Full Code Here

  /** Creates a DrillJoinRel. */
  public DrillJoinRel(RelOptCluster cluster, RelTraitSet traits, RelNode left, RelNode right, RexNode condition,
      JoinRelType joinType) throws InvalidRelException {
    super(cluster, traits, left, right, condition, joinType);

    RexNode remaining = RelOptUtil.splitJoinCondition(left, right, condition, leftKeys, rightKeys);
    if (!remaining.isAlwaysTrue() && (leftKeys.size() == 0 || rightKeys.size() == 0)) {
      throw new InvalidRelException("DrillJoinRel only supports equi-join");
    }
  }
View Full Code Here

    assert (leftKeys != null && rightKeys != null);

    if (checkCartesian)  {
      List<Integer> tmpLeftKeys = Lists.newArrayList();
      List<Integer> tmpRightKeys = Lists.newArrayList();
      RexNode remaining = RelOptUtil.splitJoinCondition(left, right, condition, tmpLeftKeys, tmpRightKeys);
      if (!remaining.isAlwaysTrue() && (tmpLeftKeys.size() == 0 || tmpRightKeys.size() == 0)) {
        throw new InvalidRelException("DrillJoinRel only supports equi-join");
      }
    }
    this.leftKeys = leftKeys;
    this.rightKeys = rightKeys;
View Full Code Here

                context.getRexBuilder().makeInputRef(leftField.getType(), leftField.getIndex()),
                context.getRexBuilder().makeInputRef(rightField.getType(), rightInputOffset + rightField.getIndex())
                )
                );
    }
    RexNode rexCondition = RexUtil.composeConjunction(context.getRexBuilder(), joinConditions, false);
    DrillJoinRel joinRel = new DrillJoinRel(context.getCluster(), context.getLogicalTraits(), left, right, rexCondition, join.getJoinType());

    return joinRel;
  }
View Full Code Here

        if (!path.equals(EMPTY_STRING) && !prevPath.equals(EMPTY_STRING)) {
          dirPath += "/" + path;

          // since we are pushing this directory filter we should remove it from the
          // list of conjuncts
          RexNode thisConjunct = conjunctList.get(i);
          conjuncts.remove(thisConjunct);
          buildConjunction = true;
        }
      }
      if (!dirPath.equals(EMPTY_STRING)) {
        dirPathList.add(dirPath);
      }
      if (buildConjunction) {
        RexNode newConjunct = RexUtil.composeConjunction(builder, conjuncts, false);
        newDisjunctList.add(newConjunct);
        buildDisjunction = true;
      }

    } // for (disjuncts)
View Full Code Here

            return BitSets.toList(newGroupSet).indexOf(a0);
          }
        },
        input.getRowType().getFieldCount(),
        newGroupSet.cardinality());
    final RexNode newCondition =
        RexUtil.apply(mapping, filter.getCondition());
    final FilterRelBase newFilter = filter.copy(filter.getTraitSet(),
        newAggregate, newCondition);
    if (BitSets.contains(aggregate.getGroupSet(), filterColumns)) {
      // Everything needed by the filter is returned by the aggregate.
View Full Code Here

TOP

Related Classes of org.eigenbase.rex.RexNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.