You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2023/01/11 07:36:08 UTC

[GitHub] [doris] Yukang-Lian opened a new issue, #15813: [Bug] Encountered datetimev2 type returning wrong result when developing group_uniq_array function

Yukang-Lian opened a new issue, #15813:
URL: https://github.com/apache/doris/issues/15813

   ### 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
   
   master
   
   ### What's Wrong?
   
   #15339 
   When @TangSiyang2001 was developing `group_uniq_array` function and doing regression test, he found a `datetimev2` bug.
   1. creat a test table.
   ```sql
   create table test (
       c_id INT,
       c_date DATE,
       c_datev2 DATEV2,
       c_date_time DATETIME,
       c_date_timev2 DATETIMEV2(6))
            DISTRIBUTED BY HASH(c_id) BUCKETS 3
            PROPERTIES (
                   "replication_num" = "1"
            ) ;
   Query OK, 0 rows affected (0.05 sec)
   ```
   2. insert data.
   ```sql
   insert into test values(
   1, 
   '2022-12-01', 
   '2022-12-01', 
   '2022-12-01 22:23:23', 
   '2022-12-01 22:23:24.999999');
   Query OK, 1 row affected (0.14 sec)
   {'label':'insert_b85de801adae47db_a6f1d6297468dbfb', 'status':'VISIBLE', 'txnId':'1006'}
   
   insert into test values(
   2, 
   '2022-12-02', 
   '2022-12-02', 
   '2022-12-02 22:23:23', 
   '2022-12-02 22:23:24.999999');
   Query OK, 1 row affected (0.06 sec)
   {'label':'insert_8b8fd04b50674ffe_9ff5e5c2955abf50', 'status':'VISIBLE', 'txnId':'1007'}
   ```
   3. select from test table.
   ```sql
   select * from test;
   +------+------------+------------+---------------------+----------------------------+
   | c_id | c_date     | c_datev2   | c_date_time         | c_date_timev2              |
   +------+------------+------------+---------------------+----------------------------+
   |    2 | 2022-12-02 | 2022-12-02 | 2022-12-02 22:23:23 | 2022-12-02 22:23:24.999999 |
   |    1 | 2022-12-01 | 2022-12-01 | 2022-12-01 22:23:23 | 2022-12-01 22:23:24.999999 |
   +------+------------+------------+---------------------+----------------------------+
   2 rows in set (0.04 sec)
   
   select
               group_uniq_array(c_date),
               group_uniq_array(c_datev2),
               group_uniq_array(c_date_time),
               group_uniq_array(c_date_timev2)
   from test;
   +----------------------------+------------------------------+--------------------------------------------+-----------------------------------+
   | group_uniq_array(`c_date`) | group_uniq_array(`c_datev2`) | group_uniq_array(`c_date_time`)            | group_uniq_array(`c_date_timev2`) |
   +----------------------------+------------------------------+--------------------------------------------+-----------------------------------+
   | [2022-12-02, 2022-12-01]   | [2022-12-01, 2022-12-02]     | [2022-12-02 22:23:23, 2022-12-01 22:23:23] | [, ]                              |
   +----------------------------+------------------------------+--------------------------------------------+-----------------------------------+
   1 row in set (0.09 sec)
   ```
   
   We have tested functions `add`, `merge`, `insert_result_into` in `aggregate_function_group_uniq_array.h` return the right results for `datetimev2`.
   
   ### What You Expected?
   
   ```sql
   select
               group_uniq_array(c_date),
               group_uniq_array(c_datev2),
               group_uniq_array(c_date_time),
               group_uniq_array(c_date_timev2)
   from test;
   +----------------------------+------------------------------+--------------------------------------------+-----------------------------------+
   | group_uniq_array(`c_date`) | group_uniq_array(`c_datev2`) | group_uniq_array(`c_date_time`)            | group_uniq_array(`c_date_timev2`) |
   +----------------------------+------------------------------+--------------------------------------------+-----------------------------------+
   | [2022-12-02, 2022-12-01]   | [2022-12-01, 2022-12-02]     | [2022-12-02 22:23:23, 2022-12-01 22:23:23] | [2022-12-02 22:23:24.999999, 2022-12-01 22:23:24.999999]                              |
   +----------------------------+------------------------------+--------------------------------------------+-----------------------------------+
   ```
   
   ### 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: commits-unsubscribe@doris.apache.org.apache.org

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


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


[GitHub] [doris] Gabriel39 closed issue #15813: [Bug] datetimev2 type returning wrong result when developing group_uniq_array function

Posted by GitBox <gi...@apache.org>.
Gabriel39 closed issue #15813: [Bug] datetimev2 type returning wrong result when developing group_uniq_array function
URL: https://github.com/apache/doris/issues/15813


-- 
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-unsubscribe@doris.apache.org

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


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