-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix: generate_series function support string type #12002
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix: generate_series function support string type #12002
Conversation
@getChan I think what we need is to support string type but not modifying the test to other already supported type
We should able to return the same result as Duckdb's |
In that case, I guess we should extend the above issue to "Add string type support to generate_series function". |
The goal is make the query return the same result as the one you explicitly cast the argument.
Yes, I think what we need is to support string type, or cast the string to date. Not sure what is the exact solution. But I expect we should get the correct result for that query |
The type coercsion system is supposed to handle adding this kind of cast. I wonder if we can could remove the datafusion/datafusion/functions-nested/src/range.rs Lines 125 to 129 in e24a5dd
I think that would then ensure DataFusion actually casts the arguments to the supported types |
Marking as draft as I think this PR is no longer waiting on feedback. Please mark it as ready for review when it is ready for another look |
4957a1d
to
bccdc2e
Compare
removed |
This reverts commit bccdc2e.
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.
👍
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.
Thanks @getChan
@@ -5804,7 +5804,7 @@ select generate_series(5), | |||
---- | |||
[0, 1, 2, 3, 4, 5] [2, 3, 4, 5] [2, 5, 8] [1, 2, 3, 4, 5] [5, 4, 3, 2, 1] [10, 7, 4] [1992-09-01, 1992-10-01, 1992-11-01, 1992-12-01, 1993-01-01, 1993-02-01, 1993-03-01] [1993-02-01, 1993-01-31, 1993-01-30, 1993-01-29, 1993-01-28, 1993-01-27, 1993-01-26, 1993-01-25, 1993-01-24, 1993-01-23, 1993-01-22, 1993-01-21, 1993-01-20, 1993-01-19, 1993-01-18, 1993-01-17, 1993-01-16, 1993-01-15, 1993-01-14, 1993-01-13, 1993-01-12, 1993-01-11, 1993-01-10, 1993-01-09, 1993-01-08, 1993-01-07, 1993-01-06, 1993-01-05, 1993-01-04, 1993-01-03, 1993-01-02, 1993-01-01] [1989-04-01, 1990-04-01, 1991-04-01, 1992-04-01] | |||
|
|||
query error DataFusion error: Execution error: unsupported type for range. Expected Int64 or Date32, got: Timestamp\(Nanosecond, None\) | |||
query error DataFusion error: Execution error: Cannot generate date range less than 1 day\. |
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.
I will file an ticket for this issue
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.
Thank you 🙏
Which issue does this PR close?
Closes #11922.
Rationale for this change
generate_series
function does not accept string arguments.However, the as-is test provide string arguments.
I think it would be better if the type signature of
generate_series
was changed.https://github.com/apache/datafusion/blob/main/datafusion/functions-nested/src/range.rs#L129
What changes are included in this PR?
Only sqllogictest
Are these changes tested?
Yes.
Are there any user-facing changes?
No.