xndai opened a new pull request, #1128:
URL: https://github.com/apache/iceberg-cpp/pull/1128
Closes #1127. Part of #1107.
Adds `ContentStatsUtil` (`src/iceberg/stats/content_stats_util.{h,cc}`) for
the v4 `content_stats` struct, following the spec's [Content
Stats](https://iceberg.apache.org/spec/#content-stats) section
(apache/iceberg#14234; `total_bytes` from apache/iceberg#18308). `BaseId`,
`FieldId` and `StatOffset` map between table field IDs and stats IDs (`10_000 +
200 * field-id`, and 9000/9200 for `_last_updated_sequence_number`/`_row_id`).
`StatsWriteType(schema, MetricsConfig)` builds the struct a writer puts in
manifests: bounds for `truncate`/`full` (`geo_lower`/`geo_upper` structs for
geo types), the counts, `nan_value_count` for float/double, `total_bytes` for
variable-length types, and no stats for fields in lists or maps.
`StatsReadType(schema, field_ids)` builds the projection a reader asks for.
This ports Java's `StatsUtil` with one difference. The spec includes
`null_value_count` for optional fields only, but Java writes it for every field
since apache/iceberg#17413, and a required field inside an optional struct can
still be null. The write type follows the spec, and the read type also projects
the count for required fields, so stats written by Java are read. Tests cover
the ID math, the spec's examples, every primitive type, nested structs, lists
and maps, metrics modes and geo bounds.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]