use of org.apache.hadoop.hive.serde2.lazy.LazyObject in project hive by apache.
the class HBaseTestStructSerializer method toLazyObject.
/**
* Create an initialize a {@link LazyObject} with the given bytes for the given fieldID.
*
* @param fieldID field for which the object is to be created
* @param bytes value with which the object is to be initialized with
*
* @return initialized {@link LazyObject}
*/
@Override
public LazyObject<? extends ObjectInspector> toLazyObject(int fieldID, byte[] bytes) {
ObjectInspector fieldOI = oi.getAllStructFieldRefs().get(fieldID).getFieldObjectInspector();
LazyObject<? extends ObjectInspector> lazyObject = LazyFactory.createLazyObject(fieldOI);
ByteArrayRef ref = new ByteArrayRef();
ref.setData(bytes);
// initialize the lazy object
lazyObject.init(ref, 0, ref.getData().length);
return lazyObject;
}
Aggregations