Package org.apache.druid.segment
Class DictionaryMergingIterator<T extends Comparable<T>>
- java.lang.Object
-
- org.apache.druid.segment.DictionaryMergingIterator<T>
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterator<T>,CloseableIterator<T>
public class DictionaryMergingIterator<T extends Comparable<T>> extends Object implements CloseableIterator<T>
Iterator for merging dictionaries for some comparable type into a single sorted dictionary, useful when merging dictionary encoded columns
-
-
Field Summary
Fields Modifier and Type Field Description protected IntBuffer[]conversionsprotected intcounterprotected List<Pair<ByteBuffer,Integer>>directBufferAllocationsprotected PriorityQueue<Pair<Integer,com.google.common.collect.PeekingIterator<T>>>pQueue
-
Constructor Summary
Constructors Constructor Description DictionaryMergingIterator(Indexed<T>[] dimValueLookups, Comparator<Pair<Integer,com.google.common.collect.PeekingIterator<T>>> comparator, boolean useDirect)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()intgetCardinality()booleanhasNext()static <T extends Comparable<T>>
Comparator<Pair<Integer,com.google.common.collect.PeekingIterator<T>>>makePeekingComparator()protected booleanneedConversion(int index)Tnext()protected com.google.common.collect.PeekingIterator<T>transformIndexedIterator(Indexed<T> indexed)protected TwriteTranslate(Pair<Integer,com.google.common.collect.PeekingIterator<T>> smallest, int counter)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.druid.java.util.common.parsers.CloseableIterator
flatMap, map
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
-
-
-
Field Detail
-
conversions
protected final IntBuffer[] conversions
-
directBufferAllocations
protected final List<Pair<ByteBuffer,Integer>> directBufferAllocations
-
pQueue
protected final PriorityQueue<Pair<Integer,com.google.common.collect.PeekingIterator<T extends Comparable<T>>>> pQueue
-
counter
protected int counter
-
-
Method Detail
-
makePeekingComparator
public static <T extends Comparable<T>> Comparator<Pair<Integer,com.google.common.collect.PeekingIterator<T>>> makePeekingComparator()
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfaceIterator<T extends Comparable<T>>
-
getCardinality
public int getCardinality()
-
transformIndexedIterator
protected com.google.common.collect.PeekingIterator<T> transformIndexedIterator(Indexed<T> indexed)
-
needConversion
protected boolean needConversion(int index)
-
writeTranslate
protected T writeTranslate(Pair<Integer,com.google.common.collect.PeekingIterator<T>> smallest, int counter)
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-