/** * 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} */ 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; }
@Override protected LazyObjectBase createLazyField(final int fieldID, final StructField fieldRef) throws SerDeException { if (columnsMapping[fieldID].hbaseRowKey) { return keyFactory.createKey(fieldRef.getFieldObjectInspector()); } if (columnsMapping[fieldID].hbaseTimestamp) { return LazyFactory.createLazyObject(fieldRef.getFieldObjectInspector()); } if (valueFactories != null) { return valueFactories.get(fieldID).createValueObject(fieldRef.getFieldObjectInspector()); } // fallback to default return HBaseSerDeHelper.createLazyField( columnsMapping, fieldID, fieldRef.getFieldObjectInspector()); }