This is an automated email from the ASF dual-hosted git repository.
zhangzc pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git
The following commit(s) were added to refs/heads/main by this push:
new 3d64edc7b8 [GLUTEN-8872][CH][Part-1] Support Delta Deletion Vectors
read for CH backend (#8873)
3d64edc7b8 is described below
commit 3d64edc7b8bc9087431f0fbccee781af7bbb46ef
Author: Zhichao Zhang <[email protected]>
AuthorDate: Tue Mar 4 09:54:41 2025 +0800
[GLUTEN-8872][CH][Part-1] Support Delta Deletion Vectors read for CH
backend (#8873)
* [GLUTEN-8872][CH] Support Delta Deletion Vectors read for CH backend
Support Delta Deletion Vectors read for CH backend:
Part-1: support DeltaDVRoaringBitmapArray;
---
.../Storages/SubstraitSource/CMakeLists.txt | 9 +-
.../Delta/Bitmap/DeltaDVRoaringBitmapArray.cpp | 169 +++++++++++++++
.../Delta/Bitmap/DeltaDVRoaringBitmapArray.h | 55 +++++
.../SubstraitSource/Delta/DeltaParquetMeta.h | 44 ++++
.../tests/data/deletion_vector_long_values.bin | Bin 0 -> 4056 bytes
.../tests/data/deletion_vector_multiple.bin | Bin 0 -> 852865 bytes
.../tests/data/deletion_vector_only_one.bin | Bin 0 -> 548 bytes
.../tests/gtest_clickhouse_roaring_bitmap.cpp | 226 +++++++++++++++++++++
8 files changed, 500 insertions(+), 3 deletions(-)
diff --git a/cpp-ch/local-engine/Storages/SubstraitSource/CMakeLists.txt
b/cpp-ch/local-engine/Storages/SubstraitSource/CMakeLists.txt
index d579156411..5783898bc6 100644
--- a/cpp-ch/local-engine/Storages/SubstraitSource/CMakeLists.txt
+++ b/cpp-ch/local-engine/Storages/SubstraitSource/CMakeLists.txt
@@ -16,6 +16,8 @@
set(ARROW_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/arrow/cpp/src")
add_headers_and_sources(substrait_source .)
+add_headers_and_sources(substrait_source Delta)
+add_headers_and_sources(substrait_source Delta/Bitmap)
add_headers_and_sources(substrait_source iceberg)
add_library(substrait_source ${substrait_source_sources})
@@ -24,12 +26,13 @@ target_compile_options(
-Wno-inconsistent-missing-destructor-override)
if(ENABLE_HDFS)
target_link_libraries(
- substrait_source PUBLIC boost::headers_only ch_contrib::protobuf
- clickhouse_common_io ch_contrib::hdfs substrait)
+ substrait_source
+ PUBLIC boost::headers_only ch_contrib::protobuf clickhouse_common_io
+ ch_contrib::hdfs substrait ch_contrib::roaring)
else()
target_link_libraries(
substrait_source PUBLIC boost::headers_only ch_contrib::protobuf
- clickhouse_common_io substrait)
+ clickhouse_common_io substrait ch_contrib::roaring)
endif()
target_include_directories(
substrait_source SYSTEM BEFORE
diff --git
a/cpp-ch/local-engine/Storages/SubstraitSource/Delta/Bitmap/DeltaDVRoaringBitmapArray.cpp
b/cpp-ch/local-engine/Storages/SubstraitSource/Delta/Bitmap/DeltaDVRoaringBitmapArray.cpp
new file mode 100644
index 0000000000..d0c7a06e0e
--- /dev/null
+++
b/cpp-ch/local-engine/Storages/SubstraitSource/Delta/Bitmap/DeltaDVRoaringBitmapArray.cpp
@@ -0,0 +1,169 @@
+/*
+ * 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.
+ */
+#include <IO/ReadHelpers.h>
+#include <IO/WriteHelpers.h>
+#include <zlib.h>
+#include <IO/ReadBufferFromFile.h>
+#include <Common/PODArray.h>
+#include <roaring.hh>
+#include <Poco/URI.h>
+#include <Storages/SubstraitSource/Delta/Bitmap/DeltaDVRoaringBitmapArray.h>
+
+namespace DB
+{
+namespace ErrorCodes
+{
+extern const int TOO_LARGE_ARRAY_SIZE;
+extern const int INCORRECT_DATA;
+extern const int BAD_ARGUMENTS;
+}
+}
+
+namespace local_engine
+{
+using namespace DB;
+
+std::pair<UInt32, UInt32>
DeltaDVRoaringBitmapArray::decompose_high_low_bytes(UInt64 value) {
+ return {static_cast<UInt32>(value >> 32), static_cast<UInt32>(value &
0xFFFFFFFF)};
+}
+
+UInt64 DeltaDVRoaringBitmapArray::compose_from_high_low_bytes(UInt32 high,
UInt32 low) {
+ return (static_cast<uint64_t>(high) << 32) | low;
+}
+
+DeltaDVRoaringBitmapArray::DeltaDVRoaringBitmapArray(
+ const DB::ContextPtr & context_) : context(context_)
+{
+}
+
+void DeltaDVRoaringBitmapArray::rb_read(const String & file_path, const Int32
offset, const Int32 data_size)
+{
+ // TODO: use `ReadBufferBuilderFactory::instance().createBuilder` to
create hdfs/local/s3 ReadBuffer
+ const Poco::URI file_uri(file_path);
+ ReadBufferFromFile in(file_uri.getPath());
+
+ in.seek(offset, SEEK_SET);
+
+ int size;
+ readBinaryBigEndian(size, in);
+
+ if (data_size != size)
+ throw DB::Exception(DB::ErrorCodes::BAD_ARGUMENTS, "The size of the
deletion vector is mismatch.");
+
+ int checksum_value = static_cast<Int32>(crc32_z(0L,
reinterpret_cast<unsigned char*>(in.position()), size));
+
+ int magic_num;
+ readBinaryLittleEndian(magic_num, in);
+ if (magic_num != 1681511377)
+ throw DB::Exception(DB::ErrorCodes::BAD_ARGUMENTS, "The magic num is
mismatch.");
+
+ int64_t bitmap_array_size;
+ readBinaryLittleEndian(bitmap_array_size, in);
+
+ roaring_bitmap_array.reserve(bitmap_array_size);
+ for (size_t i = 0; i < bitmap_array_size; ++i)
+ {
+ int bitmap_index;
+ readBinaryLittleEndian(bitmap_index, in);
+ roaring::Roaring r = roaring::Roaring::read(in.position());
+ size_t current_bitmap_size = r.getSizeInBytes();
+ in.ignore(current_bitmap_size);
+ roaring_bitmap_array.push_back(r);
+ }
+ int expected_checksum;
+ readBinaryBigEndian(expected_checksum, in);
+ if (expected_checksum != checksum_value)
+ throw DB::Exception(DB::ErrorCodes::BAD_ARGUMENTS, "Checksum
mismatch.");
+}
+
+UInt64 DeltaDVRoaringBitmapArray::rb_size() const
+{
+ UInt64 sum = 0;
+ for (const auto & r : roaring_bitmap_array)
+ {
+ sum += r.cardinality();
+ }
+ return sum;
+}
+
+bool DeltaDVRoaringBitmapArray::rb_contains(Int64 x) const
+{
+ auto [high, low] = decompose_high_low_bytes(x);
+ if (high >= roaring_bitmap_array.size())
+ return false;
+
+ return roaring_bitmap_array[high].contains(low);
+}
+
+void DeltaDVRoaringBitmapArray::rb_clear()
+{
+ std::vector<roaring::Roaring>().swap(roaring_bitmap_array);
+}
+
+bool DeltaDVRoaringBitmapArray::rb_is_empty() const
+{
+ return std::ranges::all_of(roaring_bitmap_array.begin(),
roaring_bitmap_array.end(),
+ [](const auto& rb) { return rb.isEmpty(); });
+}
+
+void DeltaDVRoaringBitmapArray::rb_add(Int64 x)
+{
+ const UInt64 value = static_cast<UInt64>(x);
+ assert(value >= 0 && value <= MAX_REPRESENTABLE_VALUE);
+ auto [high, low] = decompose_high_low_bytes(value);
+ if (high >= roaring_bitmap_array.size())
+ {
+ rb_extend_bitmaps(high + 1);
+ }
+ roaring_bitmap_array[high].add(low);
+}
+
+void DeltaDVRoaringBitmapArray::rb_extend_bitmaps(Int32 new_length)
+{
+ if (roaring_bitmap_array.size() >= new_length) return;
+ roaring_bitmap_array.resize(new_length);
+}
+
+void DeltaDVRoaringBitmapArray::rb_shrink_bitmaps(Int32 new_length)
+{
+ if (roaring_bitmap_array.size() <= new_length) return;
+ roaring_bitmap_array.resize(new_length);
+}
+
+void DeltaDVRoaringBitmapArray::rb_merge(const DeltaDVRoaringBitmapArray &
that)
+{
+ return rb_or(that);
+}
+void DeltaDVRoaringBitmapArray::rb_or(const DeltaDVRoaringBitmapArray & that)
+{
+ if (roaring_bitmap_array.size() < that.roaring_bitmap_array.size()) {
+ rb_extend_bitmaps(that.roaring_bitmap_array.size());
+ }
+ const Int32 count = that.roaring_bitmap_array.size();
+ for (Int32 i = 0; i < count; ++i)
+ {
+ roaring_bitmap_array[i] |= that.roaring_bitmap_array[i];
+ }
+}
+bool DeltaDVRoaringBitmapArray::operator==(const DeltaDVRoaringBitmapArray &
other) const
+{
+ if (this == &other) {
+ return true;
+ }
+ return roaring_bitmap_array == other.roaring_bitmap_array;
+}
+}
\ No newline at end of file
diff --git
a/cpp-ch/local-engine/Storages/SubstraitSource/Delta/Bitmap/DeltaDVRoaringBitmapArray.h
b/cpp-ch/local-engine/Storages/SubstraitSource/Delta/Bitmap/DeltaDVRoaringBitmapArray.h
new file mode 100644
index 0000000000..f8315a1cc5
--- /dev/null
+++
b/cpp-ch/local-engine/Storages/SubstraitSource/Delta/Bitmap/DeltaDVRoaringBitmapArray.h
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+#include <IO/ReadHelpers.h>
+#include <IO/WriteHelpers.h>
+#include <Common/PODArray.h>
+#include <roaring.hh>
+
+namespace local_engine
+{
+/**
+ * Roaring bitmap data.
+ * For a description of the roaring_bitmap_t, see:
https://github.com/RoaringBitmap/CRoaring
+ */
+class DeltaDVRoaringBitmapArray : private boost::noncopyable
+{
+private:
+ const Int64 MAX_REPRESENTABLE_VALUE =
+ (static_cast<UInt64>(INT32_MAX - 1) << 32) |
(static_cast<UInt64>(INT32_MIN) & 0xFFFFFFFFL);
+ DB::ContextPtr context;
+ std::vector<roaring::Roaring> roaring_bitmap_array;
+
+ static std::pair<UInt32, UInt32> decompose_high_low_bytes(UInt64 value);
+ static UInt64 compose_from_high_low_bytes(UInt32 high, UInt32 low);
+ void rb_extend_bitmaps(Int32 new_length);
+ void rb_shrink_bitmaps(Int32 new_length);
+public:
+
+ DeltaDVRoaringBitmapArray(const DB::ContextPtr & context_);
+ ~DeltaDVRoaringBitmapArray() = default;
+ bool operator==(const DeltaDVRoaringBitmapArray& other) const;
+ UInt64 rb_size() const;
+ void rb_read(const String & file_path, const Int32 offset, const Int32
data_size);
+ bool rb_contains(Int64 x) const;
+ bool rb_is_empty() const;
+ void rb_clear();
+ void rb_add(Int64 value);
+ void rb_merge(const DeltaDVRoaringBitmapArray & that);
+ void rb_or(const DeltaDVRoaringBitmapArray & that);
+};
+
+}
\ No newline at end of file
diff --git
a/cpp-ch/local-engine/Storages/SubstraitSource/Delta/DeltaParquetMeta.h
b/cpp-ch/local-engine/Storages/SubstraitSource/Delta/DeltaParquetMeta.h
new file mode 100644
index 0000000000..d4d6a786b6
--- /dev/null
+++ b/cpp-ch/local-engine/Storages/SubstraitSource/Delta/DeltaParquetMeta.h
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+#pragma once
+
+#include <Core/Block.h>
+
+namespace local_engine
+{
+namespace DeltaParquetVirtualMeta
+{
+inline constexpr auto DELTA_INTERNAL_IS_ROW_DELETED =
"__delta_internal_is_row_deleted";
+inline bool hasMetaColumns(const DB::Block & header)
+{
+ return header.findByName(DELTA_INTERNAL_IS_ROW_DELETED) != nullptr;
+}
+inline DB::DataTypePtr getMetaColumnType(const DB::Block & header)
+{
+ return header.findByName(DELTA_INTERNAL_IS_ROW_DELETED)->type;
+}
+inline DB::Block removeMetaColumns(const DB::Block & header)
+{
+ DB::Block new_header;
+ for (const auto & col : header)
+ if (col.name != DELTA_INTERNAL_IS_ROW_DELETED)
+ new_header.insert(col);
+ return new_header;
+}
+}
+
+}
\ No newline at end of file
diff --git a/cpp-ch/local-engine/tests/data/deletion_vector_long_values.bin
b/cpp-ch/local-engine/tests/data/deletion_vector_long_values.bin
new file mode 100644
index 0000000000..3b082f8ac1
Binary files /dev/null and
b/cpp-ch/local-engine/tests/data/deletion_vector_long_values.bin differ
diff --git a/cpp-ch/local-engine/tests/data/deletion_vector_multiple.bin
b/cpp-ch/local-engine/tests/data/deletion_vector_multiple.bin
new file mode 100644
index 0000000000..7168d42b83
Binary files /dev/null and
b/cpp-ch/local-engine/tests/data/deletion_vector_multiple.bin differ
diff --git a/cpp-ch/local-engine/tests/data/deletion_vector_only_one.bin
b/cpp-ch/local-engine/tests/data/deletion_vector_only_one.bin
new file mode 100644
index 0000000000..9ccfd9ae5c
Binary files /dev/null and
b/cpp-ch/local-engine/tests/data/deletion_vector_only_one.bin differ
diff --git a/cpp-ch/local-engine/tests/gtest_clickhouse_roaring_bitmap.cpp
b/cpp-ch/local-engine/tests/gtest_clickhouse_roaring_bitmap.cpp
new file mode 100644
index 0000000000..01cc015147
--- /dev/null
+++ b/cpp-ch/local-engine/tests/gtest_clickhouse_roaring_bitmap.cpp
@@ -0,0 +1,226 @@
+/*
+ * 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.
+ */
+#include <tests/utils/gluten_test_util.h>
+#include <iostream>
+#include <Core/Settings.h>
+#include <Interpreters/Context.h>
+#include <Parser/SerializedPlanParser.h>
+#include <gtest/gtest.h>
+#include <Common/QueryContext.h>
+#include <zlib.h>
+#include <Storages/SubstraitSource/ReadBufferBuilder.h>
+#include <roaring.hh>
+#include <Storages/SubstraitSource/Delta/Bitmap/DeltaDVRoaringBitmapArray.h>
+
+namespace DB::Setting
+{
+extern const SettingsBool enable_named_columns_in_function_tuple;
+}
+using namespace local_engine;
+
+using namespace DB;
+
+TEST(Delta_DV, roaring_bitmap_test)
+{
+ const auto context =
DB::Context::createCopy(QueryContext::globalContext());
+
+ const Poco::URI file_uri(test::gtest_data("deletion_vector_only_one.bin"));
+
+ ReadBufferFromFile in(file_uri.getPath());
+
+ char a;
+ readBinary(a, in);
+ EXPECT_EQ('\x01', a);
+
+ int size;
+ readBinaryBigEndian(size, in);
+ EXPECT_EQ(539, size);
+
+ int magic_num;
+ readBinaryLittleEndian(magic_num, in);
+ EXPECT_EQ(1681511377, magic_num);
+
+ int64_t bitmap_array_size;
+ readBinaryLittleEndian(bitmap_array_size, in);
+ EXPECT_EQ(1, bitmap_array_size);
+
+ std::vector<roaring::Roaring> roaring_bitmap_array;
+ roaring_bitmap_array.reserve(bitmap_array_size);
+
+ for (size_t i = 0; i < bitmap_array_size; ++i)
+ {
+ int bitmap_index;
+ readBinaryLittleEndian(bitmap_index, in);
+ roaring::Roaring r = roaring::Roaring::read(in.position());
+ size_t current_bitmap_size = r.getSizeInBytes();
+ in.ignore(current_bitmap_size);
+ roaring_bitmap_array.push_back(r);
+
+ int check_sum;
+ readBinaryBigEndian(check_sum, in);
+ EXPECT_EQ(1722047305, check_sum);
+
+ EXPECT_TRUE(r.contains(0));
+ EXPECT_TRUE(r.contains(1003));
+ EXPECT_TRUE(r.contains(666));
+ EXPECT_FALSE(r.contains(6));
+ EXPECT_FALSE(r.contains(26));
+ EXPECT_FALSE(r.contains(188));
+ }
+}
+
+TEST(Delta_DV, multi_roaring_bitmap_test)
+{
+ const auto context =
DB::Context::createCopy(QueryContext::globalContext());
+
+ const Poco::URI file_uri(test::gtest_data("deletion_vector_multiple.bin"));
+
+ ReadBufferFromFile in(file_uri.getPath());
+
+ in.seek(426433, SEEK_SET);
+
+ int size;
+ readBinaryBigEndian(size, in);
+ EXPECT_EQ(426424, size);
+
+ int checksum_value = static_cast<Int32>(crc32_z(0L,
reinterpret_cast<unsigned char*>(in.position()), size));
+
+ int magic_num;
+ readBinaryLittleEndian(magic_num, in);
+ EXPECT_EQ(1681511377, magic_num);
+
+ int64_t bitmap_array_size;
+ readBinaryLittleEndian(bitmap_array_size, in);
+ EXPECT_EQ(1, bitmap_array_size);
+
+ std::vector<roaring::Roaring> roaring_bitmap_array;
+ roaring_bitmap_array.reserve(bitmap_array_size);
+
+ for (size_t i = 0; i < bitmap_array_size; ++i)
+ {
+ int bitmap_index;
+ readBinaryLittleEndian(bitmap_index, in);
+ roaring::Roaring r = roaring::Roaring::read(in.position());
+ size_t current_bitmap_size = r.getSizeInBytes();
+ in.ignore(current_bitmap_size);
+ roaring_bitmap_array.push_back(r);
+
+ EXPECT_TRUE(r.contains(5));
+ EXPECT_TRUE(r.contains(3618));
+ EXPECT_TRUE(r.contains(155688));
+ EXPECT_FALSE(r.contains(3));
+ EXPECT_FALSE(r.contains(6886));
+ EXPECT_FALSE(r.contains(129900));
+ }
+
+ int expected_checksum;
+ readBinaryBigEndian(expected_checksum, in);
+ EXPECT_EQ(expected_checksum, checksum_value);
+}
+
+TEST(Delta_DV, DeltaDVRoaringBitmapArray)
+{
+ const auto context =
DB::Context::createCopy(QueryContext::globalContext());
+
+ const Poco::URI file_uri(test::gtest_data("deletion_vector_multiple.bin"));
+ const Poco::URI
file_uri1(test::gtest_data("deletion_vector_only_one.bin"));
+
+ local_engine::DeltaDVRoaringBitmapArray bitmap_array(context);
+ bitmap_array.rb_read(file_uri.getPath(), 426433, 426424);
+ EXPECT_TRUE(bitmap_array.rb_contains(5));
+ EXPECT_TRUE(bitmap_array.rb_contains(3618));
+ EXPECT_TRUE(bitmap_array.rb_contains(155688));
+ EXPECT_FALSE(bitmap_array.rb_contains(3));
+ EXPECT_FALSE(bitmap_array.rb_contains(6886));
+ EXPECT_FALSE(bitmap_array.rb_contains(129900));
+ EXPECT_FALSE(bitmap_array.rb_contains(0));
+ EXPECT_FALSE(bitmap_array.rb_contains(1003));
+ EXPECT_FALSE(bitmap_array.rb_contains(880));
+
+ bitmap_array.rb_add(3000000000);
+ EXPECT_TRUE(bitmap_array.rb_contains(3000000000));
+ bitmap_array.rb_add(5000000000);
+ EXPECT_TRUE(bitmap_array.rb_contains(5000000000));
+ bitmap_array.rb_add(10000000000);
+ EXPECT_TRUE(bitmap_array.rb_contains(10000000000));
+
+ local_engine::DeltaDVRoaringBitmapArray bitmap_array1(context);
+ bitmap_array1.rb_read(file_uri1.getPath(), 1, 539);
+ EXPECT_TRUE(bitmap_array1.rb_contains(0));
+ EXPECT_TRUE(bitmap_array1.rb_contains(1003));
+ EXPECT_TRUE(bitmap_array1.rb_contains(880));
+ EXPECT_FALSE(bitmap_array1.rb_contains(6));
+ EXPECT_FALSE(bitmap_array1.rb_contains(26));
+ EXPECT_FALSE(bitmap_array1.rb_contains(188));
+
+ bitmap_array.rb_merge(bitmap_array1);
+ EXPECT_TRUE(bitmap_array.rb_contains(0));
+ EXPECT_TRUE(bitmap_array.rb_contains(1003));
+ EXPECT_TRUE(bitmap_array.rb_contains(880));
+
+ const Poco::URI
file_uri2(test::gtest_data("deletion_vector_long_values.bin"));
+
+ local_engine::DeltaDVRoaringBitmapArray bitmap_array2(context);
+ bitmap_array2.rb_read(file_uri2.getPath(), 1, 4047);
+ EXPECT_FALSE(bitmap_array2.rb_is_empty());
+ EXPECT_EQ(2098, bitmap_array2.rb_size());
+ EXPECT_TRUE(bitmap_array2.rb_contains(0));
+ EXPECT_TRUE(bitmap_array2.rb_contains(1003));
+ EXPECT_TRUE(bitmap_array2.rb_contains(880));
+ Int64 v = 2000000010;
+ EXPECT_TRUE(bitmap_array2.rb_contains(v));
+ UInt64 vv = 2000000010;
+ EXPECT_TRUE(bitmap_array2.rb_contains(vv));
+ v = 3000000990;
+ EXPECT_TRUE(bitmap_array2.rb_contains(v));
+ vv = 3000000990;
+ EXPECT_TRUE(bitmap_array2.rb_contains(vv));
+ v = 3000000990;
+ EXPECT_TRUE(bitmap_array2.rb_contains(v));
+ vv = 3000000990;
+ EXPECT_TRUE(bitmap_array2.rb_contains(vv));
+ v = 5000000298;
+ EXPECT_TRUE(bitmap_array2.rb_contains(v));
+ vv = 5000000298;
+ EXPECT_TRUE(bitmap_array2.rb_contains(vv));
+ v = 10000000099;
+ EXPECT_TRUE(bitmap_array2.rb_contains(v));
+ vv = 10000000099;
+ EXPECT_TRUE(bitmap_array2.rb_contains(vv));
+ v = 100000000050;
+ EXPECT_TRUE(bitmap_array2.rb_contains(v));
+ vv = 100000000050;
+ EXPECT_TRUE(bitmap_array2.rb_contains(vv));
+
+ EXPECT_FALSE(bitmap_array2.rb_contains(6));
+ EXPECT_FALSE(bitmap_array2.rb_contains(26));
+ EXPECT_FALSE(bitmap_array2.rb_contains(188));
+
+ bitmap_array2.rb_clear();
+ EXPECT_TRUE(bitmap_array2.rb_is_empty());
+
+ DeltaDVRoaringBitmapArray bitmap_array3(context);
+ bitmap_array3.rb_add(3000000000);
+ bitmap_array3.rb_add(5000000000);
+ bitmap_array3.rb_add(10000000000);
+ EXPECT_TRUE(bitmap_array3.rb_contains(3000000000));
+ EXPECT_TRUE(bitmap_array3.rb_contains(5000000000));
+ EXPECT_TRUE(bitmap_array3.rb_contains(10000000000));
+ EXPECT_FALSE(bitmap_array3.rb_contains(10000000001));
+ EXPECT_FALSE(bitmap_array3.rb_contains(5000000001));
+ EXPECT_FALSE(bitmap_array3.rb_contains(3000000001));
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]