diff --git a/include/paimon/file_index/file_index_reader.h b/include/paimon/file_index/file_index_reader.h index 8d5ba07d3..bbbea446c 100644 --- a/include/paimon/file_index/file_index_reader.h +++ b/include/paimon/file_index/file_index_reader.h @@ -60,6 +60,8 @@ class PAIMON_EXPORT FileIndexReader : public FunctionVisitor> VisitEndsWith(const Literal& suffix) override; Result> VisitContains(const Literal& literal) override; + + Result> VisitLike(const Literal& literal) override; }; } // namespace paimon diff --git a/include/paimon/predicate/function_visitor.h b/include/paimon/predicate/function_visitor.h index 8da7c18ba..3d5954ff4 100644 --- a/include/paimon/predicate/function_visitor.h +++ b/include/paimon/predicate/function_visitor.h @@ -71,5 +71,8 @@ class PAIMON_EXPORT FunctionVisitor { /// Evaluates whether string values contain the given substring. virtual Result VisitContains(const Literal& literal) = 0; + + /// Evaluates whether string values like the given string. + virtual Result VisitLike(const Literal& literal) = 0; }; } // namespace paimon diff --git a/src/paimon/common/file_index/empty/empty_file_index_reader.h b/src/paimon/common/file_index/empty/empty_file_index_reader.h index 0357c5feb..6207787a7 100644 --- a/src/paimon/common/file_index/empty/empty_file_index_reader.h +++ b/src/paimon/common/file_index/empty/empty_file_index_reader.h @@ -46,6 +46,9 @@ class EmptyFileIndexReader : public FileIndexReader { Result> VisitContains(const Literal& literal) override { return FileIndexResult::Skip(); } + Result> VisitLike(const Literal& literal) override { + return FileIndexResult::Skip(); + } Result> VisitLessThan(const Literal& literal) override { return FileIndexResult::Skip(); } diff --git a/src/paimon/common/file_index/empty/empty_file_index_reader_test.cpp b/src/paimon/common/file_index/empty/empty_file_index_reader_test.cpp index 9db4c8d0b..1dc3f1e5f 100644 --- a/src/paimon/common/file_index/empty/empty_file_index_reader_test.cpp +++ b/src/paimon/common/file_index/empty/empty_file_index_reader_test.cpp @@ -31,6 +31,7 @@ TEST(EmptyFileIndexReaderTest, TestSimple) { ASSERT_FALSE(reader.VisitStartsWith(lit0).value()->IsRemain().value()); ASSERT_FALSE(reader.VisitEndsWith(lit0).value()->IsRemain().value()); ASSERT_FALSE(reader.VisitContains(lit0).value()->IsRemain().value()); + ASSERT_FALSE(reader.VisitLike(lit0).value()->IsRemain().value()); ASSERT_FALSE(reader.VisitLessThan(lit0).value()->IsRemain().value()); ASSERT_FALSE(reader.VisitGreaterOrEqual(lit0).value()->IsRemain().value()); ASSERT_FALSE(reader.VisitLessOrEqual(lit0).value()->IsRemain().value()); diff --git a/src/paimon/common/file_index/file_index_reader.cpp b/src/paimon/common/file_index/file_index_reader.cpp index 7fd1814f3..6f4cb38b2 100644 --- a/src/paimon/common/file_index/file_index_reader.cpp +++ b/src/paimon/common/file_index/file_index_reader.cpp @@ -41,6 +41,10 @@ Result> FileIndexReader::VisitContains(const Li return FileIndexResult::Remain(); } +Result> FileIndexReader::VisitLike(const Literal& literal) { + return FileIndexResult::Remain(); +} + Result> FileIndexReader::VisitLessThan(const Literal& literal) { return FileIndexResult::Remain(); } diff --git a/src/paimon/common/global_index/wrap/file_index_reader_wrapper.h b/src/paimon/common/global_index/wrap/file_index_reader_wrapper.h index 9f46cc9c1..f720002b2 100644 --- a/src/paimon/common/global_index/wrap/file_index_reader_wrapper.h +++ b/src/paimon/common/global_index/wrap/file_index_reader_wrapper.h @@ -114,6 +114,12 @@ class FileIndexReaderWrapper : public GlobalIndexReader { return transform_(file_index_result); } + Result> VisitLike(const Literal& literal) override { + PAIMON_ASSIGN_OR_RAISE(std::shared_ptr file_index_result, + reader_->VisitLike(literal)); + return transform_(file_index_result); + } + Result> VisitVectorSearch( const std::shared_ptr& vector_search) override { return Status::Invalid( diff --git a/src/paimon/global_index/lucene/lucene_global_index.h b/src/paimon/global_index/lucene/lucene_global_index.h index dafa801df..d5c607d84 100644 --- a/src/paimon/global_index/lucene/lucene_global_index.h +++ b/src/paimon/global_index/lucene/lucene_global_index.h @@ -158,6 +158,10 @@ class LuceneGlobalIndexReader : public GlobalIndexReader { return CreateAllResult(); } + Result> VisitLike(const Literal& literal) override { + return CreateAllResult(); + } + Result> VisitVectorSearch( const std::shared_ptr& vector_search) override { return Status::Invalid( diff --git a/src/paimon/global_index/lumina/lumina_global_index.h b/src/paimon/global_index/lumina/lumina_global_index.h index 0bc853470..9aece4d12 100644 --- a/src/paimon/global_index/lumina/lumina_global_index.h +++ b/src/paimon/global_index/lumina/lumina_global_index.h @@ -183,6 +183,10 @@ class LuminaIndexReader : public GlobalIndexReader { return BitmapGlobalIndexResult::FromRanges({Range(0, range_end_)}); } + Result> VisitLike(const Literal& literal) override { + return BitmapGlobalIndexResult::FromRanges({Range(0, range_end_)}); + } + bool IsThreadSafe() const override { return true; }