@Override public byte[] getPrimitiveJavaObject(Object o) { if (null == o) { return null; } return LazyUtils.createByteArray(((LazyBinary) o).getWritableObject()); }
public static ByteArrayRef newByteArrayRef(String encodedMap) { ByteArrayRef bytes = new ByteArrayRef(); bytes.setData(encodedMap.getBytes(StandardCharsets.US_ASCII)); return bytes; } }
protected final boolean isNull( Text nullSequence, byte[] bytes, int fieldByteBegin, int fieldLength) { // Test the length first so in most cases we avoid doing a byte[] // comparison. return fieldLength < 0 || (fieldLength == nullSequence.getLength() && LazyUtils.compare(bytes, fieldByteBegin, fieldLength, nullSequence.getBytes(), 0, nullSequence.getLength()) == 0); }
public FieldInfo(LazyObjectBase lazyObject, boolean fieldSkipped, ObjectInspector oi) { field = lazyObject; cachedByteArrayRef = new ByteArrayRef(); objectInspector = oi; if (fieldSkipped) { this.fieldSkipped = true; inited = true; } else { inited = false; } }
@Override protected LazyObjectBase createLazyObjectBase(ObjectInspector objectInspector) { return LazyFactory.createLazyObject(objectInspector); } }
/** * Return the data in bytes corresponding to this given struct. This is useful specifically in * cases where the data is stored in serialized formats like protobufs or thrift and would need * custom deserializers to be deserialized. * */ public byte[] getBytes() { return bytes.getData(); } }
@Override public ObjectInspector createValueObjectInspector(TypeInfo type) throws SerDeException { return LazyFactory.createLazyObjectInspector(type, 1, serdeParams, ObjectInspectorOptions.JAVA); }
@Override public Object copyObject(Object o) { if (o == null) { return null; } LazyHiveVarchar ret = new LazyHiveVarchar(this); ret.setValue((LazyHiveVarchar) o); return ret; }
@Override public Object copyObject(Object o) { if (o == null) { return null; } LazyHiveChar ret = new LazyHiveChar(this); ret.setValue((LazyHiveChar) o); return ret; }
@Override public List<?> getList(Object data) { if (data == null) { return null; } LazyArray array = (LazyArray) data; return array.getList(); }
/** * Set the row data for this LazyArray. * * @see LazyObject#init(ByteArrayRef, int, int) */ @Override public void init(ByteArrayRef bytes, int start, int length) { super.init(bytes, start, length); parsed = false; cachedMap = null; keyStart = null; }
@Override public byte getTag(Object data) { if (data == null) { return -1; } return ((LazyUnion) data).getTag(); } }
/** * Get the size of the map represented by this LazyMap. * * @return The size of the map, -1 for NULL map. */ public int getMapSize() { if (!parsed) { parse(); } return mapSize; }
@Override public Object getListElement(Object data, int index) { if (data == null) { return null; } LazyArray array = (LazyArray) data; return array.getListElementObject(index); }
@Override public int getListLength(Object data) { if (data == null) { return -1; } LazyArray array = (LazyArray) data; return array.getListLength(); }
/** * Set the row data for this LazyUnion. * * @see LazyObject#init(ByteArrayRef, int, int) */ @Override public void init(ByteArrayRef bytes, int start, int length) { super.init(bytes, start, length); parsed = false; }
/** * Set the row data for this LazyArray. * * @see LazyObject#init(ByteArrayRef, int, int) */ @Override public void init(ByteArrayRef bytes, int start, int length) { super.init(bytes, start, length); parsed = false; cachedList = null; }