Package org.eigenbase.reltype

Examples of org.eigenbase.reltype.RelDataType


  }

  @Override
  public RelDataType inferReturnType(SqlOperatorBinding opBinding) {
    final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
    final RelDataType operandType = opBinding.getOperandType(0);
    switch (operandType.getSqlTypeName()) {
    case ARRAY:
      return typeFactory.createTypeWithNullability(
          operandType.getComponentType(), true);
    case MAP:
      return typeFactory.createTypeWithNullability(operandType.getValueType(),
          true);
    case ANY:
      return typeFactory.createSqlType(SqlTypeName.ANY);
    default:
      throw new AssertionError();
View Full Code Here


      }
      tupleList.add(valuesList);
    }

    if (changeCount > 0) {
      final RelDataType rowType;
      if (projectExprs != null) {
        rowType = project.getRowType();
      } else {
        rowType = values.getRowType();
      }
View Full Code Here

  ColumnLoader(JavaTypeFactory typeFactory,
      Enumerable<T> sourceTable,
      RelProtoDataType protoRowType,
      List<ColumnMetaData.Rep> repList) {
    this.typeFactory = typeFactory;
    final RelDataType rowType = protoRowType.apply(typeFactory);
    if (repList == null) {
      repList =
          Collections.nCopies(rowType.getFieldCount(),
              ColumnMetaData.Rep.OBJECT);
    }
    sourceTable.into(list);
    final int[] sorts = {-1};
    load(rowType, repList, sorts);
View Full Code Here

      validator.validateWithItem((SqlWithItem) withItem);
    }
    final SqlValidatorScope scope2 =
        validator.getWithScope(Util.last(with.withList.getList()));
    validator.validateQuery(with.body, scope2);
    final RelDataType rowType = validator.getValidatedNodeType(with.body);
    validator.setValidatedNodeType(with, rowType);
    return rowType;
  }
View Full Code Here

  @Override
  public boolean isValid(boolean fail) {
    // In the window specifications, an aggregate call such as
    // 'SUM(RexInputRef #10)' refers to expression #10 of inputProgram.
    // (Not its projections.)
    final RelDataType childRowType = getChild().getRowType();

    final int childFieldCount = childRowType.getFieldCount();
    final int inputSize = childFieldCount + constants.size();
    final List<RelDataType> inputTypes =
        new AbstractList<RelDataType>() {
          @Override
          public RelDataType get(int index) {
            return index < childFieldCount
                ? childRowType.getFieldList().get(index).getType()
                : constants.get(index - childFieldCount).getType();
          }

          @Override
          public int size() {
View Full Code Here

      BlockBuilder list,
      PhysType outputPhysType,
      InputGetter inputGetter) {
    List<Type> storageTypes = null;
    if (outputPhysType != null) {
      final RelDataType rowType = outputPhysType.getRowType();
      storageTypes = new ArrayList<Type>(rowType.getFieldCount());
      for (int i = 0; i < rowType.getFieldCount(); i++) {
        storageTypes.add(outputPhysType.getJavaFieldType(i));
      }
    }
    return new RexToLixTranslator(program, typeFactory, inputGetter, list)
        .translateList(program.getProjectList(), storageTypes);
View Full Code Here

    assertEquals(2, pair.cardinality);
  }

  @Test public void testLoadSorted() {
    final JavaTypeFactoryImpl typeFactory = new JavaTypeFactoryImpl();
    final RelDataType rowType =
        typeFactory.builder()
            .add("empid", typeFactory.createType(int.class))
            .add("deptno", typeFactory.createType(int.class))
            .add("name", typeFactory.createType(String.class))
            .build();
View Full Code Here

  /** As {@link #testLoadSorted()} but column #1 is the unique column, not
   * column #0. The algorithm needs to go back and permute the values of
   * column #0 after it discovers that column #1 is unique and sorts by it. */
  @Test public void testLoadSorted2() {
    final JavaTypeFactoryImpl typeFactory = new JavaTypeFactoryImpl();
    final RelDataType rowType =
        typeFactory.builder()
            .add("deptno", typeFactory.createType(int.class))
            .add("empid", typeFactory.createType(int.class))
            .add("name", typeFactory.createType(String.class))
            .build();
View Full Code Here

    super("ARRAY", SqlKind.ARRAY_VALUE_CONSTRUCTOR);
  }

  @Override
  public RelDataType inferReturnType(SqlOperatorBinding opBinding) {
    RelDataType type =
        getComponentType(
            opBinding.getTypeFactory(),
            opBinding.collectOperandTypes());
    if (null == type) {
      return null;
View Full Code Here

  }

  @Override protected RelDataType validateImpl() {
    final SqlValidatorNamespace childNs =
        validator.getNamespace(withItem.query);
    final RelDataType rowType = childNs.getRowTypeSansSystemColumns();
    if (withItem.columnList == null) {
      return rowType;
    }
    final RelDataTypeFactory.FieldInfoBuilder builder =
        validator.getTypeFactory().builder();
    for (Pair<SqlNode, RelDataTypeField> pair
        : Pair.zip(withItem.columnList, rowType.getFieldList())) {
      builder.add(((SqlIdentifier) pair.left).getSimple(),
          pair.right.getType());
    }
    return builder.build();
  }
View Full Code Here

TOP

Related Classes of org.eigenbase.reltype.RelDataType

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.