Examples of RexNode


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
    if (! remaining.isAlwaysTrue()) {
      if (hasEquijoins) {
        addFilter = true;
        List<RexNode> equijoinList = Lists.newArrayList();
        List<RelDataTypeField> leftTypes = convertedLeft.getRowType().getFieldList();
        List<RelDataTypeField> rightTypes = convertedRight.getRowType().getFieldList();
View Full Code Here

Examples of org.eigenbase.rex.RexNode

    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

Examples of org.eigenbase.rex.RexNode

  private RelNode rename(RelNode input, List<RelDataTypeField> inputFields, List<String> outputFieldNames) {
    List<RexNode> exprs = Lists.newArrayList();

    for (RelDataTypeField field : inputFields) {
      RexNode expr = input.getCluster().getRexBuilder().makeInputRef(field.getType(), field.getIndex());
      exprs.add(expr);
    }

    RelDataType rowType = RexUtil.createStructType(input.getCluster().getTypeFactory(), exprs, outputFieldNames);
View Full Code Here

Examples of org.eigenbase.rex.RexNode

    for (Ord<RexNode> node : Ord.zip(project.getProjects())) {
      if (node.e instanceof RexInputRef) {
        m.put( ((RexInputRef) node.e).getIndex(), node.i);
      } else if (node.e.isA(SqlKind.CAST)) {
        RexNode operand = ((RexCall) node.e).getOperands().get(0);
        if (operand instanceof RexInputRef) {
          m.put(
              ((RexInputRef) operand).getIndex(), node.i);
        }
      }
View Full Code Here

Examples of org.eigenbase.rex.RexNode

    Prel child = ((Prel) root.getInput(0)).accept(INSTANCE, renamedForStar);

    if (renamedForStar[0] && renamedForStar[1]) {
      List<RexNode> exprs = Lists.newArrayList();
      for (int i = 0; i < origRowType.getFieldCount(); i++) {
        RexNode expr = child.getCluster().getRexBuilder().makeInputRef(origRowType.getFieldList().get(i).getType(), i);
        exprs.add(expr);
      }

      RelDataType newRowType = RexUtil.createStructType(child.getCluster().getTypeFactory(), exprs, origRowType.getFieldNames());
View Full Code Here

Examples of org.eigenbase.rex.RexNode

      renamedForStar[1] = true// indicate there is * for a SCAN operator.

      List<RexNode> exprs = Lists.newArrayList();

      for (RelDataTypeField field : scanPrel.getRowType().getFieldList()) {
        RexNode expr = scanPrel.getCluster().getRexBuilder().makeInputRef(field.getType(), field.getIndex());
        exprs.add(expr);
      }

      List<String> fieldNames = Lists.newArrayList();

View Full Code Here

Examples of org.eigenbase.rex.RexNode

    if (condition.isAlwaysTrue()) {
      throw new InvalidRelException("MergeJoinPrel does not support cartesian product join");
    }

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

Examples of org.eigenbase.rex.RexNode

    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

Examples of org.eigenbase.rex.RexNode

  /** 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

Examples of org.eigenbase.rex.RexNode

    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
TOP
Copyright © 2018 www.massapi.com. 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.