notfilippo commented on code in PR #11978: URL: https://github.com/apache/datafusion/pull/11978#discussion_r1719702630
########## datafusion/common/src/logical/eq.rs: ########## @@ -0,0 +1,26 @@ +use arrow_schema::DataType; + +pub trait LogicallyEq<Rhs: ?Sized = Self> { + #[must_use] + fn logically_eq(&self, other: &Rhs) -> bool; +} + +impl LogicallyEq for DataType { + fn logically_eq(&self, other: &Self) -> bool { + use DataType::*; + + match (self, other) { + (Utf8 | LargeUtf8 | Utf8View, Utf8 | LargeUtf8 | Utf8View) + | (Binary | LargeBinary | BinaryView, Binary | LargeBinary | BinaryView) => { + true + } + (Dictionary(_, inner), other) | (other, Dictionary(_, inner)) => { Review Comment: Technically it would work with the recursion but I could add a special case to prevent it from doing multiple recursive calls. ########## datafusion/common/src/logical/eq.rs: ########## @@ -0,0 +1,26 @@ +use arrow_schema::DataType; + +pub trait LogicallyEq<Rhs: ?Sized = Self> { + #[must_use] + fn logically_eq(&self, other: &Rhs) -> bool; +} + +impl LogicallyEq for DataType { + fn logically_eq(&self, other: &Self) -> bool { + use DataType::*; + + match (self, other) { + (Utf8 | LargeUtf8 | Utf8View, Utf8 | LargeUtf8 | Utf8View) + | (Binary | LargeBinary | BinaryView, Binary | LargeBinary | BinaryView) => { + true + } + (Dictionary(_, inner), other) | (other, Dictionary(_, inner)) => { Review Comment: Technically it _should_ work with the recursion but I could add a special case to prevent it from doing multiple recursive calls. -- 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