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


##########
src/paimon/common/index/index_reader_utils.h:
##########
@@ -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.
+ */
+
+#pragma once
+
+#include <cmath>
+#include <memory>
+#include <optional>
+#include <string>
+#include <type_traits>
+#include <utility>
+#include <vector>
+
+#include "paimon/file_index/bitmap_index_result.h"
+#include "paimon/file_index/file_index_reader.h"
+#include "paimon/file_index/scored_file_index_result.h"
+#include "paimon/predicate/full_text_match.h"
+#include "paimon/predicate/function.h"
+#include "paimon/predicate/leaf_predicate.h"
+#include "paimon/predicate/predicate_utils.h"
+#include "paimon/realtime/index/realtime_index_reader.h"
+
+namespace paimon {
+
+/// Reader selection and conversion of backend results to row candidates and 
optional scores.
+class IndexReaderUtils {
+ public:
+    IndexReaderUtils() = delete;
+    ~IndexReaderUtils() = delete;
+
+    template <typename Bitmap, typename ScoredResult>
+    struct FullTextResult {
+        Bitmap rows;
+        std::shared_ptr<ScoredResult> scores;
+    };
+
+    template <typename Bitmap>
+    using FullTextScoredResult =
+        std::conditional_t<std::is_same_v<Bitmap, RoaringBitmap32>, 
ScoredFileIndexResult,
+                           ScoredRealtimeIndexResult>;
+
+    template <typename Reader>
+    static Result<std::shared_ptr<Reader>> GetSearchReader(
+        const std::vector<std::shared_ptr<Reader>>& readers,
+        IndexReaderCapabilities::SearchType type, const std::string& 
multiple_error,
+        const std::string& missing_error) {
+        std::shared_ptr<Reader> selected;
+        for (const auto& reader : readers) {
+            if (!reader) {

Review Comment:
   By the way, under what circumstances could a reader be null here? It looks 
like the upstream ReadColumnIndex only returns non-null index readers.



-- 
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