Repository navigation
Conversation
There was a problem hiding this comment.
@lszskye, I left two comments for read correctness issues. PTAL.
| completed_fields.insert(SpecialFields::SequenceNumber().Name()); | ||
| } | ||
| PAIMON_ASSIGN_OR_RAISE(std::shared_ptr<Predicate> physical_predicate, | ||
| PredicateUtils::ExcludePredicateWithFields(predicate, completed_fields)); |
There was a problem hiding this comment.
Exclude predicates on row-tracking values that the reader can fill in. ConvertRowTrackingField() replaces NULLs even when the column is physically present. For example, an ORC stripe with a stored NULL _SEQUENCE_NUMBER can be skipped by _SEQUENCE_NUMBER = 8 before the reader fills that NULL from a file sequence number of 8. The residual filter then never sees the matching row. Please keep these conjuncts out of physical pushdown unless the file proves the relevant values are non-null, and cover both all-null and mixed-null physical columns.
| DataField::ConvertDataFieldToArrowField(SpecialFields::SequenceNumber())); | ||
| } | ||
| PAIMON_RETURN_NOT_OK( | ||
| SpecialFields::ValidatePredicateFieldNames(field_names, allowed_system_fields)); |
There was a problem hiding this comment.
Preserve predicates on an explicitly projected _VALUE_KIND for primary-key reads. The base accepts SetReadFieldNames({"_VALUE_KIND"}) with _VALUE_KIND = 0 and residual filtering enabled. The primary-key read paths already carry the real row kind to the residual filter. The new allowlist rejects the same request at TableRead::Create(). Please retain this previously supported case and cover it with a primary-key read test.
| ArrowSchema c_schema; | ||
| PAIMON_RETURN_NOT_OK_FROM_ARROW(arrow::ExportSchema(*arrow_schema, &c_schema)); | ||
| return reader_->SetReadSchema(&c_schema, predicate, selection_bitmap); | ||
| return reader_->SetReadSchema(&c_schema, physical_predicate, selection_bitmap); |
There was a problem hiding this comment.
For completed_fields, do you mean it’s supposed to represent fields that are missing in the file and should be removed? As it stands now, it looks more like it’s being added rather than removed.
| ScopeGuard release([batch]() { ReaderUtils::ReleaseReadBatch(std::move(*batch)); }); | ||
| auto& [c_array, c_schema] = *batch; | ||
| PAIMON_ASSIGN_OR_RAISE_FROM_ARROW(std::shared_ptr<arrow::Field> root, | ||
| arrow::ImportField(c_schema.get())); |
There was a problem hiding this comment.
I’m a bit confused—didn’t we previously use ImportArray to import both c_schema and c_array together?
| PAIMON_RETURN_NOT_OK_FROM_ARROW(arrow::ExportArray(*output, c_array.get())); | ||
| PAIMON_RETURN_NOT_OK_FROM_ARROW( | ||
| arrow::ExportField(*root->WithType(output->type()), c_schema.get())); | ||
| PAIMON_RETURN_NOT_OK(AddArrowArrayLifetime(c_array.get(), c_schema.get(), array)); |
There was a problem hiding this comment.
I’m not sure ExportField is the right choice here. Can we use ExportArray directly, since it can reset both c_schema and c_array? Also, why do we need AddArrowArrayLifetime and pass array? I understand this class is for trimming fields and doesn’t involve any new memory allocation, so we probably don’t need to add array lifetime. In general, AddArrowArrayLifetime is used when attaching a pool.
|
|
||
| /// Drops dependency columns after filtering/merging, preserving the actual batch fields and | ||
| /// the leading _VALUE_KIND. Retains implicit index scores until the outer TopK reader consumes | ||
| /// them and removes scores absent from the output schema. |
There was a problem hiding this comment.
Could the caller explicitly specify which score columns to retain? Keeping all _<field>_INDEX_SCORE columns here couples projection to the outer TopK reader.
|
|
||
| /// Separates the requested output from the columns needed to produce it. | ||
| class ReadSchemaPlan { | ||
| public: |
There was a problem hiding this comment.
In precise mode, if the corresponding predicate already has an exact index result, please don’t do any further I/O for that field in data file (unless the user has requested recall).
Purpose
Remove the requirement that predicate fields must appear in the output projection. For example, a read can now return only
namewhile filtering onage, without exposingagein the result. This also applies to full-text predicate fields.Introduce
ReadSchemaPlanto separate the requested output schema from the internal schema containing predicate and authorization dependencies. UseProjectionBatchReaderto remove these dependencies after filtering, merging, or masking. Apply this consistently across append, primary-key, data-evolution, realtime, precise-index, query-auth, and format-table reads.The change also addresses several predicate-handling issues:
_ROW_IDand_SEQUENCE_NUMBERcolumns into the physical format reader. Keep these predicates for the existing filtering stage after the values are completed. Predicates on columns already present in the file remain eligible for pushdown.Tests
Add or update coverage for:
API and Format
No public API signature, storage format, or protocol changes.
Documentation
Update predicate API comments and the file-index, realtime, and format-table guides to describe predicates on non-projected fields.
Generative AI tooling
Generated-by: OpenAI Codex (GPT-6)