Package org.eigenbase.reltype

Examples of org.eigenbase.reltype.RelDataTypeField


    return super.visitCall(call);
  }

  private static int lookup(List<RelDataTypeField> fields, String name) {
    for (int i = 0; i < fields.size(); i++) {
      final RelDataTypeField field = fields.get(i);
      if (field.getName().equals(name)) {
        return i;
      }
    }
    return -1;
  }
View Full Code Here


    public SqlNode field(int ordinal) {
      for (Pair<String, RelDataType> alias : aliases) {
        final List<RelDataTypeField> fields = alias.right.getFieldList();
        if (ordinal < fields.size()) {
          RelDataTypeField field = fields.get(ordinal);
          return new SqlIdentifier(!qualified
              ? ImmutableList.of(field.getName())
              : ImmutableList.of(alias.left, field.getName()),
              POS);
        }
        ordinal -= fields.size();
      }
      throw new AssertionError(
View Full Code Here

    public SqlNode field(int ordinal) {
      for (Pair<String, RelDataType> alias : aliases) {
        final List<RelDataTypeField> fields = alias.right.getFieldList();
        if (ordinal < fields.size()) {
          RelDataTypeField field = fields.get(ordinal);
          return new SqlIdentifier(!qualified
              ? ImmutableList.of(field.getName())
              : ImmutableList.of(alias.left, field.getName()),
              POS);
        }
        ordinal -= fields.size();
      }
      throw new AssertionError(
View Full Code Here

    return super.visitCall(call);
  }

  private static int lookup(List<RelDataTypeField> fields, String name) {
    for (int i = 0; i < fields.size(); i++) {
      final RelDataTypeField field = fields.get(i);
      if (field.getName().equals(name)) {
        return i;
      }
    }
    return -1;
  }
View Full Code Here

    }

    @Override
    public StringBuilder visitInputRef(RexInputRef inputRef) {
      final int index = inputRef.getIndex();
      final RelDataTypeField field = input.getRowType().getFieldList().get(index);
      buf.append(field.getName());
      return buf;
    }
View Full Code Here

        return f;
      }
    }

    /* This field does not exist in our field list add it */
    RelDataTypeField newField = new RelDataTypeFieldImpl(fieldName, fields.size(), typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.ANY), true));

    /* Add the name to our list of field names */
    fields.add(newField);

    return newField;
View Full Code Here

      addField(column);
    computeDigest();
  }

  private void addField(String columnName) {
    RelDataTypeField newField = new RelDataTypeFieldImpl(
        columnName, fields.size(), typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.ANY), true));
    fields.add(newField);
  }
View Full Code Here

    }

    @Override
    public LogicalExpression visitInputRef(RexInputRef inputRef) {
      final int index = inputRef.getIndex();
      final RelDataTypeField field = input.getRowType().getFieldList().get(index);
      return FieldReference.getWithQuotedRef(field.getName());
    }
View Full Code Here

    @Override
    public PathSegment visitInputRef(RexInputRef inputRef) {
      int index = inputRef.getIndex();
      String name = fieldNames.get(index);
      RelDataTypeField field = fields.get(index);
      DesiredField f = new DesiredField(index, name, field);
      desiredFields.add(f);
      return new NameSegment(name);
    }
View Full Code Here

    List<RexNode> joinConditions = new ArrayList<RexNode>();
    // right fields appear after the LHS fields.
    final int rightInputOffset = left.getRowType().getFieldCount();
    for (JoinCondition condition : join.getConditions()) {
      RelDataTypeField leftField = left.getRowType().getField(ExprHelper.getFieldName(condition.getLeft()), true);
      RelDataTypeField rightField = right.getRowType().getField(ExprHelper.getFieldName(condition.getRight()), true);
        joinConditions.add(
            context.getRexBuilder().makeCall(
                SqlStdOperatorTable.EQUALS,
                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());
View Full Code Here

TOP

Related Classes of org.eigenbase.reltype.RelDataTypeField

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.