Skip to content

Commit 48b8cbb

Browse files
authored
Merge branch 'main' into feature/columnar-row-ref
2 parents 6100eb6 + 2016e9f commit 48b8cbb

38 files changed

Lines changed: 739 additions & 229 deletions

cmake_modules/ThirdpartyToolchain.cmake

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ macro(build_lucene)
292292
set(LUCENE_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/lucene_ep-install")
293293
set(LUCENE_CMAKE_ARGS
294294
${EP_COMMON_CMAKE_ARGS}
295+
"-DLUCENE_BUILD_SHARED=OFF"
295296
"-DENABLE_TEST=OFF"
296297
"-DCMAKE_C_FLAGS=-pthread"
297298
"-DCMAKE_CXX_FLAGS=-pthread"
@@ -303,7 +304,7 @@ macro(build_lucene)
303304
"-DBoost_THREAD_FOUND=TRUE"
304305
"-DCMAKE_INSTALL_PREFIX=${LUCENE_PREFIX}")
305306

306-
set(LUCENE_LIB "${LUCENE_PREFIX}/lib/liblucene++.so.0")
307+
set(LUCENE_LIB "${LUCENE_PREFIX}/lib/liblucene++.a")
307308
externalproject_add(lucene_ep
308309
${EP_COMMON_OPTIONS}
309310
URL ${LUCENE_SOURCE_URL}
@@ -323,13 +324,14 @@ macro(build_lucene)
323324
# The include directory must exist before it is referenced by a target.
324325
file(MAKE_DIRECTORY "${LUCENE_INCLUDE_DIR}")
325326
include_directories(SYSTEM ${LUCENE_INCLUDE_DIR} ${BOOST_INCLUDE_DIR})
326-
add_library(lucene INTERFACE IMPORTED)
327-
target_include_directories(lucene SYSTEM INTERFACE "${LUCENE_INCLUDE_DIR}")
328-
target_compile_options(lucene INTERFACE -pthread)
327+
add_library(lucene STATIC IMPORTED)
328+
set_target_properties(lucene
329+
PROPERTIES IMPORTED_LOCATION "${LUCENE_LIB}"
330+
INTERFACE_INCLUDE_DIRECTORIES
331+
"${LUCENE_INCLUDE_DIR}")
329332

330333
target_link_libraries(lucene
331-
INTERFACE "${LUCENE_LIB}"
332-
boost_date_time
334+
INTERFACE boost_date_time
333335
boost_filesystem
334336
boost_regex
335337
boost_thread

include/paimon/file_store_write.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class PAIMON_EXPORT FileStoreWrite {
4747
virtual ~FileStoreWrite() = default;
4848

4949
/// Support write an input `RecordBatch` to internal buffer or file.
50+
/// @note If a field in table schema is marked as non-nullable (`nullable = false`),
51+
/// the corresponding array in `batch` must have zero null entries.
5052
virtual Status Write(std::unique_ptr<RecordBatch>&& batch) = 0;
5153

5254
/// Generate a list of commit messages with the latest generated data file meta

include/paimon/global_index/bitmap_vector_search_global_index_result.h renamed to include/paimon/global_index/bitmap_scored_global_index_result.h

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024-present Alibaba Inc.
2+
* Copyright 2026-present Alibaba Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,25 +26,24 @@
2626
#include "paimon/visibility.h"
2727

2828
namespace paimon {
29-
/// Represents a vector search global index result that combines a Roaring bitmap of candidate row
29+
/// Represents a scored global index result that combines a Roaring bitmap of candidate row
3030
/// ids with an array of associated relevance scores.
3131
///
32-
/// **Important Ordering Note**: Despite inheriting from VectorSearchGlobalIndexResult, the results
33-
/// are
32+
/// **Important Ordering Note**: Inheriting from ScoredGlobalIndexResult, the results are
3433
/// **NOT sorted by score**. Instead, both the bitmap and the score vector are ordered by
3534
/// **ascending row id**. This design enables efficient merging and set operations while preserving
3635
/// row id-to-score mapping.
37-
class PAIMON_EXPORT BitmapVectorSearchGlobalIndexResult : public VectorSearchGlobalIndexResult {
36+
class PAIMON_EXPORT BitmapScoredGlobalIndexResult : public ScoredGlobalIndexResult {
3837
public:
39-
BitmapVectorSearchGlobalIndexResult(RoaringBitmap64&& bitmap, std::vector<float>&& scores)
38+
BitmapScoredGlobalIndexResult(RoaringBitmap64&& bitmap, std::vector<float>&& scores)
4039
: bitmap_(std::move(bitmap)), scores_(std::move(scores)) {
4140
assert(static_cast<size_t>(bitmap_.Cardinality()) == scores_.size());
4241
}
4342

44-
class VectorSearchIterator : public VectorSearchGlobalIndexResult::VectorSearchIterator {
43+
class ScoredIterator : public ScoredGlobalIndexResult::ScoredIterator {
4544
public:
46-
VectorSearchIterator(const RoaringBitmap64* bitmap, RoaringBitmap64::Iterator&& iter,
47-
const float* scores)
45+
ScoredIterator(const RoaringBitmap64* bitmap, RoaringBitmap64::Iterator&& iter,
46+
const float* scores)
4847
: bitmap_(bitmap), iter_(std::move(iter)), scores_(scores) {}
4948

5049
bool HasNext() const override {
@@ -66,8 +65,8 @@ class PAIMON_EXPORT BitmapVectorSearchGlobalIndexResult : public VectorSearchGlo
6665

6766
Result<std::unique_ptr<GlobalIndexResult::Iterator>> CreateIterator() const override;
6867

69-
Result<std::unique_ptr<VectorSearchGlobalIndexResult::VectorSearchIterator>>
70-
CreateVectorSearchIterator() const override;
68+
Result<std::unique_ptr<ScoredGlobalIndexResult::ScoredIterator>> CreateScoredIterator()
69+
const override;
7170

7271
Result<std::shared_ptr<GlobalIndexResult>> And(
7372
const std::shared_ptr<GlobalIndexResult>& other) override;
@@ -90,7 +89,6 @@ class PAIMON_EXPORT BitmapVectorSearchGlobalIndexResult : public VectorSearchGlo
9089
const std::vector<float>& GetScores() const;
9190

9291
private:
93-
// TODO(xinyu.lxy): may use pair<int64_t, float>
9492
RoaringBitmap64 bitmap_;
9593
// ordered by row id
9694
std::vector<float> scores_;

include/paimon/global_index/global_index_reader.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024-present Alibaba Inc.
2+
* Copyright 2026-present Alibaba Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
2121
#include <vector>
2222

2323
#include "paimon/global_index/global_index_result.h"
24+
#include "paimon/predicate/full_text_search.h"
2425
#include "paimon/predicate/function_visitor.h"
2526
#include "paimon/predicate/vector_search.h"
2627
#include "paimon/visibility.h"
@@ -40,9 +41,13 @@ class PAIMON_EXPORT GlobalIndexReader : public FunctionVisitor<std::shared_ptr<G
4041
/// VisitVectorSearch performs approximate vector similarity search.
4142
/// @warning `VisitVectorSearch` may return error status when it is incorrectly invoked (e.g.,
4243
/// BitmapGlobalIndexReader call `VisitVectorSearch`).
43-
virtual Result<std::shared_ptr<VectorSearchGlobalIndexResult>> VisitVectorSearch(
44+
virtual Result<std::shared_ptr<ScoredGlobalIndexResult>> VisitVectorSearch(
4445
const std::shared_ptr<VectorSearch>& vector_search) = 0;
4546

47+
/// VisitFullTextSearch performs full text search.
48+
virtual Result<std::shared_ptr<GlobalIndexResult>> VisitFullTextSearch(
49+
const std::shared_ptr<FullTextSearch>& full_text_search) = 0;
50+
4651
/// @return true if the reader is thread-safe; false otherwise.
4752
virtual bool IsThreadSafe() const = 0;
4853

include/paimon/global_index/global_index_result.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024-present Alibaba Inc.
2+
* Copyright 2026-present Alibaba Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -76,7 +76,7 @@ class PAIMON_EXPORT GlobalIndexResult : public std::enable_shared_from_this<Glob
7676
/// Serializes a GlobalIndexResult object into a byte array.
7777
///
7878
/// @note This method only supports the following concrete implementations:
79-
/// - BitmapVectorSearchGlobalIndexResult
79+
/// - BitmapScoredGlobalIndexResult
8080
/// - BitmapGlobalIndexResult
8181
///
8282
/// @param global_index_result The GlobalIndexResult instance to serialize (must not be null).
@@ -91,7 +91,7 @@ class PAIMON_EXPORT GlobalIndexResult : public std::enable_shared_from_this<Glob
9191
///
9292
/// @note The concrete type of the deserialized object is determined by metadata
9393
/// embedded in the buffer. Currently, only the following types are supported:
94-
/// - BitmapVectorSearchGlobalIndexResult
94+
/// - BitmapScoredGlobalIndexResult
9595
/// - BitmapGlobalIndexResult
9696
///
9797
/// @param buffer Pointer to the serialized byte data (must not be null).
@@ -106,18 +106,18 @@ class PAIMON_EXPORT GlobalIndexResult : public std::enable_shared_from_this<Glob
106106
static constexpr int32_t VERSION = 1;
107107
};
108108

109-
/// Represents the result of a vector search query against a global index.
109+
/// Represents the result with score of a query against a global index.
110110
/// This class encapsulates a set of search candidates (row id + score pairs) and provides
111111
/// an iterator interface to traverse them.
112-
class PAIMON_EXPORT VectorSearchGlobalIndexResult : public GlobalIndexResult {
112+
class PAIMON_EXPORT ScoredGlobalIndexResult : public GlobalIndexResult {
113113
public:
114-
/// An iterator over the vector search results, returning (row_id, score) pairs.
114+
/// An iterator over the scored results, returning (row_id, score) pairs.
115115
///
116116
/// @note The results are **NOT sorted by score**. Instead, they are returned in **ascending
117117
/// order of row_id**.
118-
class VectorSearchIterator {
118+
class ScoredIterator {
119119
public:
120-
virtual ~VectorSearchIterator() = default;
120+
virtual ~ScoredIterator() = default;
121121

122122
/// Checks whether more row ids are available.
123123
virtual bool HasNext() const = 0;
@@ -132,7 +132,7 @@ class PAIMON_EXPORT VectorSearchGlobalIndexResult : public GlobalIndexResult {
132132
virtual std::pair<int64_t, float> NextWithScore() = 0;
133133
};
134134

135-
/// Creates a new iterator for traversing the vector search results.
136-
virtual Result<std::unique_ptr<VectorSearchIterator>> CreateVectorSearchIterator() const = 0;
135+
/// Creates a new iterator for traversing the scored results.
136+
virtual Result<std::unique_ptr<ScoredIterator>> CreateScoredIterator() const = 0;
137137
};
138138
} // namespace paimon

include/paimon/orphan_files_cleaner.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ class PAIMON_EXPORT OrphanFilesCleaner {
184184
/// files.
185185
virtual Result<std::set<std::string>> Clean() = 0;
186186

187+
/// Retrieve metrics related to orphan files cleaning operations.
188+
///
189+
/// @return A shared pointer to a `Metrics` object containing cleaning metrics.
190+
virtual std::shared_ptr<Metrics> GetMetrics() const = 0;
191+
187192
protected:
188193
OrphanFilesCleaner() = default;
189194
};

include/paimon/record_batch.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,17 @@ class PAIMON_EXPORT RecordBatch {
9393
/// various properties such as data, row kinds, partition information, and bucket id.
9494
class PAIMON_EXPORT RecordBatchBuilder {
9595
public:
96-
/// Constructs a `RecordBatchBuilder` with Arrow data.
97-
/// @param data Arrow array containing the record data.
96+
/// Constructs a `RecordBatchBuilder` with Arrow data
97+
///
98+
/// @note The `data` must conform to table schema:
99+
/// - Each array in `data` corresponds to a field in table schema.
100+
/// - If a field in table schema is marked as non-nullable (`nullable = false`),
101+
/// the corresponding array in `data` must have zero null entries.
102+
///
103+
/// @note Consistency between `data` and table schema will be validated during the write
104+
/// process.
105+
///
106+
/// @param data ArrowArray struct containing the columnar data (via C Data Interface)
98107
explicit RecordBatchBuilder(::ArrowArray* data);
99108

100109
~RecordBatchBuilder();

src/paimon/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ set(PAIMON_COMMON_SRCS
5252
common/fs/file_system_factory.cpp
5353
common/global_config.cpp
5454
common/global_index/complete_index_score_batch_reader.cpp
55-
common/global_index/bitmap_vector_search_global_index_result.cpp
55+
common/global_index/bitmap_scored_global_index_result.cpp
5656
common/global_index/bitmap_global_index_result.cpp
5757
common/global_index/global_index_result.cpp
5858
common/global_index/global_indexer_factory.cpp
@@ -360,7 +360,7 @@ if(PAIMON_BUILD_TESTS)
360360
common/global_index/global_index_result_test.cpp
361361
common/global_index/global_indexer_factory_test.cpp
362362
common/global_index/bitmap_global_index_result_test.cpp
363-
common/global_index/bitmap_vector_search_global_index_result_test.cpp
363+
common/global_index/bitmap_scored_global_index_result_test.cpp
364364
common/global_index/bitmap/bitmap_global_index_test.cpp
365365
common/io/byte_array_input_stream_test.cpp
366366
common/io/data_input_output_stream_test.cpp

0 commit comments

Comments
 (0)