Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix](agg) Aggregating string types with null values may result in in…
…correct result (#42067) Aggregating string types with null values may result in incorrect result because using the replace_column_data function can cause incorrect offsets in the column. A reproducible case: ``` CREATE TABLE `test_scan_keys_with_bool_type` ( `col1` tinyint NOT NULL, `col2` int NOT NULL, `col3` tinyint NOT NULL, `col5` boolean REPLACE NOT NULL, `col4` datetime(2) REPLACE NOT NULL, `col6` double REPLACE_IF_NOT_NULL NULL, `col7` varchar(100) REPLACE_IF_NOT_NULL NULL ) ENGINE=OLAP AGGREGATE KEY(`col1`, `col2`, `col3`) DISTRIBUTED BY HASH(`col1`, `col2`, `col3`) BUCKETS 1 PROPERTIES ( "replication_allocation" = "tag.location.default: 1", "disable_auto_compaction" = "true" ); insert into test_scan_keys_with_bool_type values ( -100 , 1 , -82 , 1 , '2024-02-16 04:37:37.00' , -1299962421.904282 , NULL ), ( -100 , 0 , -82 , 1 , '2024-02-16 04:37:37.00' , -1299962421.904282 , "hi" ), ( -100 , 1 , 92 , 1 , '2024-02-16 04:37:37.00' , 23423423.0324234 , NULL ); insert into test_scan_keys_with_bool_type values ( -100 , 1 , 1 , 1 , '2024-02-16 04:37:37.00' , -1299962421.904282 , "doris" ); MySQL [test]> select * from test_scan_keys_with_bool_type; +------+------+------+------+------------------------+---------------------+-------+ | col1 | col2 | col3 | col5 | col4 | col6 | col7 | +------+------+------+------+------------------------+---------------------+-------+ | -100 | 0 | -82 | 1 | 2024-02-16 04:37:37.00 | -1299962421.9042821 | hi | | -100 | 1 | -82 | 1 | 2024-02-16 04:37:37.00 | -1299962421.9042821 | NULL | | -100 | 1 | 1 | 1 | 2024-02-16 04:37:37.00 | -1299962421.9042821 | hidor | | -100 | 1 | 92 | 1 | 2024-02-16 04:37:37.00 | 23423423.0324234 | NULL | +------+------+------+------+------------------------+---------------------+-------+ 4 rows in set (0.057 sec) MySQL [test]> set skip_storage_engine_merge = true; select * from test_scan_keys_with_bool_type; +------+------+------+------+------------------------+---------------------+-------+ | col1 | col2 | col3 | col5 | col4 | col6 | col7 | +------+------+------+------+------------------------+---------------------+-------+ | -100 | 0 | -82 | 1 | 2024-02-16 04:37:37.00 | -1299962421.9042821 | hi | | -100 | 1 | -82 | 1 | 2024-02-16 04:37:37.00 | -1299962421.9042821 | NULL | | -100 | 1 | 92 | 1 | 2024-02-16 04:37:37.00 | 23423423.0324234 | NULL | | -100 | 1 | 1 | 1 | 2024-02-16 04:37:37.00 | -1299962421.9042821 | doris | +------+------+------+------+------------------------+---------------------+-------+ 4 rows in set (0.023 sec) ``` #33493 By supporting variant type aggregation, this issue has been resolved.So versions after 2.1 do not have this issue.
- Loading branch information