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

suggest add table function generate_series and change the results of current version #9323

Closed
l1t1 opened this issue Feb 23, 2024 · 5 comments · Fixed by #9352
Closed

suggest add table function generate_series and change the results of current version #9323

l1t1 opened this issue Feb 23, 2024 · 5 comments · Fixed by #9352
Assignees
Labels
enhancement New feature or request

Comments

@l1t1
Copy link

l1t1 commented Feb 23, 2024

Is your feature request related to a problem or challenge?

as #9315 mentioned, generate_series is alias of range, it's result does not include the upper bound. it results the problem of Portability from other DBMS.

Describe the solution you'd like

the result of generate_series is same as that of postgresql, the range() funciton keeps the current result

 select generate_series(1,3);
 generate_series
-----------------
               1
               2
               3

select * from generate_series(1,3);
 generate_series
-----------------
               1
               2
               3

Describe alternatives you've considered

No response

Additional context

No response

@l1t1 l1t1 added the enhancement New feature or request label Feb 23, 2024
@l1t1
Copy link
Author

l1t1 commented Feb 23, 2024

databend's numbers function + 1 is similar with generate_series

ctx.sql("select number+1 from numbers(3)")
┌──────────────┐
│ (number + 1) │
│    UInt64    │
├──────────────┤
│            1 │
│            2 │
│            3 │
└──────────────┘

@Lordworms
Copy link
Contributor

I'm just wondering what is the purpose of datafusion to design in such a way. If this feature is needed, I can do this one.

@alamb
Copy link
Contributor

alamb commented Feb 26, 2024

Here is the duckdb syntax: https://duckdb.org/docs/sql/functions/nested.html#range-functions

It looks to me like generate_series and range can be both scalar functions (return list) or table functions (return a table)

@alamb
Copy link
Contributor

alamb commented Feb 26, 2024

I think we should follow postgres or duckdb's syntax

@Lordworms
Copy link
Contributor

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants