-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix strpos invocation with dictionary and null #12712
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 | ||||
---|---|---|---|---|---|---|
|
@@ -1907,8 +1907,10 @@ select position('' in '') | |||||
1 | ||||||
|
||||||
|
||||||
query error POSITION function can only accept strings | ||||||
query I | ||||||
select position(1 in 1) | ||||||
---- | ||||||
1 | ||||||
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. This query used to fail also before 1b3608d , i don't know why. According to datafusion/datafusion/expr/src/type_coercion/functions.rs Lines 681 to 682 in 8db30e2
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. Isn't this function only accept string? Why do we return 1 now |
||||||
|
||||||
|
||||||
query I | ||||||
|
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.
This restores the code before 1b3608d . These are the types actually supported by invoke.
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.
Can we invert the order? From another function we have this comment:
// Planner attempts coercion to the target type starting with the most preferred candidate.
// For example, given input
(Utf8View, Int64)
, it first tries coercing to(Utf8View, Int64)
.// If that fails, it proceeds to
(Utf8, Int64)
.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.
Good comment. I just restored the code that used to be here.
How function implementor can know what is the preferred order? Shouldn't this rather be engine's responsibility, if its given a choice? Unless of course the preferred candidate is function-specific.
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.
Great question and I don't have the answer. I just have followed that advice since I first saw it a month or two back. I agree that I would hope the coercing logic could select the most optimal candidate.