Package org.apache.tajo.datum

Examples of org.apache.tajo.datum.ProtobufDatumFactory


    Appender appender = StorageManagerFactory.getStorageManager(conf).getAppender(meta, schema, tablePath);
    appender.enableStats();
    appender.init();

    QueryId queryid = new QueryId("12345", 5);
    ProtobufDatumFactory factory = ProtobufDatumFactory.get(TajoIdProtos.QueryIdProto.class.getName());

    Tuple tuple = new VTuple(13);
    tuple.put(new Datum[] {
        DatumFactory.createBool(true),
        DatumFactory.createBit((byte) 0x99),
        DatumFactory.createChar("jinho"),
        DatumFactory.createInt2((short) 17),
        DatumFactory.createInt4(59),
        DatumFactory.createInt8(23l),
        DatumFactory.createFloat4(77.9f),
        DatumFactory.createFloat8(271.9f),
        DatumFactory.createText("jinho"),
        DatumFactory.createBlob("hyunsik babo".getBytes()),
        DatumFactory.createInet4("192.168.0.1"),
        NullDatum.get(),
        factory.createDatum(queryid.getProto())
    });
    appender.addTuple(tuple);
    appender.flush();
    appender.close();
View Full Code Here


          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;
        }

        case BLOB:
          tuple.put(tid,
View Full Code Here

          case PROTOBUF: {
            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;
          }

          case INET4 :
            byte [] ipv4Bytes = new byte[4];
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

Related Classes of org.apache.tajo.datum.ProtobufDatumFactory

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.