KYLIN-2387 remove the usage of ImmutableRoaringBitmap.bitmapOf to be compatible with older version of roaringbitmap
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/e8944650 Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/e8944650 Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/e8944650 Branch: refs/heads/master-cdh5.7 Commit: e894465007f422d619ddeab2acd87e38fa093fd9 Parents: f182670 Author: gaodayue <gaoda...@meituan.com> Authored: Tue Jan 17 18:39:01 2017 +0800 Committer: gaodayue <gaoda...@meituan.com> Committed: Tue Jan 17 18:39:01 2017 +0800 ---------------------------------------------------------------------- .../apache/kylin/measure/bitmap/BitmapSerializer.java | 2 +- .../kylin/measure/bitmap/ImmutableBitmapCounter.java | 4 ---- .../kylin/measure/bitmap/BitmapAggregatorTest.java | 6 +++--- .../apache/kylin/measure/bitmap/BitmapCounterTest.java | 12 +++++++----- .../kylin/measure/bitmap/BitmapSerializerTest.java | 7 ++++--- 5 files changed, 15 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/e8944650/core-metadata/src/main/java/org/apache/kylin/measure/bitmap/BitmapSerializer.java ---------------------------------------------------------------------- diff --git a/core-metadata/src/main/java/org/apache/kylin/measure/bitmap/BitmapSerializer.java b/core-metadata/src/main/java/org/apache/kylin/measure/bitmap/BitmapSerializer.java index 8b15d1c..0e970de 100644 --- a/core-metadata/src/main/java/org/apache/kylin/measure/bitmap/BitmapSerializer.java +++ b/core-metadata/src/main/java/org/apache/kylin/measure/bitmap/BitmapSerializer.java @@ -25,7 +25,7 @@ import java.io.IOException; import java.nio.ByteBuffer; public class BitmapSerializer extends DataTypeSerializer<BitmapCounter> { - private static final BitmapCounter DELEGATE = new ImmutableBitmapCounter(); + private static final BitmapCounter DELEGATE = new MutableBitmapCounter(); // called by reflection public BitmapSerializer(DataType type) { http://git-wip-us.apache.org/repos/asf/kylin/blob/e8944650/core-metadata/src/main/java/org/apache/kylin/measure/bitmap/ImmutableBitmapCounter.java ---------------------------------------------------------------------- diff --git a/core-metadata/src/main/java/org/apache/kylin/measure/bitmap/ImmutableBitmapCounter.java b/core-metadata/src/main/java/org/apache/kylin/measure/bitmap/ImmutableBitmapCounter.java index 5c39a4a..753f089 100644 --- a/core-metadata/src/main/java/org/apache/kylin/measure/bitmap/ImmutableBitmapCounter.java +++ b/core-metadata/src/main/java/org/apache/kylin/measure/bitmap/ImmutableBitmapCounter.java @@ -34,10 +34,6 @@ public class ImmutableBitmapCounter implements BitmapCounter { protected ImmutableRoaringBitmap bitmap; - public ImmutableBitmapCounter() { - this(ImmutableRoaringBitmap.bitmapOf()); - } - public ImmutableBitmapCounter(ImmutableRoaringBitmap bitmap) { this.bitmap = bitmap; } http://git-wip-us.apache.org/repos/asf/kylin/blob/e8944650/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapAggregatorTest.java ---------------------------------------------------------------------- diff --git a/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapAggregatorTest.java b/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapAggregatorTest.java index 03eb53a..a52e427 100644 --- a/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapAggregatorTest.java +++ b/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapAggregatorTest.java @@ -19,7 +19,7 @@ package org.apache.kylin.measure.bitmap; import org.junit.Test; -import org.roaringbitmap.buffer.ImmutableRoaringBitmap; +import org.roaringbitmap.buffer.MutableRoaringBitmap; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; @@ -32,12 +32,12 @@ public class BitmapAggregatorTest { assertNull(null, aggregator.getState()); aggregator.aggregate(new ImmutableBitmapCounter( - ImmutableRoaringBitmap.bitmapOf(10, 20, 30, 40) + MutableRoaringBitmap.bitmapOf(10, 20, 30, 40) )); assertEquals(4, aggregator.getState().getCount()); aggregator.aggregate(new ImmutableBitmapCounter( - ImmutableRoaringBitmap.bitmapOf(25, 30, 35, 40, 45) + MutableRoaringBitmap.bitmapOf(25, 30, 35, 40, 45) )); assertEquals(7, aggregator.getState().getCount()); http://git-wip-us.apache.org/repos/asf/kylin/blob/e8944650/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapCounterTest.java ---------------------------------------------------------------------- diff --git a/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapCounterTest.java b/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapCounterTest.java index 70e4ecc..ee7733f 100644 --- a/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapCounterTest.java +++ b/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapCounterTest.java @@ -19,7 +19,7 @@ package org.apache.kylin.measure.bitmap; import org.junit.Test; -import org.roaringbitmap.buffer.ImmutableRoaringBitmap; +import org.roaringbitmap.buffer.MutableRoaringBitmap; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; @@ -29,8 +29,9 @@ public class BitmapCounterTest { @Test public void testBitmapCounter() { - ImmutableRoaringBitmap bitmap = ImmutableRoaringBitmap.bitmapOf(10, 20, 30, 1000); - ImmutableBitmapCounter counter = new ImmutableBitmapCounter(bitmap); + ImmutableBitmapCounter counter = new ImmutableBitmapCounter( + MutableRoaringBitmap.bitmapOf(10, 20, 30, 1000) + ); assertEquals(4, counter.getCount()); assertTrue(counter.getMemBytes() > 0); @@ -59,8 +60,9 @@ public class BitmapCounterTest { @Test public void testToMutableBitmapCounter() { - ImmutableRoaringBitmap bitmap = ImmutableRoaringBitmap.bitmapOf(10, 20, 30, 1000); - ImmutableBitmapCounter immutable = new ImmutableBitmapCounter(bitmap); + ImmutableBitmapCounter immutable = new ImmutableBitmapCounter( + MutableRoaringBitmap.bitmapOf(10, 20, 30, 1000) + ); MutableBitmapCounter mutable = new MutableBitmapCounter(); mutable.orWith(immutable); http://git-wip-us.apache.org/repos/asf/kylin/blob/e8944650/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapSerializerTest.java ---------------------------------------------------------------------- diff --git a/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapSerializerTest.java b/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapSerializerTest.java index 71fcae6..e5b828d 100644 --- a/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapSerializerTest.java +++ b/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapSerializerTest.java @@ -24,7 +24,7 @@ import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; -import org.roaringbitmap.buffer.ImmutableRoaringBitmap; +import org.roaringbitmap.buffer.MutableRoaringBitmap; import java.nio.BufferOverflowException; import java.nio.ByteBuffer; @@ -47,8 +47,9 @@ public class BitmapSerializerTest extends LocalFileMetadataTestCase { public void testBitmapSerDe() { BitmapSerializer serializer = new BitmapSerializer(DataType.ANY); - ImmutableRoaringBitmap bitmap = ImmutableRoaringBitmap.bitmapOf(1, 1234, 5678, 100000); - ImmutableBitmapCounter counter = new ImmutableBitmapCounter(bitmap); + ImmutableBitmapCounter counter = new ImmutableBitmapCounter( + MutableRoaringBitmap.bitmapOf(1, 1234, 5678, 100000) + ); ByteBuffer buffer = ByteBuffer.allocate(1024 * 1024); serializer.serialize(counter, buffer);