Package org.apache.tajo.common.TajoDataTypes

Examples of org.apache.tajo.common.TajoDataTypes.DataType


  /**
   * It checks both expressions in a comparison operator are compatible to each other.
   */
  private static void verifyComparisonOperator(VerificationState state, BinaryEval expr) {
    DataType leftType = expr.getLeftExpr().getValueType();
    DataType rightType = expr.getRightExpr().getValueType();
    if (!isCompatibleType(leftType, rightType)) {
      state.addVerification("No operator matches the given name and argument type(s): " + expr.toString());
    }
  }
View Full Code Here


  }

  public static Schema targetToSchema(Target[] targets) {
    Schema schema = new Schema();
    for (Target t : targets) {
      DataType type = t.getEvalTree().getValueType();
      String name;
      if (t.hasAlias()) {
        name = t.getAlias();
      } else {
        name = t.getEvalTree().getName();
View Full Code Here

  }

  @Test
  public final void testTimeDatumFromCreateFromInt8() {
    TimeDatum d = DatumFactory.createTime(TIME);
    DataType type = DataType.newBuilder().setType(Type.TIME).build();
    TimeDatum copy = (TimeDatum)DatumFactory.createFromInt8(type, d.asInt8());

    assertEquals(d, copy);
    assertEquals(12, copy.getHourOfDay());
    assertEquals(34, copy.getMinuteOfHour());
View Full Code Here

      Schema nonNullAvroSchema = getNonNull(avroField.schema());
      Schema.Type avroType = nonNullAvroSchema.getType();

      // Get Tajo type.
      Column column = schema.getColumn(columnIndex);
      DataType dataType = column.getDataType();
      TajoDataTypes.Type tajoType = dataType.getType();
      switch (avroType) {
        case NULL:
          tuple.put(columnIndex, NullDatum.get());
          break;
        case BOOLEAN:
View Full Code Here

    currentTuple.put(index, (Datum)value);
  }

  private Converter newConverter(Column column, Type type,
                                 ParentValueContainer parent) {
    DataType dataType = column.getDataType();
    switch (dataType.getType()) {
      case BOOLEAN:
        return new FieldBooleanConverter(parent);
      case BIT:
        return new FieldBitConverter(parent);
      case CHAR:
View Full Code Here

    int tid; // column id of the original input schema
    for (int i = 0; i < projectionMap.length; i++) {
      tid = projectionMap[i];
      columns[i].startRow();
      DataType dataType = schema.getColumn(tid).getDataType();
      switch (dataType.getType()) {
        case BOOLEAN:
          tuple.put(tid,
              DatumFactory.createBool(((Integer)columns[i].nextValue()).byteValue()));
          break;
        case BIT:
          tuple.put(tid,
              DatumFactory.createBit(((Integer) columns[i].nextValue()).byteValue()));
          break;
        case CHAR:
          String str = (String) columns[i].nextValue();
          tuple.put(tid,
              DatumFactory.createChar(str));
          break;

        case INT2:
          tuple.put(tid,
              DatumFactory.createInt2(((Integer) columns[i].nextValue()).shortValue()));
          break;
        case INT4:
          tuple.put(tid,
              DatumFactory.createInt4((Integer) columns[i].nextValue()));
          break;

        case INT8:
          tuple.put(tid,
              DatumFactory.createInt8((Long) columns[i].nextValue()));
          break;

        case FLOAT4:
          tuple.put(tid,
              DatumFactory.createFloat4((Float) columns[i].nextValue()));
          break;

        case FLOAT8:
          tuple.put(tid,
              DatumFactory.createFloat8((Double) columns[i].nextValue()));
          break;

        case INET4:
          tuple.put(tid,
              DatumFactory.createInet4(((ByteBuffer) columns[i].nextValue()).array()));
          break;

        case TEXT:
          tuple.put(tid,
              DatumFactory.createText((String) columns[i].nextValue()));
          break;

        case PROTOBUF: {
          ProtobufDatumFactory factory = ProtobufDatumFactory.get(dataType.getCode());
          Message.Builder builder = factory.newBuilder();
          builder.mergeFrom(((ByteBuffer)columns[i].nextValue()).array());
          tuple.put(tid, factory.createDatum(builder));
          break;
        }
View Full Code Here

    maxValues = new VTuple(schema.size());

    numNulls = new long[schema.size()];
    comparable = new boolean[schema.size()];

    DataType type;
    for (int i = 0; i < schema.size(); i++) {
      type = schema.getColumn(i).getDataType();
      if (type.getType() == Type.PROTOBUF) {
        comparable[i] = false;
      } else {
        comparable[i] = true;
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.tajo.common.TajoDataTypes.DataType

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.