viirya commented on code in PR #1839:
URL: https://github.com/apache/arrow-rs/pull/1839#discussion_r894711663
##########
arrow/src/datatypes/datatype.rs:
##########
@@ -684,10 +684,17 @@ impl DataType {
&& a.data_type().equals_datatype(b.data_type())
}
(DataType::Struct(a), DataType::Struct(b)) => {
- a.len() == b.len()
- && a.iter().zip(b).all(|(a, b)| {
- a.is_nullable() == b.is_nullable()
- && a.data_type().equals_datatype(b.data_type())
+ a.iter().all(|a| {
Review Comment:
I think this is not correct. `equals_datatype` compares exact data type
equality (except for metadata and nested field names). Technically speaking,
two structs are equal only if the nested field data types are equal.
In #2326, seems you want to overcome some errors at column projection in
DataFusion. For column projection, it requires two structs to be "compatible",
so nested field order can be ignored (because it will be "mapped" later). It is
a more loose data type equality than the exact equality of `equals_datatype`.
So I don't think we should change `equals_datatype`. For compatible data
type change, maybe we should have another method for that.
--
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]