Package org.apache.tajo.datum

Examples of org.apache.tajo.datum.ProtobufDatumFactory.newBuilder()


            int byteSize = buffer.getInt();
            byte [] rawBytes = new byte[byteSize];
            buffer.get(rawBytes);

            ProtobufDatumFactory factory = ProtobufDatumFactory.get(columnTypes[i]);
            Message.Builder builder = factory.newBuilder();
            builder.mergeFrom(rawBytes);
            tuple.put(i, factory.createDatum(builder.build()));
            break;
          }
View Full Code Here


              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

                      column.get(tid).getBytesCopy()));
              break;

            case PROTOBUF: {
              ProtobufDatumFactory factory = ProtobufDatumFactory.get(dataType.getCode());
              Message.Builder builder = factory.newBuilder();
              builder.mergeFrom(column.get(tid).getBytesCopy());
              tuple.put(tid, factory.createDatum(builder));
              break;
            }
            case INET4:
View Full Code Here

    TajoDataTypes.DataType.Builder builder = TajoDataTypes.DataType.newBuilder();
    builder.setType(TajoDataTypes.Type.PROTOBUF);
    builder.setCode(TajoIdProtos.QueryIdProto.class.getName());

    ProtobufDatumFactory factory = ProtobufDatumFactory.get(builder.build());
    TajoIdProtos.QueryIdProto.Builder queryIdBuilder = factory.newBuilder();
    queryIdBuilder.setId(String.valueOf(System.currentTimeMillis()));
    queryIdBuilder.setSeq(1);

    TajoIdProtos.QueryIdProto queryId = queryIdBuilder.build();
    ProtobufDatum datum = factory.createDatum(queryId);
View Full Code Here

    ProtobufDatum datum = factory.createDatum(queryId);

    ProtobufJsonFormat formatter = ProtobufJsonFormat.getInstance();
    String json = formatter.printToString(datum.get());

    TajoIdProtos.QueryIdProto.Builder fromJson = factory.newBuilder();
    formatter.merge(TextUtils.toInputStream(json), fromJson);
    assertEquals(queryId, fromJson.build());
  }
}
View Full Code Here

              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

            int len = readRawVarint32();
            byte [] rawBytes = new byte[len];
            buffer.get(rawBytes);

            ProtobufDatumFactory factory = ProtobufDatumFactory.get(columnTypes[i]);
            Message.Builder builder = factory.newBuilder();
            builder.mergeFrom(rawBytes);
            tuple.put(i, factory.createDatum(builder.build()));
            break;
          }
View Full Code Here

    @Override
    final public void addBinary(Binary value) {
      try {
        ProtobufDatumFactory factory =
            ProtobufDatumFactory.get(dataType.getCode());
        Message.Builder builder = factory.newBuilder();
        builder.mergeFrom(value.getBytes());
        parent.add(factory.createDatum(builder));
      } catch (InvalidProtocolBufferException e) {
        throw new RuntimeException(e);
      }
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.