fix: Fix bug for gis function to filter geometry (#44966)

issue: #44961 

This PR fixes 3 geometry related bugs:
1. Implement `ToString` interface for GisFunctionFilter.
2. Ignore GisFunctionFilter `MoveCursor` for growing segment.
3. Don't skip null geometry for building R-Tree index, should be record
in null_offsets.

---------

Signed-off-by: Cai Zhang <cai.zhang@zilliz.com>
This commit is contained in:
cai.zhang 2025-10-21 09:52:04 +08:00 committed by GitHub
parent a35a3b7c69
commit b23d75a032
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 10 deletions

View File

@ -56,6 +56,18 @@ class PhyGISFunctionFilterExpr : public SegmentExpr {
return expr_->column_;
}
std::string
ToString() const {
return fmt::format("{}", expr_->ToString());
}
void
MoveCursor() {
if (segment_->type() == SegmentType::Sealed) {
SegmentExpr::MoveCursor();
}
}
private:
VectorPtr
EvalForIndexSegment();

View File

@ -531,16 +531,14 @@ ScalarFieldIndexing<T>::process_geometry_data(int64_t reserved_offset,
// Use the accessor to get geometry data and validity
auto [wkb_data, is_valid] = accessor(i);
if (is_valid) {
try {
rtree_index->AddGeometry(wkb_data, global_offset);
added_count++;
} catch (std::exception& error) {
ThrowInfo(UnexpectedError,
"Failed to add geometry at offset {}: {}",
global_offset,
error.what());
}
try {
rtree_index->AddGeometry(wkb_data, global_offset);
added_count++;
} catch (std::exception& error) {
ThrowInfo(UnexpectedError,
"Failed to add geometry at offset {}: {}",
global_offset,
error.what());
}
}