use of org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryStruct in project hive by apache.
the class TestLazyBinaryStruct method testEmptyStruct.
@Test
public void testEmptyStruct() {
LazyBinaryStructObjectInspector oi = LazyBinaryObjectInspectorFactory.getLazyBinaryStructObjectInspector(new ArrayList<>(), new ArrayList<>());
ByteArrayRef byteRef = new ByteArrayRef();
byteRef.setData(new byte[] { 0 });
LazyBinaryStruct data = (LazyBinaryStruct) LazyBinaryFactory.createLazyBinaryObject(oi);
data.init(byteRef, 0, 0);
assertEquals(data.getRawDataSerializedSize(), 0);
}
use of org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryStruct in project hive by apache.
the class LazyBinarySerDe method initialize.
/**
* Initialize the SerDe with configuration and table information.
*/
@Override
public void initialize(Configuration configuration, Properties tableProperties, Properties partitionProperties) throws SerDeException {
super.initialize(configuration, tableProperties, partitionProperties);
// Create row related objects
rowTypeInfo = TypeInfoFactory.getStructTypeInfo(getColumnNames(), getColumnTypes());
// Create the object inspector and the lazy binary struct object
cachedObjectInspector = LazyBinaryUtils.getLazyBinaryObjectInspectorFromTypeInfo(rowTypeInfo);
cachedLazyBinaryStruct = (LazyBinaryStruct) LazyBinaryFactory.createLazyBinaryObject(cachedObjectInspector);
// output debug info
log.debug("LazyBinarySerDe initialized with: columnNames={} columnTypes={}", getColumnNames(), getColumnTypes());
serializedSize = 0;
stats = new SerDeStats();
lastOperationSerialize = false;
lastOperationDeserialize = false;
}
Aggregations