LuciferYang opened a new pull request, #10264: URL: https://github.com/apache/paimon/pull/10264
### Purpose `PkVectorAnnSegmentSearcher` is meant to reject searching an ANN segment whose distance metric differs from the configured one, but the guard compares two values that both come from the current table configuration, so it is always true and never rejects anything. Once the configured metric changes, the already-built segments are scored with the new metric and the nearest-neighbor results are silently wrong. This records the metric each ANN segment was built with in `VectorIndexMeta` and exposes it through a new `VectorGlobalIndexer.segmentMetric(byte[])`, a default method that returns null and is overridden by `NativeVectorGlobalIndexer`. The searcher now compares the segment's recorded metric against the configured metric and fails fast on a mismatch. Segments written before this change carry no metric and are treated as exempt, so existing indexes keep working, and other `VectorGlobalIndexer` implementations that record no metric return null and are skipped. This closes #10263. ### Tests - `PkVectorAnnSegmentSearcherMetricTest` pins the guard: a matching metric passes, a differing metric fails fast, a legacy segment with no recorded metric is exempt, and alias or case differences (both sides go through the same `normalize`) do not falsely reject. - `VectorIndexMetaTest` pins that the metric round-trips through the segment metadata and that legacy metadata carrying no metric deserializes to null. ### API and Format The persisted vector segment metadata gains an optional `metric` field. Metadata written before this change has no such field and deserializes to null, which is treated as exempt, so the change is backward compatible. Flagging for format review. ### Documentation No. -- 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]
