comphead commented on code in PR #6246:
URL: https://github.com/apache/datafusion-comet/pull/6246#discussion_r4788741431


##########
native/core/src/parquet/eager_page_index_reader_factory.rs:
##########
@@ -764,6 +768,13 @@ impl AsyncFileReader for EagerPageIndexReader {
             } else {
                 metadata
             };
+            let metadata = match &self.conversion_check {
+                Some((required, options, _)) if options.binary_as_string => {
+                    self.read_decimal_bytes(metadata, required, options, 
file_decryption_properties)
+                        .await?
+                }
+                _ => metadata,
+            };

Review Comment:
   Spark's `BinaryUpdater` returns the stored bytes for a `BINARY` column 
requested as `StringType` whether or not `binaryAsString` is set 
(`ParquetVectorUpdaterFactory.getUpdater`, `case BINARY`, the same in 3.5.8, 
4.0.1 and 4.1.1). This guard limits the byte read to the setting on. With it 
off, I expect the new `ParquetReadSuite` file read with `s STRING` to return 
`65`, `65` and `322` instead of `A`, `\u0000A` and `\u0001B`, because arrow-rs 
reads `Decimal128`, `spark_has_updater` accepts `Decimal128 -> Utf8`, and the 
Spark cast formats the number. That is how `main` behaves today, so it is not a 
regression from this PR. Could the decimal read key on the conversion check 
alone, so every Spark Parquet scan reads the bytes, or could a follow-up issue 
and an entry under "Reads that differ from Spark" in `parquet.md` record the 
setting-off case? I did not run either setting.



##########
native/core/src/parquet/schema_adapter.rs:
##########
@@ -546,6 +550,18 @@ fn spark_has_updater(
     options: &SparkParquetOptions,
     nanos_timestamp: bool,
 ) -> bool {
+    // FIXED_LEN_BYTE_ARRAY has a Binary/Decimal updater, but no String 
updater. Validate the
+    // original requested type even when binaryAsString later reads through an 
intermediate Binary.
+    if options.binary_as_string
+        && matches!(physical_type, DataType::FixedSizeBinary(_))
+        && matches!(
+            target_type,
+            DataType::Utf8 | DataType::LargeUtf8 | DataType::Utf8View
+        )
+    {
+        return false;
+    }

Review Comment:
   https://github.com/apache/datafusion-comet/pull/7839 adds the same rejection 
for every Spark Parquet scan. It reintroduces `reject_fixed_binary_as_string`, 
sets it in `get_options`, and rejects `FixedSizeBinary` for any string target 
in `spark_has_updater`. The conversion check here copies 
`..spark_parquet_options.clone()`, so once both land this branch duplicates 
that one, and only the footer deferral keyed on `binary_as_string` 
(`check_fixed_binary`) stays specific to this PR. The two PRs also conflict in 
`schema_adapter.rs`. Whichever lands second could keep a single branch.



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

Reply via email to