mirror of https://github.com/apache/druid.git
1) Fix some bugs found by external test suite
This commit is contained in:
parent
c8cb96b006
commit
5b1e03530c
|
@ -51,7 +51,12 @@ public class BitmapIndexColumnPartSupplier implements Supplier<BitmapIndex>
|
|||
{
|
||||
final int index = dictionary.indexOf(value);
|
||||
|
||||
return index >= 0 ? bitmaps.get(index) : EMPTY_SET;
|
||||
if (index < 0) {
|
||||
return EMPTY_SET;
|
||||
}
|
||||
|
||||
final ImmutableConciseSet bitmap = bitmaps.get(index);
|
||||
return bitmap == null ? EMPTY_SET : bitmap;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -36,25 +36,28 @@ public class ComplexColumnPartSerde implements ColumnPartSerde
|
|||
{
|
||||
@JsonCreator
|
||||
public static ComplexColumnPartSerde createDeserializer(
|
||||
@JsonProperty("complexType") String complexType
|
||||
@JsonProperty("typeName") String complexType
|
||||
)
|
||||
{
|
||||
return new ComplexColumnPartSerde(null, complexType);
|
||||
}
|
||||
|
||||
private final GenericIndexed column;
|
||||
private final String typeName;
|
||||
|
||||
private final ComplexMetricSerde serde;
|
||||
|
||||
public ComplexColumnPartSerde(GenericIndexed column, String complexType)
|
||||
public ComplexColumnPartSerde(GenericIndexed column, String typeName)
|
||||
{
|
||||
this.column = column;
|
||||
serde = ComplexMetrics.getSerdeForType(complexType);
|
||||
this.typeName = typeName;
|
||||
serde = ComplexMetrics.getSerdeForType(typeName);
|
||||
}
|
||||
|
||||
@JsonProperty
|
||||
public GenericIndexed getColumn()
|
||||
public String getTypeName()
|
||||
{
|
||||
return column;
|
||||
return typeName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -79,6 +79,7 @@ import java.util.Iterator;
|
|||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
/**
|
||||
|
@ -784,13 +785,11 @@ public class IndexMerger
|
|||
|
||||
private static <T extends Comparable> ArrayList<T> mergeIndexed(final List<Iterable<T>> indexedLists)
|
||||
{
|
||||
LinkedHashSet<T> retVal = Sets.newLinkedHashSet();
|
||||
Set<T> retVal = Sets.newTreeSet(Ordering.<T>natural().nullsFirst());
|
||||
|
||||
for (Iterable<T> indexedList : indexedLists) {
|
||||
for (T val : indexedList) {
|
||||
if (val != null) {
|
||||
retVal.add(val);
|
||||
}
|
||||
retVal.add(val);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,12 +19,14 @@
|
|||
|
||||
package com.metamx.druid.index.v1;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.io.Closeables;
|
||||
import com.metamx.common.ISE;
|
||||
import com.metamx.druid.index.QueryableIndex;
|
||||
import com.metamx.druid.index.column.BitmapIndex;
|
||||
import com.metamx.druid.index.column.Column;
|
||||
import com.metamx.druid.index.column.ComplexColumn;
|
||||
import com.metamx.druid.index.column.DictionaryEncodedColumn;
|
||||
|
@ -32,6 +34,7 @@ import com.metamx.druid.index.column.GenericColumn;
|
|||
import com.metamx.druid.index.column.ValueType;
|
||||
import com.metamx.druid.kv.ArrayBasedIndexedInts;
|
||||
import com.metamx.druid.kv.ConciseCompressedIndexedInts;
|
||||
import com.metamx.druid.kv.EmptyIndexedInts;
|
||||
import com.metamx.druid.kv.Indexed;
|
||||
import com.metamx.druid.kv.IndexedInts;
|
||||
import com.metamx.druid.kv.IndexedIterable;
|
||||
|
@ -91,7 +94,18 @@ public class QueryableIndexIndexableAdapter implements IndexableAdapter
|
|||
@Override
|
||||
public Indexed<String> getDimValueLookup(String dimension)
|
||||
{
|
||||
final DictionaryEncodedColumn dict = input.getColumn(dimension).getDictionaryEncoding();
|
||||
final Column column = input.getColumn(dimension);
|
||||
|
||||
if (column == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final DictionaryEncodedColumn dict = column.getDictionaryEncoding();
|
||||
|
||||
if (dict == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new Indexed<String>()
|
||||
{
|
||||
@Override
|
||||
|
@ -244,9 +258,18 @@ public class QueryableIndexIndexableAdapter implements IndexableAdapter
|
|||
@Override
|
||||
public IndexedInts getInverteds(String dimension, String value)
|
||||
{
|
||||
return new ConciseCompressedIndexedInts(
|
||||
input.getColumn(dimension).getBitmapIndex().getConciseSet(value)
|
||||
);
|
||||
final Column column = input.getColumn(dimension);
|
||||
|
||||
if (column == null) {
|
||||
return new EmptyIndexedInts();
|
||||
}
|
||||
|
||||
final BitmapIndex bitmaps = column.getBitmapIndex();
|
||||
if (bitmaps == null) {
|
||||
return new EmptyIndexedInts();
|
||||
}
|
||||
|
||||
return new ConciseCompressedIndexedInts(bitmaps.getConciseSet(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue