alamb commented on issue #16565: URL: https://github.com/apache/datafusion/issues/16565#issuecomment-3039045185
> Implementation considerations: We would need to extend CastExpr and TryCastExpr to detect when the input/output types are structs and invoke the struct-aware casting logic appropriately. This means: @kosiew I would actually suggest something different which is to add a function that "wraps" the [arrow cast kernel ](https://docs.rs/arrow/latest/arrow/compute/kernels/cast/index.html) So it would look somethin glike ```rust pub fn cast( array: &dyn Array, to_type: &DataType, ) -> Result<Arc<dyn Array>, ArrowError> { if matches!(to_type, DataType::Struct) { // call struct aware version in datafusion } else { // fallback to arrow implementatin arrow::compute::kernels::cast(array, to_type) } } ``` Then you need to update all the places that directly call arrow cast with this new cast version, but the upside is that now everything would have the same (consistent) semantics -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org