Skip to content
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

implement range/generate_series func #8140

Merged
merged 7 commits into from
Nov 14, 2023
Merged

implement range/generate_series func #8140

merged 7 commits into from
Nov 14, 2023

Conversation

Veeupup
Copy link
Contributor

@Veeupup Veeupup commented Nov 11, 2023

Which issue does this PR close?

Closes #8028 .

Rationale for this change

What changes are included in this PR?

Are these changes tested?

test in sqllogictests

Are there any user-facing changes?

@github-actions github-actions bot added logical-expr Logical plan and expressions physical-expr Physical Expressions sqllogictest SQL Logic Tests (.slt) labels Nov 11, 2023
@Veeupup
Copy link
Contributor Author

Veeupup commented Nov 12, 2023

cc @jayzhan211 @alamb this PR is ready for review! : )

@2010YOUY01
Copy link
Contributor

Thank you for this new function! Looks like these functions are available in DuckDB 👍🏼 https://duckdb.org/docs/sql/functions/nested.html#range-functions

Here are some suggestions:

  1. Can we add more corner case tests like range(5,5,0), range(1,5,-1), range(1,-5,1)...
  2. Include the semantics of this function (is start/end index inclusive or exclusive, what will happen for range(1,5,-1)) in SQL doc: https://github.com/apache/arrow-datafusion/blob/main/docs/source/user-guide/sql/scalar_functions.md

Copy link
Contributor

@jayzhan211 jayzhan211 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

datafusion/expr/src/expr_fn.rs Show resolved Hide resolved
datafusion/expr/src/expr_fn.rs Show resolved Hide resolved
@Veeupup
Copy link
Contributor Author

Veeupup commented Nov 12, 2023

Thank you for this new function! Looks like these functions are available in DuckDB 👍🏼 https://duckdb.org/docs/sql/functions/nested.html#range-functions

Here are some suggestions:

  1. Can we add more corner case tests like range(5,5,0), range(1,5,-1), range(1,-5,1)...
  2. Include the semantics of this function (is start/end index inclusive or exclusive, what will happen for range(1,5,-1)) in SQL doc: https://github.com/apache/arrow-datafusion/blob/main/docs/source/user-guide/sql/scalar_functions.md

thanks! I have made it clear in the test and doc.

Copy link
Contributor

@2010YOUY01 2010YOUY01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the doc. I think the panic should be addressed. Everything else looks good to me

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Veeupup -- this looks great. I took the liberty of merging this branch up from main to resolve a conflict.

It would be great if you could add a doc comment explaining the arguments to gen_range , but I also think we could do that as a follow on PR if necessary.

Thanks again for the recent string of nice PRs 🙏

@alamb
Copy link
Contributor

alamb commented Nov 14, 2023

Thanks again @Veeupup and @jayzhan211

@alamb alamb merged commit 31e54f0 into apache:main Nov 14, 2023
23 checks passed
@Veeupup Veeupup deleted the func_range branch November 21, 2023 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logical-expr Logical plan and expressions physical-expr Physical Expressions sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support udf range
4 participants