Search in sources :

Example 1 with IcebergInputFormat

use of org.apache.iceberg.mr.mapreduce.IcebergInputFormat in project hive by apache.

the class HiveIcebergInputFormat method getRecordReader.

@Override
public RecordReader<Void, Container<Record>> getRecordReader(InputSplit split, JobConf job, Reporter reporter) throws IOException {
    job.set(InputFormatConfig.SELECTED_COLUMNS, job.get(ColumnProjectionUtils.READ_COLUMN_NAMES_CONF_STR, ""));
    if (HiveConf.getBoolVar(job, HiveConf.ConfVars.HIVE_VECTORIZATION_ENABLED) && Utilities.getIsVectorized(job)) {
        Preconditions.checkArgument(MetastoreUtil.hive3PresentOnClasspath(), "Vectorization only supported for Hive 3+");
        job.setEnum(InputFormatConfig.IN_MEMORY_DATA_MODEL, InputFormatConfig.InMemoryDataModel.HIVE);
        job.setBoolean(InputFormatConfig.SKIP_RESIDUAL_FILTERING, true);
        IcebergSplit icebergSplit = ((IcebergSplitContainer) split).icebergSplit();
        // bogus cast for favouring code reuse over syntax
        return (RecordReader) HIVE_VECTORIZED_RECORDREADER_CTOR.newInstance(new IcebergInputFormat<>(), icebergSplit, job, reporter);
    } else {
        return super.getRecordReader(split, job, reporter);
    }
}
Also used : IcebergSplitContainer(org.apache.iceberg.mr.mapreduce.IcebergSplitContainer) MapredIcebergInputFormat(org.apache.iceberg.mr.mapred.MapredIcebergInputFormat) IcebergInputFormat(org.apache.iceberg.mr.mapreduce.IcebergInputFormat) AbstractMapredIcebergRecordReader(org.apache.iceberg.mr.mapred.AbstractMapredIcebergRecordReader) RecordReader(org.apache.hadoop.mapred.RecordReader) IcebergSplit(org.apache.iceberg.mr.mapreduce.IcebergSplit)

Aggregations

RecordReader (org.apache.hadoop.mapred.RecordReader)1 AbstractMapredIcebergRecordReader (org.apache.iceberg.mr.mapred.AbstractMapredIcebergRecordReader)1 MapredIcebergInputFormat (org.apache.iceberg.mr.mapred.MapredIcebergInputFormat)1 IcebergInputFormat (org.apache.iceberg.mr.mapreduce.IcebergInputFormat)1 IcebergSplit (org.apache.iceberg.mr.mapreduce.IcebergSplit)1 IcebergSplitContainer (org.apache.iceberg.mr.mapreduce.IcebergSplitContainer)1