comphead commented on code in PR #7839:
URL: https://github.com/apache/datafusion-comet/pull/7839#discussion_r4788739771
##########
native/core/src/parquet/schema_adapter.rs:
##########
@@ -2082,6 +2089,28 @@ pub(crate) mod test {
Ok(())
}
+ #[tokio::test]
+ async fn fixed_binary_string_read_depends_on_scan_type() -> Result<(),
DataFusionError> {
Review Comment:
This covers only a top-level column. The nested path is a separate recursion
(`check_nested_conversion`), so a struct field and a list element holding
`FixedSizeBinary` read as `Utf8` deserve one assertion each, for example with
`check_conversion` as the tests near line 4328 do. The Iceberg side matters for
nested too, since a nested UUID must stay accepted with the flag off. I did not
run this.
##########
native/core/src/parquet/schema_adapter.rs:
##########
@@ -477,6 +478,12 @@ fn spark_has_updater(
options: &SparkParquetOptions,
nanos_timestamp: bool,
) -> bool {
+ if options.reject_fixed_binary_as_string
+ && matches!(physical_type, DataType::FixedSizeBinary(_))
+ && target_type.is_string()
+ {
+ return false;
+ }
Review Comment:
The flag defaults to the lenient behavior, so Spark's behavior applies only
where `get_options` sets it. I grepped `SparkParquetOptions::new` at this head
and the only production callers are `get_options` in `parquet_exec.rs` and
`iceberg_scan.rs` (line 275), the rest are tests and benches. Inverting the
flag, for example `render_fixed_binary_as_uuid` set in `iceberg_scan.rs`, makes
Spark's behavior the default for any future plain Parquet entry point and puts
the exception next to the only code that needs it. The Iceberg half of the Rust
test below would then set the flag instead of relying on the default.
https://github.com/apache/datafusion-comet/pull/6246 adds a
`binary_as_string` gated check of the same `FixedSizeBinary` to string pair at
the top of `spark_has_updater`, and the same `FIXED_LEN_BYTE_ARRAY` arm in
`parquet_primitive_name`. The two agree on behavior, but they will conflict
textually. Once this PR is in, that check is redundant for the plain scan
because this flag is always set there, so whichever lands second should drop
its copy.
##########
spark/src/test/scala/org/apache/comet/parquet/ParquetReadSuite.scala:
##########
@@ -1971,6 +1971,38 @@ abstract class ParquetReadSuite extends CometTestBase {
}
}
+ test("native scan rejects fixed-length binary requested as string with
binaryAsString off") {
+ withSQLConf(
Review Comment:
The test pins `PARQUET_BINARY_AS_STRING` to false, but the PR's whole point
is that Spark rejects the pair whatever that setting says (it only changes
BINARY schema inference). Looping over `Seq(false, true)` locks that in and
exercises the interaction with
https://github.com/apache/datafusion-comet/pull/6246, which gates a related
check on `binaryAsString`. The test name would then drop the `with
binaryAsString off` suffix. I did not run this.
--
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]