address a few more comments on roaring

This commit is contained in:
fjy 2014-11-11 17:50:03 -08:00
parent 788a4a846b
commit 5629307548
4 changed files with 9 additions and 8 deletions

View File

@ -756,6 +756,10 @@ public class IndexIO
SmooshedFileMapper smooshedFiles = Smoosh.map(inDir); SmooshedFileMapper smooshedFiles = Smoosh.map(inDir);
ByteBuffer indexBuffer = smooshedFiles.mapFile("index.drd"); ByteBuffer indexBuffer = smooshedFiles.mapFile("index.drd");
/**
* Index.drd should consist of the segment version, the columns and dimensions of the segment as generic
* indexes, the interval start and end millis as longs (in 16 bytes), and a bitmap index type.
*/
final GenericIndexed<String> cols = GenericIndexed.read(indexBuffer, GenericIndexed.stringStrategy); final GenericIndexed<String> cols = GenericIndexed.read(indexBuffer, GenericIndexed.stringStrategy);
final GenericIndexed<String> dims = GenericIndexed.read(indexBuffer, GenericIndexed.stringStrategy); final GenericIndexed<String> dims = GenericIndexed.read(indexBuffer, GenericIndexed.stringStrategy);
final Interval dataInterval = new Interval(indexBuffer.getLong(), indexBuffer.getLong()); final Interval dataInterval = new Interval(indexBuffer.getLong(), indexBuffer.getLong());
@ -768,7 +772,7 @@ public class IndexIO
if (indexBuffer.hasRemaining()) { if (indexBuffer.hasRemaining()) {
segmentBitmapSerdeFactory = mapper.readValue(serializerUtils.readString(indexBuffer), BitmapSerdeFactory.class); segmentBitmapSerdeFactory = mapper.readValue(serializerUtils.readString(indexBuffer), BitmapSerdeFactory.class);
} else { } else {
segmentBitmapSerdeFactory = BitmapSerdeFactory.DEFAULT_BITMAP_SERDE_FACTORY; segmentBitmapSerdeFactory = new ConciseBitmapSerdeFactory();
} }
Map<String, Column> columns = Maps.newHashMap(); Map<String, Column> columns = Maps.newHashMap();

View File

@ -34,8 +34,6 @@ import com.metamx.collections.bitmap.ImmutableBitmap;
public interface BitmapSerdeFactory public interface BitmapSerdeFactory
{ {
public static BitmapSerdeFactory DEFAULT_BITMAP_SERDE_FACTORY = new ConciseBitmapSerdeFactory();
public ObjectStrategy<ImmutableBitmap> getObjectStrategy(); public ObjectStrategy<ImmutableBitmap> getObjectStrategy();
public BitmapFactory getBitmapFactory(); public BitmapFactory getBitmapFactory();

View File

@ -26,7 +26,6 @@ import com.metamx.common.ISE;
import it.uniroma3.mat.extendedset.intset.ImmutableConciseSet; import it.uniroma3.mat.extendedset.intset.ImmutableConciseSet;
import it.uniroma3.mat.extendedset.intset.IntSet; import it.uniroma3.mat.extendedset.intset.IntSet;
import javax.annotation.Nullable;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.Iterator; import java.util.Iterator;
@ -65,11 +64,10 @@ public class ConciseCompressedIndexedInts implements IndexedInts, Comparable<Imm
} }
@Override @Override
public int compareTo(@Nullable ImmutableBitmap conciseCompressedIndexedInts) public int compareTo(ImmutableBitmap conciseCompressedIndexedInts)
{ {
// TODO
if (!(conciseCompressedIndexedInts instanceof WrappedImmutableConciseBitmap)) { if (!(conciseCompressedIndexedInts instanceof WrappedImmutableConciseBitmap)) {
throw new ISE("WTF bro! No, bad."); throw new ISE("Unknown class [%s]", conciseCompressedIndexedInts.getClass());
} }
return immutableConciseSet.compareTo(((WrappedImmutableConciseBitmap) conciseCompressedIndexedInts).getBitmap()); return immutableConciseSet.compareTo(((WrappedImmutableConciseBitmap) conciseCompressedIndexedInts).getBitmap());

View File

@ -30,6 +30,7 @@ import io.druid.segment.column.ColumnConfig;
import io.druid.segment.column.ValueType; import io.druid.segment.column.ValueType;
import io.druid.segment.data.BitmapSerdeFactory; import io.druid.segment.data.BitmapSerdeFactory;
import io.druid.segment.data.ByteBufferSerializer; import io.druid.segment.data.ByteBufferSerializer;
import io.druid.segment.data.ConciseBitmapSerdeFactory;
import io.druid.segment.data.GenericIndexed; import io.druid.segment.data.GenericIndexed;
import io.druid.segment.data.IndexedRTree; import io.druid.segment.data.IndexedRTree;
import io.druid.segment.data.VSizeIndexed; import io.druid.segment.data.VSizeIndexed;
@ -96,7 +97,7 @@ public class DictionaryEncodedColumnPartSerde implements ColumnPartSerde
{ {
this.isSingleValued = isSingleValued; this.isSingleValued = isSingleValued;
this.bitmapSerdeFactory = bitmapSerdeFactory == null this.bitmapSerdeFactory = bitmapSerdeFactory == null
? BitmapSerdeFactory.DEFAULT_BITMAP_SERDE_FACTORY ? new ConciseBitmapSerdeFactory()
: bitmapSerdeFactory; : bitmapSerdeFactory;
this.dictionary = null; this.dictionary = null;