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


##########
native/core/src/parquet/schema_adapter.rs:
##########
@@ -1474,6 +1474,17 @@ impl SparkPhysicalExprAdapter {
                 return Ok(Transformed::no(expr));
             }
 
+            // Use the nested Parquet decoder for these ARROW:schema types so 
both
+            // binary dictionary widths share its entry selection and overflow 
diagnostic.
+            let needs_binary_decode = target_type == &DataType::Utf8
+                && match physical_type {
+                    DataType::LargeBinary | DataType::BinaryView => true,
+                    DataType::Dictionary(_, value) => {
+                        matches!(value.as_ref(), DataType::Binary | 
DataType::LargeBinary)
+                    }
+                    _ => false,

Review Comment:
   `needs_binary_decode` repeats the source-type predicate of the two arms in 
`parquet_convert_array_impl` (`Binary | LargeBinary | BinaryView` and 
`Dictionary(_, Binary | LargeBinary)`), minus plain `Binary`. If the two drift, 
for example a new dictionary value type is added here but not to the arm, the 
column reaches the `can_cast_types` arm and silently gets Arrow's NULL for 
malformed UTF-8, which is the bug this PR fixes. A small `pub(crate)` predicate 
next to the arms in `parquet_support.rs`, used by both places, would keep them 
in step.



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