Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions kernel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -792,13 +792,22 @@ pub trait ParquetHandler: AsAny {
///
/// # Type coercion
///
/// A matched Parquet column whose physical type differs from the `physical_schema`
/// [`StructField`] must be coerced to the requested type. In particular, timestamp columns MUST
/// be normalized to the protocol specified microsecond precision: a `TIMESTAMP(MILLIS)` (or
/// any other non-microsecond unit) column read into a `TIMESTAMP` / `TIMESTAMP_NTZ` field
/// must be rescaled to microseconds (a finer unit such as nanosecond is truncated). The
/// default engine does this via `arrow::compute::cast` while reordering columns to the
/// requested schema.
/// When `physical_schema` requests a type different from the matched Parquet column, the reader
/// must coerce it to the requested type when the conversion is allowed by the [Delta protocol
/// type widening rules]. Examples include `INTEGER` -> `LONG`, `FLOAT` -> `DOUBLE`, and `DATE`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit1 The examples INTEGER -> LONG, FLOAT -> DOUBLE, and DATE -> TIMESTAMP_NTZ sit directly under the type widening rules link, while the next paragraph lists INT32 -> DATE and INT64 -> TIMESTAMP/TIMESTAMP_NTZ as extra Kernel requirements. A reader could infer these coercions are gated on the type-widening table feature rather than being reader-side coercions needed to materialize the requested physical_schema. Raised by: maintainer-codex-reviewer. Suggested fix: add a short clause noting these coercions are required whenever physical_schema asks for a compatible type and are not conditional on the type-widening feature being enabled.

/// -> `TIMESTAMP_NTZ`. See the protocol for the complete list.
Comment on lines +795 to +798

@dengsh12 dengsh12 Sep 12, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DefaultEngine does this, but some engine has not implemented this -- will inform them

///
/// Kernel additionally requires readers to support `INT32` -> `DATE` and `INT64` ->
/// `TIMESTAMP` / `TIMESTAMP_NTZ` conversions for checkpoint `stats_parsed` and
/// `partitionValues_parsed` fields.
///
/// Timestamp columns MUST be normalized to the protocol specified microsecond precision: a
/// `TIMESTAMP(MILLIS)` (or any other non-microsecond unit) column read into a `TIMESTAMP` /
/// `TIMESTAMP_NTZ` field must be rescaled to microseconds (a finer unit such as nanosecond is
/// truncated). The default engine does this via `arrow::compute::cast` while reordering columns
/// to the requested schema.
Comment on lines +807 to +808

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
/// truncated). The default engine does this via `arrow::compute::cast` while reordering columns
/// to the requested schema.
/// truncated). The default engine does this via `arrow::compute::cast`.

///
/// [Delta protocol type widening rules]: https://github.com/delta-io/delta/blob/master/PROTOCOL.md#type-widening
///
/// # Metadata Columns
///
Expand Down
Loading