apache / apache/datafusion

feat: Implement `datafusion-spark` `sequence` function

Open
#20,540 1 comment 0 reactions 1 assignee Claimed by @erenavsarogullari View on GitHub
enhancement
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Is your feature request related to a problem or challenge?

**Ref EPIC:** https://github.com/apache/datafusion/issues/15914
`datafusion-spark` submodule needs `sequence` `function` support by enabling [sequence.slt](https://github.com/apache/datafusion/blob/main/datafusion/sqllogictest/test_files/spark/array/sequence.slt):

Case1: Natural order:
```
query ?
SELECT sequence(1, 5);
----
[1, 2, 3, 4, 5]
```
Case2: Reverse order:
```
query ?
SELECT sequence(5, 1);
----
[5, 4, 3, 2, 1]
```
Case3: Date / Timestamp with interval
```
SELECT sequence(DATE '1992-01-01', DATE '1992-01-03', INTERVAL '6' HOUR)
SELECT sequence(TIMESTAMP '2023-01-01T00:00:00', TIMESTAMP '2023-01-01T00:00:00', INTERVAL '1' DAY)
```
**Ref:** https://docs.databricks.com/aws/en/sql/language-manual/functions/sequence

### Describe the solution you'd like

_No response_

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.