@Override public void initialize(Configuration conf, Properties tbl) throws SerDeException { super.initialize(conf, tbl); ObjectInspector oi = getObjectInspector(); rowSerializer = createLBSerializer(oi); }
@Override protected LazyObjectBase createLazyObjectBase(ObjectInspector objectInspector) { return LazyBinaryFactory.createLazyBinaryObject(objectInspector); } }
@Override public void init(ByteArrayRef bytes, int start, int length) { super.init(bytes, start, length); parsed = false; serializedSize = length; fieldInited = false; field = null; cachedObject = null; }
@Override public List<?> getList(Object data) { if (data == null) { return null; } LazyBinaryArray array = (LazyBinaryArray) data; return array.getList(); }
@Override public List<Object> getStructFieldsDataAsList(Object data) { if (data == null) { return null; } LazyBinaryStruct struct = (LazyBinaryStruct) data; return struct.getFieldsAsList(); }
public static void setFromBigIntegerBytesAndScale(byte[] bytes, int offset, int length, HiveDecimalWritable dec) { LazyBinaryUtils.VInt vInt = new LazyBinaryUtils.VInt(); LazyBinaryUtils.readVInt(bytes, offset, vInt); int scale = vInt.value; offset += vInt.length; LazyBinaryUtils.readVInt(bytes, offset, vInt); offset += vInt.length; dec.setFromBigIntegerBytesAndScale(bytes, offset, vInt.value, scale); }
/** * Write a zero-compressed encoded long to a byte array. * * @param bytes * the byte array/stream * @param l * the long */ public static int writeVLongToByteArray(byte[] bytes, long l) { return LazyBinaryUtils.writeVLongToByteArray(bytes, 0, l); }
@Override public Object getListElement(Object data, int index) { if (data == null) { return null; } LazyBinaryArray array = (LazyBinaryArray) data; return array.getListElementObject(index); }
/** * Returns the array size. */ public int getListLength() { if (!parsed) { parse(); } return arraySize; }
/** * Writes a zero-compressed encoded int to a byte array. * * @param byteStream * the byte array/stream * @param i * the int */ public static void writeVInt(RandomAccessOutput byteStream, int i) { writeVLong(byteStream, i); }
public short getShort() { assert (2 == fieldLength); return LazyBinaryUtils.byteArrayToShort(fieldBytes, fieldStart); } }
@Override public int getListLength(Object data) { if (data == null) { return -1; } LazyBinaryArray array = (LazyBinaryArray) data; return array.getListLength(); } }
/** * Get the size of the map represented by this LazyBinaryMap. * * @return The size of the map */ public int getMapSize() { if (!parsed) { parse(); } return mapSize; } }
@Override public int getMapSize(Object data) { if (data == null) { return -1; } return ((LazyBinaryMap) data).getMapSize(); }
/** * Return the tag of the object. */ public byte getTag(Object o) { if (o == null) { return -1; } LazyBinaryUnion lazyBinaryUnion = (LazyBinaryUnion) o; return lazyBinaryUnion.getTag(); }
/** * Return the field based on the tag value associated with the Object. */ public Object getField(Object o) { if (o == null) { return null; } LazyBinaryUnion lazyBinaryUnion = (LazyBinaryUnion) o; return lazyBinaryUnion.getField(); } }
@Override protected VInt initialValue() { return new VInt(); } };
public void serializeValue(RandomAccessOutput byteStream, Object obj, ObjectInspector objInspector, boolean skipLengthPrefix, BooleanRef warnedOnceNullMapKey) { if (obj != null) { serialize(byteStream, obj, objInspector, skipLengthPrefix, warnedOnceNullMapKey); } }
@Override public void init(ByteArrayRef bytes, int start, int length) { super.init(bytes, start, length); parsed = false; serializedSize = length; }
/** * Set the row data for this LazyBinaryArray. * * @see LazyObject#init(ByteArrayRef, int, int) */ @Override public void init(ByteArrayRef bytes, int start, int length) { super.init(bytes, start, length); parsed = false; }