Search in sources :

Example 6 with JavaLongObjectInspector

use of org.apache.hadoop.hive.serde2.objectinspector.primitive.JavaLongObjectInspector in project presto by prestodb.

the class TestOrcReaderPositions method createSequentialFile.

private static void createSequentialFile(File file, int count) throws IOException, ReflectiveOperationException, SerDeException {
    FileSinkOperator.RecordWriter writer = createOrcRecordWriter(file, ORC_12, OrcTester.Compression.NONE, javaLongObjectInspector);
    @SuppressWarnings("deprecation") Serializer serde = new OrcSerde();
    SettableStructObjectInspector objectInspector = createSettableStructObjectInspector("test", javaLongObjectInspector);
    Object row = objectInspector.create();
    StructField field = objectInspector.getAllStructFieldRefs().get(0);
    for (int i = 0; i < count; i++) {
        objectInspector.setStructFieldData(row, field, (long) i);
        Writable record = serde.serialize(row, objectInspector);
        writer.write(record);
    }
    writer.close(false);
}
Also used : SettableStructObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.SettableStructObjectInspector) OrcTester.createSettableStructObjectInspector(com.facebook.presto.orc.OrcTester.createSettableStructObjectInspector) StructField(org.apache.hadoop.hive.serde2.objectinspector.StructField) FileSinkOperator(org.apache.hadoop.hive.ql.exec.FileSinkOperator) OrcSerde(org.apache.hadoop.hive.ql.io.orc.OrcSerde) Writable(org.apache.hadoop.io.Writable) Serializer(org.apache.hadoop.hive.serde2.Serializer)

Aggregations

Date (java.sql.Date)3 Timestamp (java.sql.Timestamp)3 Path (org.apache.hadoop.fs.Path)3 HiveDecimal (org.apache.hadoop.hive.common.type.HiveDecimal)3 HiveVarchar (org.apache.hadoop.hive.common.type.HiveVarchar)3 DateWritable (org.apache.hadoop.hive.serde2.io.DateWritable)3 OrcTester.createSettableStructObjectInspector (com.facebook.presto.orc.OrcTester.createSettableStructObjectInspector)2 FileSinkOperator (org.apache.hadoop.hive.ql.exec.FileSinkOperator)2 OrcSerde (org.apache.hadoop.hive.ql.io.orc.OrcSerde)2 Serializer (org.apache.hadoop.hive.serde2.Serializer)2 HiveDecimalWritable (org.apache.hadoop.hive.serde2.io.HiveDecimalWritable)2 TimestampWritable (org.apache.hadoop.hive.serde2.io.TimestampWritable)2 SettableStructObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.SettableStructObjectInspector)2 StructField (org.apache.hadoop.hive.serde2.objectinspector.StructField)2 Text (org.apache.hadoop.io.Text)2 Writable (org.apache.hadoop.io.Writable)2 JobConf (org.apache.hadoop.mapred.JobConf)2 HIVE_DATABASE_LOCATION_ERROR (com.facebook.presto.hive.HiveErrorCode.HIVE_DATABASE_LOCATION_ERROR)1 HIVE_FILESYSTEM_ERROR (com.facebook.presto.hive.HiveErrorCode.HIVE_FILESYSTEM_ERROR)1 HIVE_WRITER_DATA_ERROR (com.facebook.presto.hive.HiveErrorCode.HIVE_WRITER_DATA_ERROR)1