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[]
conversions
protected int
counter
protected List<Pair<ByteBuffer,Integer>>
directBufferAllocations
protected 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 void
close()
int
getCardinality()
boolean
hasNext()
static <T extends Comparable<T>>
Comparator<Pair<Integer,com.google.common.collect.PeekingIterator<T>>>makePeekingComparator()
protected boolean
needConversion(int index)
T
next()
void
remove()
protected com.google.common.collect.PeekingIterator<T>
transformIndexedIterator(Indexed<T> indexed)
protected T
writeTranslate(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
-
-
-
-
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:
hasNext
in 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)
-
remove
public void remove()
- Specified by:
remove
in interfaceIterator<T extends Comparable<T>>
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
-