-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coerce Dictionary types for scalar functions #10077
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -314,8 +314,13 @@ fn coerced_from<'a>( | |
// match Dictionary first | ||
match (type_into, type_from) { | ||
// coerced dictionary first | ||
(cur_type, Dictionary(_, value_type)) | (Dictionary(_, value_type), cur_type) | ||
if coerced_from(cur_type, value_type).is_some() => | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When coercing into dictionary type, the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is an excellent find. Thanks @jayzhan211 for pointing that out |
||
(_, Dictionary(_, value_type)) | ||
if coerced_from(type_into, value_type).is_some() => | ||
{ | ||
Some(type_into.clone()) | ||
} | ||
(Dictionary(_, value_type), _) | ||
if coerced_from(value_type, type_from).is_some() => | ||
{ | ||
Some(type_into.clone()) | ||
} | ||
|
@@ -624,4 +629,20 @@ mod tests { | |
|
||
Ok(()) | ||
} | ||
|
||
#[test] | ||
fn test_coerced_from_dictionary() { | ||
let type_into = | ||
DataType::Dictionary(Box::new(DataType::Int32), Box::new(DataType::UInt32)); | ||
let type_from = DataType::Int64; | ||
assert_eq!(coerced_from(&type_into, &type_from), None); | ||
|
||
let type_from = | ||
DataType::Dictionary(Box::new(DataType::Int32), Box::new(DataType::UInt32)); | ||
let type_into = DataType::Int64; | ||
assert_eq!( | ||
coerced_from(&type_into, &type_from), | ||
Some(type_into.clone()) | ||
); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 we saw something similar in #9925