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

Feature: Change range defaults and add generate_series function #3678

Open
2 tasks
Tracked by #3666
prrao87 opened this issue Jun 20, 2024 · 2 comments
Open
2 tasks
Tracked by #3666

Feature: Change range defaults and add generate_series function #3678

prrao87 opened this issue Jun 20, 2024 · 2 comments
Labels
feature New features or missing components of existing features

Comments

@prrao87
Copy link
Member

prrao87 commented Jun 20, 2024

Features

  • Change the default stop argument for range to be non-inclusive (similar to DuckDB and many programming languages)
  • Add a generate_series function to allow the user to generate series inclusively (where the stop argument is the last value of the series)

API

Other

Description

Kùzu's range function is currently inclusive of the stop argument.

kuzu> RETURN range(1,3) AS r ;
-----------
| r       |
-----------
| [1,2,3] |
-----------
(1 tuple)
(1 column)
Time: 0.15ms (compiling), 0.30ms (executing)

This is not the case in DuckDB:

D SELECT range(1,3) AS r;
┌─────────┐
│    r    │
│ int64[] │
├─────────┤
│ [1, 2]  │
└─────────┘

For inclusive range, DuckDB provides an additional function generate_series, which behaves like our current range function in Kùzu.

D SELECT * FROM generate_series(1,3);
┌─────────────────┐
│ generate_series │
│      int64      │
├─────────────────┤
│               1 │
│               2 │
│               3 │
└─────────────────┘

We should make the range behaviour more consistent with other systems and offer the convenience function generate_series, so new users don't have to rewire their thinking when coming from DuckDB.

@prrao87 prrao87 added the feature New features or missing components of existing features label Jun 20, 2024
@andyfengHKU andyfengHKU mentioned this issue Jul 10, 2024
81 tasks
@acquamarin
Copy link
Collaborator

I think we should follow neo4j style of range function which is inclusive on start and end instead of following SQL.
https://neo4j.com/docs/cypher-manual/current/functions/list/

@andyfengHKU
Copy link
Contributor

There is still generate_series(). So I'm keeping this issue open.

@andyfengHKU andyfengHKU reopened this Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New features or missing components of existing features
Projects
None yet
Development

No branches or pull requests

3 participants