lszskye commented on code in PR #352:
URL: https://github.com/apache/paimon-cpp/pull/352#discussion_r4091146941


##########
src/paimon/common/global_index/bitmap/bitmap_index_reader_test.cpp:
##########
@@ -0,0 +1,167 @@
+/*
+ * 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 "paimon/common/global_index/bitmap/bitmap_index_reader.h"
+
+#include <memory>
+#include <numeric>
+#include <string>
+#include <vector>
+
+#include "arrow/c/bridge.h"
+#include "arrow/ipc/api.h"
+#include "gtest/gtest.h"
+#include "paimon/common/global_index/bitmap/bitmap_global_index_writer.h"
+#include "paimon/common/global_index/key_serializer.h"
+#include "paimon/core/global_index/global_index_file_manager.h"
+#include "paimon/global_index/bitmap_global_index_result.h"
+#include "paimon/testing/mock/mock_index_path_factory.h"
+#include "paimon/testing/utils/testharness.h"
+
+namespace paimon::test {
+
+class BitmapIndexReaderTest : public ::testing::Test {
+ protected:
+    static Literal StringLiteral(const std::string& value) {
+        return Literal(FieldType::STRING, value.data(), value.size());
+    }
+
+    static void CheckResult(const Result<std::shared_ptr<GlobalIndexResult>>& 
result,
+                            const std::vector<int64_t>& expected) {
+        ASSERT_OK_AND_ASSIGN(std::shared_ptr<GlobalIndexResult> index_result, 
result);
+        std::shared_ptr<BitmapGlobalIndexResult> bitmap_result =
+            std::dynamic_pointer_cast<BitmapGlobalIndexResult>(index_result);
+        ASSERT_TRUE(bitmap_result);
+        ASSERT_OK_AND_ASSIGN(const RoaringBitmap64* bitmap, 
bitmap_result->GetBitmap());
+        ASSERT_EQ(RoaringBitmap64::From(expected), *bitmap);
+    }
+
+    void SetUp() override {
+        pool_ = GetDefaultPool();
+        test_dir_ = UniqueTestDirectory::Create("local");
+        ASSERT_TRUE(test_dir_);
+        file_manager_ = std::make_shared<GlobalIndexFileManager>(
+            test_dir_->GetFileSystem(), 
std::make_shared<MockIndexPathFactory>(test_dir_->Str()));
+        ASSERT_OK_AND_ASSIGN(compression_factory_,
+                             
BlockCompressionFactory::Create(BlockCompressionType::NONE));
+    }
+
+    Result<std::shared_ptr<BitmapGlobalIndexWriter>> CreateWriter(
+        const std::shared_ptr<arrow::Field>& field, int32_t 
dictionary_block_size = 24) {
+        std::shared_ptr<arrow::StructType> struct_type =

Review Comment:
   Use macro definitions



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to