Repository navigation
Conversation
There was a problem hiding this comment.
@lxy-9602, I left some comments for the observed regressions and the timestamp pruning behavior. PTAL.
| return RealtimeIndexResult::Skip(); | ||
| } | ||
| // Treat equality and IN results as exact, assuming no hash collisions. | ||
| return BitmapResult<RoaringBitmap64>::Create(std::move(result), /*is_exact=*/true); |
There was a problem hiding this comment.
Hash postings can include rows that fail EQUAL or IN, so this result must stay inexact. Literal::HashCode() hashes -0.0 and +0.0 identically, while Literal::CompareTo() distinguishes them. With both values indexed, a local repro of the precise evaluator returned both offsets for col = +0.0 and skipped the scalar scan. Please set is_exact to false until the reader can verify the original values, and add a precise realtime read test covering signed zero.
| } else if (schema_type->id() == arrow::Type::TIME32) { | ||
| PAIMON_RETURN_NOT_OK(ValidateTimeLiterals(*leaf_predicate)); | ||
| } else if (schema_type->id() == arrow::Type::TIMESTAMP) { | ||
| PAIMON_RETURN_NOT_OK(ValidateTimestampLiterals( |
There was a problem hiding this comment.
This rejects valid timestamp comparisons even when file indexing is disabled. On a timestamp[ms] column with values 0 ms and 1 ms, ts < Timestamp(0, 1) correctly matches the epoch row in the scalar evaluator. The previous validator accepted the predicate. The new check returns Invalid during InternalReadContext setup, before a reader can evaluate it. Please keep these predicates valid and have the index path retain candidates when it cannot represent the literal exactly. A read test with indexing disabled would cover the regression.
| PAIMON_ASSIGN_OR_RAISE(result, result->And(evaluated)); | ||
| } else { | ||
| *result |= *candidates; | ||
| PAIMON_ASSIGN_OR_RAISE(result, result->Or(evaluated)); |
There was a problem hiding this comment.
A wide realtime OR retains every intermediate union bitmap. BitmapResult::Or() captures both operands, and IsRemain() materializes each prefix while the supplier keeps earlier prefixes alive. With 2,048 branches matching distinct sparse offsets, the local repro went from about 7 MiB to 99 MiB peak RSS. Please keep a single materialized accumulator for compound scalar evaluation and carry exactness separately.
| if (!candidates) { | ||
| return std::optional<RoaringBitmap64>(); | ||
| PAIMON_ASSIGN_OR_RAISE(std::shared_ptr<RealtimeIndexResult> child, VisitEqual(literal)); | ||
| PAIMON_ASSIGN_OR_RAISE(result, result->Or(child)); |
There was a problem hiding this comment.
A successful null result from a plugin can crash the default IN implementation. If VisitEqual() returns an empty shared_ptr for the first of two literals, Skip::Or() returns that pointer and the next iteration dereferences it. The local repro terminated with SIGSEGV before Evaluate() could report the invalid result. VisitNotIn() can also dereference a null child through Remain::And(). Please validate each child before combining results and return Status::Invalid consistently with the scalar evaluator.
| within the candidates used for that evaluation. ``Remain`` is not exact, while | ||
| ``Skip`` is exact. A bitmap alone does not imply exactness. Combining different | ||
| predicates preserves an exact guarantee only when justified by both results. | ||
| Scalar index results never omit matches, but inexact results may contain false |
There was a problem hiding this comment.
Document that Bitmap and BSI only prune null checks on nanosecond timestamp columns. Value predicates now retain every candidate even when the query literal is microsecond-aligned. IS NULL and IS NOT NULL still use the index. This affects existing tables and belongs alongside the scalar-index guarantees so users can explain why these filters fall back to reading data.
Purpose
Unify file and realtime index results with shared
IndexResult,BitmapResultandScoredIndexResulttemplates.Scalar results must not omit matches. Exact results skip value rechecking; inexact results are intersected before scanning the remaining candidates.
Disable value pruning for bitmap and BSI indexes with truncated nanosecond timestamps, preserving null checks. Reject timestamp literals that lose precision in the field type.
Tests
Update existing tests and add coverage for candidate intersection, exact-result selection, scalar rechecking and timestamp precision.
API and Format
Result types become template aliases, realtime scalar visitors return result objects, and separate result headers are removed. Index plugins require source updates and recompilation. Storage formats and protocols are unchanged.
Documentation
Update index API references and document scalar result guarantees and timestamp precision requirements.
Generative AI tooling
Generated-by: OpenAI Codex (GPT-6)