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

   ### 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
   
   2.0/2.1
   
   
   
   ### What's Wrong?
   
   ```
   CREATE TABLE `test9992` (
       `ddate` date NULL,
       `time` datetime NULL,
       `id` varchar(100) NULL,
       `id1` varchar(100) NULL,
       `id2` varchar(100) NULL,
       `id3` varchar(100) NULL,
       `id4` varchar(100) NULL,
       `id5` varchar(100) NULL,
       `wrong` varchar(100) NULL,
       `zone` varchar(100) NULL
   ) ENGINE = OLAP DUPLICATE KEY(`ddate`) DISTRIBUTED BY HASH(`ddate`) BUCKETS 
1 PROPERTIES (
       "replication_allocation" = "tag.location.default: 3"
   );
   
   insert into
       test9992
   values
   (
           '2024-06-27',
           '2024-06-27 00:00:00',
           '100',
           'xxxx',
           '4',
           '',
           '123',
           'zzz',
           'ABC',
           'UTC+8'
       );
   
   SELECT
       ddate,
       id,
       id1,
       COALESCE(id2, '99999') AS id2,
       COALESCE(id4, '99999') AS id4,
       COALESCE(id5, '99999') AS id5,
       COALESCE(wrong, '99999') AS wrong,
       id3,
       min_by(wrong, time) AS first_actv_country,
       max_by(wrong, time) AS last_actv_country,
       zone
   FROM
       (
           SELECT
               ddate,
               time,
               id,
               id1,
               id2,
               id3,
               id4,
               id5,
               wrong,
               zone
           FROM
               test9992
           WHERE
               ddate >= '2024-06-27'
               AND ddate < '2024-06-28'
               AND zone IN (
                   'UTC+8',
                   'UTC+9',
                   'UTC+10'
               )
       ) a
   GROUP BY
       GROUPING SETS (
           (
               ddate,
               id,
               id1,
               id3,
               zone,
               id2,
               id4,
               id5,
               a.wrong
           ),
           (
               ddate,
               id,
               id1,
               id3,
               zone,
               id2,
               id4,
               id5
           )
       );
   
   ```
   
   will get diffence result between 2.0 and 2.1
   
   2.0 will get
   
+------------+------+------+------+------+------+-------+------+--------------------+-------------------+-------+
   | ddate      | id   | id1  | id2  | id4  | id5  | wrong | id3  | 
first_actv_country | last_actv_country | zone  |
   
+------------+------+------+------+------+------+-------+------+--------------------+-------------------+-------+
   | 2024-06-27 | 100  | xxxx | 4    | 123  | zzz  | ABC   |      | ABC         
       | ABC               | UTC+8 |
   | 2024-06-27 | 100  | xxxx | 4    | 123  | zzz  | 99999 |      | NULL        
       | NULL              | UTC+8 |
   
+------------+------+------+------+------+------+-------+------+--------------------+-------------------+-------+
   
   2.1 will get 
   
+------------+------+------+------+------+------+-------+------+--------------------+-------------------+-------+
   | ddate      | id   | id1  | id2  | id4  | id5  | wrong | id3  | 
first_actv_country | last_actv_country | zone  |
   
+------------+------+------+------+------+------+-------+------+--------------------+-------------------+-------+
   | 2024-06-27 | 100  | xxxx | 4    | 123  | zzz  | ABC   |      | ABC         
       | ABC               | UTC+8 |
   | 2024-06-27 | 100  | xxxx | 4    | 123  | zzz  | 99999 |      | ABC         
       | ABC               | UTC+8 |
   
+------------+------+------+------+------+------+-------+------+--------------------+-------------------+-------+
   
   if set enable_nereids_planner = false on 2.0 and 2.1 
   will get 
   
+------------+------+------+------+------+------+-------+------+--------------------+-------------------+-------+
   | ddate      | id   | id1  | id2  | id4  | id5  | wrong | id3  | 
first_actv_country | last_actv_country | zone  |
   
+------------+------+------+------+------+------+-------+------+--------------------+-------------------+-------+
   | 2024-06-27 | 100  | xxxx | 4    | 123  | zzz  | ABC   |      | ABC         
       | ABC               | UTC+8 |
   | 2024-06-27 | 100  | xxxx | 4    | 123  | zzz  | 99999 |      | NULL        
       | NULL              | UTC+8 |
   
+------------+------+------+------+------+------+-------+------+--------------------+-------------------+-------+
   
   ### What You Expected?
   
   which result is right?
   
   ### How to Reproduce?
   
   _No response_
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] 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: commits-unsubscr...@doris.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to