public static BlobDatum createBlob(byte[] encoded) { return new BlobDatum(encoded); }
public static BlobDatum createBlob(byte[] encoded, int offset, int length) { return new BlobDatum(encoded, offset, length); }
public static BlobDatum createBlob(byte[] encoded, int offset, int length) { return new BlobDatum(encoded, offset, length); }
public static BlobDatum createBlob(byte[] encoded) { return new BlobDatum(encoded); }
public static BlobDatum createBlob(String plainString) { return new BlobDatum(Base64.encodeBase64(plainString.getBytes())); }
public static BlobDatum createBlob(String plainString) { return new BlobDatum(Base64.encodeBase64(plainString.getBytes())); }
@Override final public void addBinary(Binary value) { parent.add(new BlobDatum(ByteBuffer.wrap(value.getBytes()))); } }
@Override final public void addBinary(Binary value) { parent.add(new BlobDatum(ByteBuffer.wrap(value.getBytes()))); } }
@Override final public void addBinary(Binary value) { parent.add(new BlobDatum(ByteBuffer.wrap(value.getBytes()))); } }
private Datum convertBytes(Object value, TajoDataTypes.Type tajoType, DataType dataType) { ByteBuffer buffer = (ByteBuffer)value; byte[] bytes = new byte[buffer.capacity()]; buffer.get(bytes, 0, bytes.length); switch (tajoType) { case PROTOBUF: try { ProtobufDatumFactory factory = ProtobufDatumFactory.get(dataType.getCode()); Message.Builder builder = factory.newBuilder(); builder.mergeFrom(bytes); return ProtobufDatumFactory.createDatum(builder); } catch (InvalidProtocolBufferException e) { throw new RuntimeException(e); } default: return new BlobDatum(bytes); } }
@Override public Datum eval(Tuple params) { if (params.isBlankOrNull(0)) { return NullDatum.get(); } String ipstr = params.getText(0); return new BlobDatum(IPconvertUtil.ipstr2bytes(ipstr)); } }
private Datum convertBytes(Object value, TajoDataTypes.Type tajoType, DataType dataType) { ByteBuffer buffer = (ByteBuffer)value; byte[] bytes = new byte[buffer.capacity()]; buffer.get(bytes, 0, bytes.length); switch (tajoType) { case INET4: return DatumFactory.createInet4(bytes); case PROTOBUF: try { ProtobufDatumFactory factory = ProtobufDatumFactory.get(dataType.getCode()); Message.Builder builder = factory.newBuilder(); builder.mergeFrom(bytes); return factory.createDatum(builder); } catch (InvalidProtocolBufferException e) { throw new RuntimeException(e); } default: return new BlobDatum(bytes); } }
private Datum convertBytes(Object value, TajoDataTypes.Type tajoType, DataType dataType) { ByteBuffer buffer = (ByteBuffer)value; byte[] bytes = new byte[buffer.capacity()]; buffer.get(bytes, 0, bytes.length); switch (tajoType) { case INET4: return DatumFactory.createInet4(bytes); case PROTOBUF: try { ProtobufDatumFactory factory = ProtobufDatumFactory.get(dataType.getCode()); Message.Builder builder = factory.newBuilder(); builder.mergeFrom(bytes); return factory.createDatum(builder); } catch (InvalidProtocolBufferException e) { throw new RuntimeException(e); } default: return new BlobDatum(bytes); } }
public static Datum convertWritable2Datum(Writable value) throws UnsupportedDataTypeException { if (value == null) { return NullDatum.get(); } DataType type = convertWritableToTajoType(value.getClass()); switch(type.getType()) { case INT1: return new Int2Datum(((ByteWritable)value).get()); case INT2: return new Int2Datum(((ShortWritable)value).get()); case INT4: return new Int4Datum(((IntWritable)value).get()); case INT8: return new Int8Datum(((LongWritable)value).get()); case FLOAT4: return new Float4Datum(((FloatWritable)value).get()); case FLOAT8: return new Float8Datum(((DoubleWritable)value).get()); case DATE: return new DateDatum(((DateWritable)value).getDays() + DateTimeConstants.UNIX_EPOCH_JDATE); case TIMESTAMP: return new TimestampDatum(DateTimeUtil.javaTimeToJulianTime( ((TimestampWritable)value).getTimestamp().getTime())); case CHAR: return new CharDatum(value.toString()); case TEXT: return new TextDatum(value.toString()); case VARBINARY: return new BlobDatum(((BytesWritable)value).getBytes()); } throw new TajoRuntimeException(new UnsupportedDataTypeException(value.getClass().getTypeName())); } }
throw new RuntimeException("Avro UNION not supported."); case FIXED: outTuple.put(i, new BlobDatum(((GenericFixed) value).bytes())); break; default:
throw new RuntimeException("Avro UNION not supported."); case FIXED: outTuple.put(i, new BlobDatum(((GenericFixed) value).bytes())); break; default:
throw new RuntimeException("Avro UNION not supported."); case FIXED: tuple.put(columnIndex, new BlobDatum(((GenericFixed)value).bytes())); break; default:
new BlobDatum(((ByteBuffer) columns[i].nextValue()))); break;