Search in sources :

Example 11 with WritableIntObjectInspector

use of org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableIntObjectInspector in project hive by apache.

the class TestStreaming method deserializeInner.

// Assumes row schema => string,int,string
private static SampleRec deserializeInner(Object row, StructObjectInspector inspector) {
    List<? extends StructField> fields = inspector.getAllStructFieldRefs();
    WritableStringObjectInspector f0ins = (WritableStringObjectInspector) fields.get(0).getFieldObjectInspector();
    WritableIntObjectInspector f1ins = (WritableIntObjectInspector) fields.get(1).getFieldObjectInspector();
    WritableStringObjectInspector f2ins = (WritableStringObjectInspector) fields.get(2).getFieldObjectInspector();
    String f0 = f0ins.getPrimitiveJavaObject(inspector.getStructFieldData(row, fields.get(0)));
    int f1 = f1ins.get(inspector.getStructFieldData(row, fields.get(1)));
    String f2 = f2ins.getPrimitiveJavaObject(inspector.getStructFieldData(row, fields.get(2)));
    return new SampleRec(f0, f1, f2);
}
Also used : WritableStringObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableStringObjectInspector) WritableIntObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableIntObjectInspector)

Aggregations

WritableIntObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableIntObjectInspector)7 DecimalTypeInfo (org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo)5 ObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector)4 StructObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector)4 WritableLongObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableLongObjectInspector)4 WritableStringObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableStringObjectInspector)3 DecimalType (com.facebook.presto.common.type.DecimalType)2 VarcharType (com.facebook.presto.common.type.VarcharType)2 HiveChar (org.apache.hadoop.hive.common.type.HiveChar)2 HiveDecimal (org.apache.hadoop.hive.common.type.HiveDecimal)2 HiveVarchar (org.apache.hadoop.hive.common.type.HiveVarchar)2 HiveDecimalWritable (org.apache.hadoop.hive.serde2.io.HiveDecimalWritable)2 PrimitiveCategory (org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory)2 WritableBooleanObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableBooleanObjectInspector)2 WritableByteObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableByteObjectInspector)2 WritableDateObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableDateObjectInspector)2 WritableDoubleObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableDoubleObjectInspector)2 WritableFloatObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableFloatObjectInspector)2 WritableHiveCharObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableHiveCharObjectInspector)2 WritableHiveDecimalObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableHiveDecimalObjectInspector)2