Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update RoaringBitmap to 0.9.49 #15006

Merged
merged 3 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion licenses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2464,7 +2464,7 @@ name: RoaringBitmap
license_category: binary
module: java-core
license_name: Apache License version 2.0
version: 0.9.0
version: 0.9.49
libraries:
- org.roaringbitmap: RoaringBitmap
- org.roaringbitmap: shims
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@
<dependency>
<groupId>org.roaringbitmap</groupId>
<artifactId>RoaringBitmap</artifactId>
<version>0.9.0</version>
<version>0.9.49</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

import com.google.common.base.Preconditions;
import org.roaringbitmap.BatchIterator;
import org.roaringbitmap.IntIterator;
import org.roaringbitmap.PeekableIntIterator;

public final class BatchIteratorAdapter implements BatchIterator
{
private final IntIterator iterator;
private final PeekableIntIterator iterator;

public BatchIteratorAdapter(IntIterator iterator)
public BatchIteratorAdapter(PeekableIntIterator iterator)
{
this.iterator = Preconditions.checkNotNull(iterator, "iterator");
}
Expand All @@ -49,6 +49,12 @@ public boolean hasNext()
return iterator.hasNext();
}

@Override
public void advanceIfNeeded(int target)
{
iterator.advanceIfNeeded(target);
}

@Override
public BatchIterator clone()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ default PeekableIntIterator peekableIterator()
*/
default BatchIterator batchIterator()
{
return new BatchIteratorAdapter(iterator());
return new BatchIteratorAdapter(peekableIterator());
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.druid.collections.bitmap;

import org.apache.druid.collections.IntSetTestUtility;
import org.junit.Assert;
import org.junit.Test;
import org.roaringbitmap.BatchIterator;

import java.util.BitSet;

public class BatchIteratorAdapterTest
{
@Test
public void advanceIfNeeded()
{
BitSet simpleBitSet = IntSetTestUtility.createSimpleBitSet(IntSetTestUtility.getSetBits());
WrappedBitSetBitmap bitSetBitmap = new WrappedBitSetBitmap(simpleBitSet);
BatchIterator batchIterator = bitSetBitmap.batchIterator();
batchIterator.advanceIfNeeded(4);
int[] batch = new int[3];
batchIterator.nextBatch(batch);
Assert.assertArrayEquals(new int[]{5, 8, 13}, batch);
}
}
Loading