Search in sources :

Example 6 with ReaderKey

use of org.apache.hadoop.hive.ql.io.orc.OrcRawRecordMerger.ReaderKey in project hive by apache.

the class TestOrcRawRecordMerger method testReaderPair.

@Test
public void testReaderPair() throws Exception {
    ReaderKey key = new ReaderKey();
    Reader reader = createMockReader();
    RecordIdentifier minKey = new RecordIdentifier(10, 20, 30);
    RecordIdentifier maxKey = new RecordIdentifier(40, 50, 60);
    ReaderPair pair = new OrcRawRecordMerger.ReaderPairAcid(key, reader, minKey, maxKey, new Reader.Options(), new HiveConf());
    RecordReader recordReader = pair.getRecordReader();
    assertEquals(10, key.getWriteId());
    assertEquals(20, key.getBucketProperty());
    assertEquals(40, key.getRowId());
    assertEquals(120, key.getCurrentWriteId());
    assertEquals("third", value(pair.nextRecord()));
    pair.next(pair.nextRecord());
    assertEquals(40, key.getWriteId());
    assertEquals(50, key.getBucketProperty());
    assertEquals(60, key.getRowId());
    assertEquals(130, key.getCurrentWriteId());
    assertEquals("fourth", value(pair.nextRecord()));
    pair.next(pair.nextRecord());
    assertEquals(null, pair.nextRecord());
    Mockito.verify(recordReader).close();
}
Also used : RecordIdentifier(org.apache.hadoop.hive.ql.io.RecordIdentifier) ReaderPair(org.apache.hadoop.hive.ql.io.orc.OrcRawRecordMerger.ReaderPair) HiveConf(org.apache.hadoop.hive.conf.HiveConf) ReaderKey(org.apache.hadoop.hive.ql.io.orc.OrcRawRecordMerger.ReaderKey) Test(org.junit.Test)

Aggregations

ReaderKey (org.apache.hadoop.hive.ql.io.orc.OrcRawRecordMerger.ReaderKey)6 Test (org.junit.Test)5 RecordIdentifier (org.apache.hadoop.hive.ql.io.RecordIdentifier)4 ReaderPair (org.apache.hadoop.hive.ql.io.orc.OrcRawRecordMerger.ReaderPair)4 Configuration (org.apache.hadoop.conf.Configuration)3 FileSystem (org.apache.hadoop.fs.FileSystem)3 Path (org.apache.hadoop.fs.Path)3 ValidReaderWriteIdList (org.apache.hadoop.hive.common.ValidReaderWriteIdList)3 HiveConf (org.apache.hadoop.hive.conf.HiveConf)2 BitSet (java.util.BitSet)1 ValidReadTxnList (org.apache.hadoop.hive.common.ValidReadTxnList)1 ValidWriteIdList (org.apache.hadoop.hive.common.ValidWriteIdList)1 AcidDirectory (org.apache.hadoop.hive.ql.io.AcidDirectory)1 AcidOutputFormat (org.apache.hadoop.hive.ql.io.AcidOutputFormat)1 RecordUpdater (org.apache.hadoop.hive.ql.io.RecordUpdater)1 ObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector)1 StructObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector)1