File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -515,8 +515,25 @@ impl Table {
515515 record_batches : Vec < RecordBatch > ,
516516 schema : SchemaRef ,
517517 ) -> Result < Self , ArrowError > {
518+ /// This function was copied from `pyo3_arrow/utils.rs` for now. I don't understand yet why
519+ /// this is required instead of a "normal" `schema == record_batch.schema()` check.
520+ ///
521+ /// TODO: Either remove this check, replace it with something already existing in `arrow-rs`
522+ /// or move it to a central `utils` location.
523+ fn schema_equals ( left : & SchemaRef , right : & SchemaRef ) -> bool {
524+ left. fields
525+ . iter ( )
526+ . zip ( right. fields . iter ( ) )
527+ . all ( |( left_field, right_field) | {
528+ left_field. name ( ) == right_field. name ( )
529+ && left_field
530+ . data_type ( )
531+ . equals_datatype ( right_field. data_type ( ) )
532+ } )
533+ }
534+
518535 for record_batch in & record_batches {
519- if schema != record_batch. schema ( ) {
536+ if ! schema_equals ( & schema, & record_batch. schema ( ) ) {
520537 return Err ( ArrowError :: SchemaError (
521538 //"All record batches must have the same schema.".to_owned(),
522539 format ! (
You can’t perform that action at this time.
0 commit comments