erenavsarogullari opened a new pull request, #20955:
URL: https://github.com/apache/datafusion/pull/20955

   ## Which issue does this PR close?
   - Closes #20540.
   
   ## Rationale for this change
   **Ref EPIC:** https://github.com/apache/datafusion/issues/15914
   `datafusion-spark` submodule needs `sequence function` support by following 
diverse cases and 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: Natural order with internal:
   ```
   query ?
   SELECT sequence(1, 5, 1);
   ----
   [1, 2, 3, 4, 5]
   ```
   Case4: Reverse order with internal:
   ```
   query ?
   SELECT sequence(5, 1, -1);
   ----
   [5, 4, 3, 2, 1]
   ```
   
   Case5: Date / Timestamp without interval
   ```
   SELECT sequence(DATE '1992-01-01', DATE '1992-01-03')
   SELECT sequence(TIMESTAMP '2023-01-01T00:00:00', TIMESTAMP 
'2023-01-01T00:00:00') 
   ```
   
   Case6: 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) 
   ```
   
   Case 7 & 8: Date / Timestamp with interval and reverse order
   Case 9: NULL inputs
   Case 10: Negative Cases
   **Ref:** 
https://docs.databricks.com/aws/en/sql/language-manual/functions/sequence
   
   ## What changes are included in this PR?
   This PR introduces new `datafusion-spark` `sequence` function support. 
   
   ## Are these changes tested?
   Yes, added new test cases under `sequence.slt`
   
   ## Are there any user-facing changes?
   Yes, new `datafusion-spark` `sequence` function is being added.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to