xavierzhao opened a new issue, #24905:
URL: https://github.com/apache/doris/issues/24905

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   Git : git://VM-16-12-centos@30d35c414034a82a66ab8064de2076cea77ac38c
   
   Version : doris-2.0.1-rc04
   
   BuildInfo : VM-16-12-centos
   
   BuildTime : Tue, 29 Aug 2023 10:35:46 UTC
   
   
   
   ### What's Wrong?
   
   ```sql
   CREATE TABLE sequence_count_test3(
                   `uid` int COMMENT 'user id',
                   `date` datetime COMMENT 'date time', 
                   `number` int NULL COMMENT 'number' 
                   )
   DUPLICATE KEY(uid) 
   DISTRIBUTED BY HASH(uid) BUCKETS 3 
   PROPERTIES ( 
       "replication_num" = "1"
   ); ```
   ```sql
   INSERT INTO sequence_count_test3(uid, date, number) values (1, '2022-11-02 
10:41:00', 1),
                                                      (2, '2022-11-02 
11:41:00', 7),
                                                      (3, '2022-11-02 
16:15:01', 3),
                                                      (4, '2022-11-02 
19:05:04', 4),
                                                      (5, '2022-11-02 
21:24:12', 5);
   ```
   
   ```sql
   SELECT
        uid,
        DATE,
        e.NUMBER AS EVENT_GROUP,
   CASE
                
                WHEN (
                        (
                                UNIX_TIMESTAMP( DATE ) - (
                                        lag ( UNIX_TIMESTAMP( DATE ), 1, 0 ) 
over ( PARTITION BY uid ORDER BY DATE  ) 
                                ) 
                        ) > 600 
                        ) THEN
                        1 ELSE 0 
                END AS SESSION_FLAG 
        FROM
                sequence_count_test6 e 
   ```
   
   uid | date | EVENT_GROUP | SESSION_FLAG
   -- | -- | -- | --
   1 | 2022-11-02 10:42:00 | 1 | 1
   1 | 2022-11-02 10:41:00 | 1 | 1
   2 | 2022-11-02 11:41:00 | 7 | 1
   3 | 2022-11-02 16:15:01 | 3 | 1
   4 | 2022-11-02 19:05:04 | 4 | 1
   5 | 2022-11-02 21:24:12 | 5 | 1
   1 | 2022-11-02 10:43:00 | 7 | 1
   
   ### What You Expected?
   
   
   
   uid | date | EVENT_GROUP | SESSION_FLAG
   -- | -- | -- | --
   5 | 2022-11-02 21:24:12 | 5 | 1
   4 | 2022-11-02 19:05:04 | 4 | 1
   2 | 2022-11-02 11:41:00 | 7 | 1
   1 | 2022-11-02 10:41:00 | 1 | 1
   1 | 2022-11-02 10:42:00 | 1 | 0
   1 | 2022-11-02 10:43:00 | 7 | 0
   3 | 2022-11-02 16:15:01 | 3 | 1
   
   
   
   ### How to Reproduce?
   
   _No response_
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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