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
FieldsModifier and TypeFieldDescriptionprotected final IntBuffer[]protected intprotected final List<Pair<ByteBuffer, Integer>> protected final PriorityQueue<Pair<Integer, com.google.common.collect.PeekingIterator<T>>> -
Constructor Summary
ConstructorsConstructorDescriptionDictionaryMergingIterator(Indexed<T>[] dimValueLookups, Comparator<Pair<Integer, com.google.common.collect.PeekingIterator<T>>> comparator, boolean useDirect) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intbooleanhasNext()static <T extends Comparable<T>>
Comparator<Pair<Integer, com.google.common.collect.PeekingIterator<T>>> protected booleanneedConversion(int index) next()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, waitMethods inherited from interface org.apache.druid.java.util.common.parsers.CloseableIterator
flatMap, mapMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Field Details
-
conversions
-
directBufferAllocations
-
pQueue
protected final PriorityQueue<Pair<Integer,com.google.common.collect.PeekingIterator<T extends Comparable<T>>>> pQueue -
counter
protected int counter
-
-
Constructor Details
-
DictionaryMergingIterator
-
-
Method Details
-
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>>
-
next
- Specified by:
nextin interfaceIterator<T extends Comparable<T>>
-
getCardinality
public int getCardinality() -
transformIndexedIterator
-
needConversion
protected boolean needConversion(int index) -
writeTranslate
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-