Search in sources :

Example 6 with MutateHelper

use of org.apache.hadoop.hive.common.io.DiskRangeList.MutateHelper in project hive by apache.

the class OrcFileEstimateErrors method getIncompleteCbs.

public DiskRangeList getIncompleteCbs(DiskRangeList ranges, long baseOffset, BooleanRef gotAllData) {
    DiskRangeList prev = ranges.prev;
    if (prev == null) {
        prev = new MutateHelper(ranges);
    }
    DiskRangeList current = ranges;
    // Assume by default that we would find everything.
    gotAllData.value = true;
    while (current != null) {
        // We assume ranges in "ranges" are non-overlapping; thus, we will save next in advance.
        DiskRangeList check = current;
        current = current.next;
        if (check.hasData())
            continue;
        Integer badLength = cache.get(Long.valueOf(check.getOffset() + baseOffset));
        if (badLength == null || badLength < check.getLength()) {
            gotAllData.value = false;
            continue;
        }
        // We could just remove here and handle the missing tail during read, but that can be
        // dangerous; let's explicitly add an incomplete CB.
        check.replaceSelfWith(new IncompleteCb(check.getOffset(), check.getEnd()));
    }
    return prev.next;
}
Also used : MutateHelper(org.apache.hadoop.hive.common.io.DiskRangeList.MutateHelper) DiskRangeList(org.apache.hadoop.hive.common.io.DiskRangeList) IncompleteCb(org.apache.hadoop.hive.ql.io.orc.encoded.IncompleteCb)

Aggregations

DiskRangeList (org.apache.hadoop.hive.common.io.DiskRangeList)6 MutateHelper (org.apache.hadoop.hive.common.io.DiskRangeList.MutateHelper)6 ByteBuffer (java.nio.ByteBuffer)3 IdentityHashMap (java.util.IdentityHashMap)3 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)3 ColumnStreamData (org.apache.hadoop.hive.common.io.encoded.EncodedColumnBatch.ColumnStreamData)3 MemoryBuffer (org.apache.hadoop.hive.common.io.encoded.MemoryBuffer)3 CodedInputStream (com.google.protobuf.CodedInputStream)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 IncompleteCb (org.apache.hadoop.hive.ql.io.orc.encoded.IncompleteCb)2 OrcProto (org.apache.orc.OrcProto)2 Stream (org.apache.orc.OrcProto.Stream)2 Kind (org.apache.orc.OrcProto.Stream.Kind)2 InStream (org.apache.orc.impl.InStream)2 OutStream (org.apache.orc.impl.OutStream)2 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ConcurrentSkipListMap (java.util.concurrent.ConcurrentSkipListMap)1 CreateHelper (org.apache.hadoop.hive.common.io.DiskRangeList.CreateHelper)1