csun5285 opened a new pull request, #68620:
URL: https://github.com/apache/doris/pull/68620

   ### What problem does this PR solve?
   
   
   A NULL argument of array_range, or its alias sequence, gives NULL for its 
row. #41739 removed the NULL handling of array_range and let the default NULL 
handling of the function framework do it. The default NULL handling runs the 
function on every row, including the value under a NULL, and sets NULL on the 
result only afterwards. The value under a NULL start can be far from the end, 
so the range is larger than the array size limit and the whole query fails:
   
       CREATE TABLE t (id INT, s DATETIME(6) NULL, e DATETIME(6), p INT) 
DUPLICATE KEY(id)
       DISTRIBUTED BY HASH(id) BUCKETS 1 PROPERTIES ('replication_num' = '1');
       INSERT INTO t VALUES (2, '2024-01-01 00:00:00.123456', '2024-01-01 
00:00:03.123456', 1),
                            (3, NULL, '2024-01-02 00:00:00', 1);
       SELECT id, sequence(s, e, INTERVAL p SECOND) FROM t ORDER BY id;
       -- before: [INVALID_ARGUMENT]Array size exceeds the limit 1000000
       -- after:  2  ["2024-01-01 00:00:00.123456", "2024-01-01 
00:00:01.123456",
       --             "2024-01-01 00:00:02.123456"]
       --         3  NULL
   
   Each row alone gives the right result, because the default NULL handling 
does not run the function when an argument has only NULL. The integer version 
fails in the same way, for example array_range(s, e) with the rows (1, 3) and 
(NULL, 5000000).
   
   this PR solve?
   
   Issue Number: close #xxx
   
   Related PR: #xxx
   
   Problem Summary:
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [ ] Regression test
       - [ ] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason <!-- Add your reason?  -->
   
   - Behavior changed:
       - [ ] No.
       - [ ] Yes. <!-- Explain the behavior change -->
   
   - Does this need documentation?
       - [ ] No.
       - [ ] Yes. <!-- Add document PR link here. eg: 
https://github.com/apache/doris-website/pull/1214 -->
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label <!-- Add branch pick label that this PR should 
merge into -->
   
   


-- 
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