zys-mark commented on issue #60857:
URL: https://github.com/apache/doris/issues/60857#issuecomment-4035439242

   【复现步骤】
   1. 建表
     ```SQL
     CREATE TABLE  test.order_info_shuffle
     (
      `order_id` varchar(20) COMMENT "订单id",
      `user_id` varchar(20) COMMENT "用户id",
      `goods_id` VARCHAR(20) COMMENT "商品id",
      `goods_num` Int COMMENT "商品数量",
      `price` double COMMENT "商品价格"
     )
     duplicate KEY(`order_id`)
     DISTRIBUTED BY HASH(`order_id`) BUCKETS 5
         properties("replication_num" = "1");
     ```
   
   2. 插入数据
     ```
     insert into test.order_info_shuffle values
     ('o001','u001','g001',1,9.9 ),
     ('o001','u001','g002',2,19.9),
     ('o001','u001','g003',2,39.9),
     ('o002','u002','g001',3,9.9 ),
     ('o002','u002','g002',1,19.9),
     ('o003','u002','g003',1,39.9),
     ('o003','u002','g002',2,19.9),
     ('o003','u002','g004',3,99.9),
     ('o003','u002','g005',1,99.9),
     ('o004','u003','g001',2,9.9 ),
     ('o004','u003','g002',1,19.9),
     ('o004','u003','g003',4,39.9),
     ('o004','u003','g004',1,99.9),
     ('o004','u003','g005',4,89.9);
     ```
   
   3. 等待后台线程刷新统计信息后,查看列统计信息(此时 hot_values 列是有值的)
   ```SQL
   show column stats test.order_info_shuffle;
   
+-------------+--------------------+-------+------+----------+-----------+---------------+--------+--------+--------+--------------+---------+-------------+---------------------+-------------+------------------------+----------------------+-------------------------------------------------------------+
   | column_name | index_name         | count | ndv  | num_null | data_size | 
avg_size_byte | min    | max    | method | type         | trigger | query_times 
| updated_time        | update_rows | last_analyze_row_count | 
last_analyze_version | hot_values                                               
   |
   
+-------------+--------------------+-------+------+----------+-----------+---------------+--------+--------+--------+--------------+---------+-------------+---------------------+-------------+------------------------+----------------------+-------------------------------------------------------------+
   | order_id    | order_info_shuffle | 14.0  | 4.0  | 0.0      | 56.0      | 
4.0           | 'o001' | 'o004' | SAMPLE | FUNDAMENTALS | SYSTEM  | 0           
| 2026-03-11 08:45:58 | 0           | 14                     | 3                
    | 'o004':0.36;'o003':0.29;'o001':0.21;'o002':0.14             |
   | goods_id    | order_info_shuffle | 14.0  | 5.0  | 0.0      | 56.0      | 
4.0           | 'g001' | 'g005' | SAMPLE | FUNDAMENTALS | SYSTEM  | 0           
| 2026-03-11 08:45:58 | 0           | 14                     | 3                
    | 'g002':0.29;'g003':0.21;'g001':0.21;'g004':0.14;'g005':0.14 |
   | user_id     | order_info_shuffle | 14.0  | 3.0  | 0.0      | 56.0      | 
4.0           | 'u001' | 'u003' | SAMPLE | FUNDAMENTALS | SYSTEM  | 0           
| 2026-03-11 08:45:58 | 0           | 14                     | 3                
    | 'u002':0.43;'u003':0.36;'u001':0.21                         |
   | goods_num   | order_info_shuffle | 14.0  | 4.0  | 0.0      | 56.0      | 
4.0           | 1      | 4      | SAMPLE | FUNDAMENTALS | SYSTEM  | 0           
| 2026-03-11 08:45:58 | 0           | 14                     | 3                
    | 1:0.43;2:0.29;4:0.14;3:0.14                                 |
   | price       | order_info_shuffle | 14.0  | 5.0  | 0.0      | 112.0     | 
8.0           | 9.9    | 99.9   | SAMPLE | FUNDAMENTALS | SYSTEM  | 0           
| 2026-03-11 08:45:58 | 0           | 14                     | 3                
    | 19.9:0.29;99.9:0.21;9.9:0.21;39.9:0.21                      |
   
+-------------+--------------------+-------+------+----------+-----------+---------------+--------+--------+--------+--------------+---------+-------------+---------------------+-------------+------------------------+----------------------+-------------------------------------------------------------+
   ```
   
   4. 执行 analyze 
   ```
   analyze table test.order_info_shuffle;
   ```
   
   5. 查看列统计信息(此时 hot_values 丢失,变为 null)
   ```
   show column stats test.order_info_shuffle;
   
+-------------+--------------------+-------+------+----------+-----------+---------------+--------+--------+--------+--------------+---------+-------------+---------------------+-------------+------------------------+----------------------+------------+
   | column_name | index_name         | count | ndv  | num_null | data_size | 
avg_size_byte | min    | max    | method | type         | trigger | query_times 
| updated_time        | update_rows | last_analyze_row_count | 
last_analyze_version | hot_values |
   
+-------------+--------------------+-------+------+----------+-----------+---------------+--------+--------+--------+--------------+---------+-------------+---------------------+-------------+------------------------+----------------------+------------+
   | order_id    | order_info_shuffle | 14.0  | 4.0  | 0.0      | 56.0      | 
4.0           | 'o001' | 'o004' | FULL   | FUNDAMENTALS | MANUAL  | 0           
| 2026-03-11 08:46:43 | 0           | 14                     | 3                
    | null       |
   | goods_id    | order_info_shuffle | 14.0  | 5.0  | 0.0      | 56.0      | 
4.0           | 'g001' | 'g005' | FULL   | FUNDAMENTALS | MANUAL  | 0           
| 2026-03-11 08:46:43 | 0           | 14                     | 3                
    | null       |
   | user_id     | order_info_shuffle | 14.0  | 3.0  | 0.0      | 56.0      | 
4.0           | 'u001' | 'u003' | FULL   | FUNDAMENTALS | MANUAL  | 0           
| 2026-03-11 08:46:43 | 0           | 14                     | 3                
    | null       |
   | goods_num   | order_info_shuffle | 14.0  | 4.0  | 0.0      | 56.0      | 
4.0           | 1      | 4      | FULL   | FUNDAMENTALS | MANUAL  | 0           
| 2026-03-11 08:46:43 | 0           | 14                     | 3                
    | null       |
   | price       | order_info_shuffle | 14.0  | 5.0  | 0.0      | 112.0     | 
8.0           | 9.9    | 99.9   | FULL   | FUNDAMENTALS | MANUAL  | 0           
| 2026-03-11 08:46:43 | 0           | 14                     | 3                
    | null       |
   
+-------------+--------------------+-------+------+----------+-----------+---------------+--------+--------+--------+--------------+---------+-------------+---------------------+-------------+------------------------+----------------------+------------+
   5 rows in set (0.01 sec)
   ```
   
   【预期结果】
   1. 执行 analyze table 后 hot_values 应保持不变;
   
   【实际结果】
   1. 执行 analyze table 后 hot_values 丢失,变为 null;
   


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