warrenzhu25 opened a new pull request, #7776:
URL: https://github.com/apache/datafusion-comet/pull/7776
## Which issue does this PR close?
Part of #6954 (one of the settings listed there; `parquet.enable.dictionary`
is handled separately).
## Rationale for this change
iceberg-java's `ParquetWriter` reads `parquet.columnindex.truncate.length`
(default 64) from its writer's Hadoop configuration, into which it copies the
table and write properties. The native writer ignored it, so the gate declined
every write that set the key, although parquet-rs has a direct equivalent
(`WriterProperties::set_column_index_truncate_length`).
## What changes are included in this PR?
- **Proto**: `IcebergParquetWriteSettings.column_index_truncate_length`.
- **Translation** (`IcebergWriteProtoTranslation`): resolves the key from
the effective table/write properties the way Hadoop's `Configuration.getInt`
reads a decimal (trimmed, optional `+`), defaulting to iceberg-java's 64.
`columnIndexTruncateLengthRejection` declines `0`, negative values, overflow,
and values `getInt` reads but the translation does not (hex, `${var}`).
- **Gate** (`CometIcebergNativeWrite`): admits the key as a table or write
property. `UnsupportedParquetMrKeys` becomes `ParquetMrKeysReadByWriter`; a key
set **only** in the session or FileIO Hadoop configuration still falls back,
because iceberg-java sets the table/write properties over that configuration
and the effective value there depends on the FileIO.
- **Native** (`build_writer_properties`): passes the value to parquet-rs. A
zero returns an error instead of reaching parquet-rs's `assert!`, so no panic
can cross JNI.
- **Docs**: eligibility table row, the `parquet.*` paragraph and the
fallback plan list in the user guide; contributor guide updated for the renamed
set. A new accepted divergence documents how parquet-mr's `BinaryTruncator` and
parquet-rs truncate column index bounds differently (raising a truncated
non-ASCII string upper bound; `binary`/`fixed` columns without a logical type).
Both produce valid bounds, so page pruning stays correct. The difference
already exists at the default length of 64; a smaller length makes it reachable
on shorter values.
No new config keys. Manifest metrics are unaffected: they are rebuilt from
footer statistics, which this setting does not touch.
## How are these changes tested?
- `CometIcebergWriteActionSuite`: writes the same rows through the native
and iceberg-java writers with a length of 8. It asserts that rows and
`readable_metrics` match, and that every page's column index min/max is
identical across the two writers and truncated to 8 bytes.
- `CometIcebergWriteActionSuite`: for the documented divergence, writes
multi-byte UTF-8 strings (including a 4-byte code point straddling the cut) and
binary values (valid UTF-8, invalid UTF-8, plain bytes) with a length of 4. For
each writer it asserts the bounds are truncated to 4 bytes and contain every
value of the page, so pruning stays correct even though the two writers' bytes
differ.
- `CometIcebergWriteDetectionSuite`: a valid table property is `Compatible`;
`0` and hex fall back; the key in the session Hadoop configuration alone still
falls back; a table property overriding it is `Compatible`. The existing
catalog `hadoop.*` override test still falls back.
- `IcebergWriteProtoTranslationSuite`: default, accepted spellings (`" 16
"`, `+32`, `0064`) and rejected ones (`0`, `-1`, `0x20`, `${len}`, `abc`,
empty, `2147483648`).
- Rust: `translates_column_index_truncate_length`,
`rejects_zero_column_index_truncate_length`.
Run locally (Spark 4.1 default profile, JDK 17): the three suites above (the
Action suite filtered to its `parquet` tests, including the parquet-mr key
classification test), `iceberg_write` Rust tests, `cargo clippy --all-targets
--workspace -D warnings`, `cargo fmt`, spotless, and the semantic scalafix
check.
--
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]