Skip to content

Commit 09c29d7

Browse files
committed
fix: datatype_is_logically_equal for dictionaries
1 parent 8ba3d26 commit 09c29d7

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

datafusion/common/src/dfschema.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,10 @@ impl DFSchema {
700700
(DataType::Dictionary(_, v1), DataType::Dictionary(_, v2)) => {
701701
v1.as_ref() == v2.as_ref()
702702
}
703-
(DataType::Dictionary(_, v1), othertype) => v1.as_ref() == othertype,
704-
(othertype, DataType::Dictionary(_, v1)) => v1.as_ref() == othertype,
703+
(DataType::Dictionary(_, v1), othertype)
704+
| (othertype, DataType::Dictionary(_, v1)) => {
705+
Self::datatype_is_logically_equal(v1.as_ref(), othertype)
706+
}
705707
(DataType::List(f1), DataType::List(f2))
706708
| (DataType::LargeList(f1), DataType::LargeList(f2))
707709
| (DataType::FixedSizeList(f1, _), DataType::FixedSizeList(f2, _)) => {
@@ -1798,6 +1800,12 @@ mod tests {
17981800
&DataType::Utf8,
17991801
&DataType::Dictionary(Box::new(DataType::Int32), Box::new(DataType::Utf8))
18001802
));
1803+
1804+
// Dictionary is logically equal to logically equivalent value type
1805+
assert!(DFSchema::datatype_is_logically_equal(
1806+
&DataType::Utf8View,
1807+
&DataType::Dictionary(Box::new(DataType::Int32), Box::new(DataType::Utf8))
1808+
));
18011809
}
18021810

18031811
#[test]

0 commit comments

Comments
 (0)