Dandandan commented on a change in pull request #2108:
URL: https://github.com/apache/arrow-datafusion/pull/2108#discussion_r839422630



##########
File path: datafusion/common/src/dfschema.rs
##########
@@ -281,6 +282,18 @@ impl DFSchema {
             .all(|(dffield, arrowfield)| dffield.name() == arrowfield.name())
     }
 
+    /// Check to see if fields in 2 Arrow schemas are compatible
+    pub fn check_arrow_schema_type_compatible(&self, arrow_schema: &Schema) -> 
bool {
+        let self_arrow_schema: Schema = self.into();
+        self_arrow_schema
+            .fields()
+            .iter()
+            .zip(arrow_schema.fields().iter())
+            .all(|(l_field, r_field)| {
+                can_cast_types(r_field.data_type(), l_field.data_type())

Review comment:
       If this would return a `Result<()>` we could return a more specific 
error of the type mismatch here (and pass it to the user). 




-- 
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...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to