lszskye opened a new pull request, #137:
URL: https://github.com/apache/paimon-cpp/pull/137

   ### Purpose
   Introduce `FieldMapping` and `FieldMappingBuilder` for resolving the mapping 
between a read schema and a data file schema, supporting partition pruning, 
schema evolution, and predicate push-down.
   
   **`FieldMapping`** — A plain data structure that holds the resolved mapping 
result for a single data file. It contains three parts:
   - `partition_info`: mapping info for fields that are partition keys, 
including their index in the read schema, index in the partition row, and a 
partition-level filter predicate.
   - `non_partition_info`: mapping info for non-partition fields that exist in 
both the read schema and the data schema, including field-level cast executors 
for type evolution and a data-file-level filter predicate with field indices 
rewritten to match the data schema.
   - `non_exist_field_info`: mapping info for fields requested by the read 
schema but absent in the data file (added via schema evolution), so the reader 
can fill them with nulls.
   
   **`FieldMappingBuilder`** — A builder created once per query from the read 
schema, partition keys, and query predicate. For each data file, 
`CreateFieldMapping(data_fields)` produces a `FieldMapping` by:
   1. Matching fields between the read schema and the data schema by field ID 
(schema evolution–safe).
   2. Separating matched fields into partition and non-partition groups.
   3. Building `CastExecutor` chains for type-evolved fields (atomic types 
only; complex types are rejected).
   4. Reconstructing the query predicate against the data schema field indices 
and data types, including literal casting for integer widening and overflow 
detection; predicates on non-existent or type-incompatible fields are dropped.
   5. Extracting a partition-level filter from the reconstructed predicate for 
partition pruning.
   
   ### Tests
   
   - `TestBasicFieldMapping` — basic read/data schema mapping without partition 
or predicate
   - `TestFieldMappingWithPartition` — partition field separation and index 
mapping
   - `TestFieldMappingWithPredicate` — predicate rewriting for partition fields
   - `TestFieldMappingWithPartitionAndPredicateInPartitionField` — predicate 
push-down into partition filter
   - `TestFieldMappingWithPartitionAndPredicateInNonPartitionField` — predicate 
push-down into data file filter
   - `TestSchemaEvolution` — field add / delete / rename / type casting without 
predicate
   - `TestSchemaEvolutionWithPredicate` — schema evolution combined with 
predicate rewriting and overflow detection
   - `TestSchemaEvolutionWithPredicate2` — schema evolution with inconsistent 
field order in read schema
   - `TestCompoundPredicateWithoutPushDown` — OR compound predicate containing 
non-pushdownable sub-predicates is correctly dropped


-- 
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]

Reply via email to