rich7420 commented on code in PR #6246:
URL: https://github.com/apache/datafusion-comet/pull/6246#discussion_r4730875341
##########
native/core/src/parquet/schema_adapter.rs:
##########
@@ -1409,6 +1447,100 @@ impl SparkPhysicalExprAdapter {
.data()
}
+ /// A `binaryAsString` scan reads string columns as Binary and decodes
them to strings with a
+ /// Spark cast, in its output projection and in the filters it pushes.
Where arrow-rs reads
+ /// the column as Utf8, the default adapter makes that `CAST(CAST(s AS
BINARY) AS STRING)`.
+ /// Use the column itself to skip both casts and let filters prune. This
preserves the
+ /// setting-off behavior: arrow-rs validates UTF8-annotated columns, but
JSON annotations and
+ /// Utf8 `ARROW:schema` hints can still yield unchecked string arrays.
+ fn unwrap_binary_round_trip(
+ &self,
+ expr: Arc<dyn PhysicalExpr>,
+ ) -> DataFusionResult<Transformed<Arc<dyn PhysicalExpr>>> {
+ if let Some(cast) = expr.downcast_ref::<Cast>() {
+ if cast.data_type == DataType::Utf8 {
+ if let Some((column, DataType::Utf8)) =
self.column_cast_to_binary(&cast.child) {
Review Comment:
Sure, a follow-up works for me, and the new doc note covers it well. Could
you open an issue for it so it doesn't get lost?
--
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]