GitHub user wajda opened a pull request:

    https://github.com/apache/spark/pull/21155

    SPARK-23927: Add "sequence" expression

    ## What changes were proposed in this pull request?
    The PR adds the SQL function ```sequence```.
    https://issues.apache.org/jira/browse/SPARK-23927
    
    The behavior of the function is based on Presto's one.
    Ref: https://prestodb.io/docs/current/functions/array.html
    
    - ```sequence(start, stop) → array<bigint>```
    Generate a sequence of integers from ```start``` to ```stop```, 
incrementing by ```1``` if ```start``` is less than or equal to ```stop```, 
otherwise ```-1```.
    - ```sequence(start, stop, step) → array<bigint>```
    Generate a sequence of integers from ```start``` to ```stop```, 
incrementing by ```step```.
    - ```sequence(start_date, stop_date) → array<date>```
    Generate a sequence of dates from ```start_date``` to ```stop_date```, 
incrementing by ```interval 1 day``` if ```start_date``` is less than or equal 
to ```stop_date```, otherwise ```- interval 1 day```.
    - ```sequence(start_date, stop_date, step_interval) → array<date>```
    Generate a sequence of dates from ```start_date``` to ```stop_date```, 
incrementing by ```step_interval```. The type of ```step_interval``` is 
```CalendarInterval```.
    - ```sequence(start, stop) → array<timestamp>```
    Generate a sequence of timestamps from start timestamps to stop timestamps, 
incrementing by 1 day if start date is less than or equal to stop date, 
otherwise -1 day.
    - ```sequence(start_timestamp, stop_timestamp, step_interval) → 
array<timestamp>```
    Generate a sequence of timestamps from ```start_timestamps``` to 
```stop_timestamps```, incrementing by ```interval 1 day``` if 
```start_timestamp``` is less than or equal to ```stop_timestamp```, otherwise 
```- interval 1 day```.
    
    ## How was this patch tested?
    
    Added unit tests.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/AbsaOSS/spark feature/array-api-sequence

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/21155.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #21155
    
----
commit 5cc7d875ef98556ebda8fd91e4e94b898e39e18a
Author: Vayda, Oleksandr: IT (PRG) <oleksandr.vayda@...>
Date:   2018-04-12T14:57:11Z

    SPARK-23927: Add "sequence" expression

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to