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

   ### 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
   
   1.2.4.1-rc01
   
   ### What's Wrong?
   
   仅改变查询条件中的时间分区mt,得到不同的结果。示例和表结构如下:
   
   其中Query SQL1的结果是正确的,Query SQL2的结果少了6条:
   2023-04-01
   2023-04-01
   2023-05-01
   2023-05-01
   2023-05-01
   2023-05-01
   
   Query SQL1:
   ```sql
   SELECT
       mt
   FROM
       test_table
   WHERE
       mt >= STR_TO_DATE('20230401', '%Y%m%d')
       AND
       mt <= STR_TO_DATE('20230501', '%Y%m%d')
       AND
       zone_new = '-1'
       AND
       second_dept = '-1'
       AND
       project = '-1'
       AND
       tag_id = -1
       AND
       room_id = -1
       AND
       is_new = -1
       AND
       pk_parent_type = '-1'
       AND
       pk_type = '-1'
       AND
       raffle_type = '-1'
       AND
       user_type = '-1'
       AND
       anchor_type = '-1'
       AND
       hd_type = '-1'
       AND
       host_type = '-1'
       AND
       template_type = '-1'
   ORDER BY mt
   ;
   ```
   
   Result 2:
   
![image](https://github.com/apache/doris/assets/19779893/fbe78409-1b83-4508-94b1-e1c770913f90)
   
   
   Query SQL2:
   ```sql
   SELECT
       mt
   FROM
       test_table
   WHERE
       mt >= STR_TO_DATE('20230301', '%Y%m%d')
       AND
       mt <= STR_TO_DATE('20230501', '%Y%m%d')
       AND
       zone_new = '-1'
       AND
       second_dept = '-1'
       AND
       project = '-1'
       AND
       tag_id = -1
       AND
       room_id = -1
       AND
       is_new = -1
       AND
       pk_parent_type = '-1'
       AND
       pk_type = '-1'
       AND
       raffle_type = '-1'
       AND
       user_type = '-1'
       AND
       anchor_type = '-1'
       AND
       hd_type = '-1'
       AND
       host_type = '-1'
       AND
       template_type = '-1'
   ORDER BY mt
   ;
   ```
   
   Result 1:
   
![image](https://github.com/apache/doris/assets/19779893/9befa4ca-58cd-4884-b865-ae73add5713b)
   
   
   Table DDL:
   ```sql
   CREATE TABLE `test_table` (
     `mt` date NULL COMMENT '',
     `room_id` bigint(20) NULL COMMENT '',
     `tag_id` bigint(20) NULL COMMENT '',
     `zone_new` varchar(255) NULL COMMENT '',
     `pk_parent_type` varchar(255) NULL COMMENT '',
     `pk_type` varchar(255) NULL COMMENT '',
     `raffle_type` varchar(255) NULL COMMENT '',
     `user_type` varchar(255) NULL COMMENT '',
     `anchor_type` varchar(255) NULL COMMENT '',
     `hd_parent_type` varchar(255) NULL COMMENT '',
     `hd_type` varchar(255) NULL COMMENT '',
     `is_new` bigint(20) NULL COMMENT '',
     `template_type` varchar(255) NULL COMMENT '',
     `host_type` varchar(255) NULL COMMENT '',
     `second_dept` varchar(255) NULL COMMENT '',
     `project` varchar(255) NULL COMMENT '',
   ) ENGINE=OLAP
   UNIQUE KEY(`mt`, `room_id`, `tag_id`, `zone_new`, `pk_parent_type`, 
`pk_type`, `raffle_type`, `user_type`, `anchor_type`, `hd_parent_type`, 
`hd_type`, `is_new`, `template_type`, `host_type`, `second_dept`, `project`)
   COMMENT ''
   PARTITION BY RANGE(`mt`)()
   DISTRIBUTED BY HASH(`mt`, `room_id`) BUCKETS 8
   PROPERTIES (
   "dynamic_partition.enable" = "true",
   "dynamic_partition.time_unit" = "MONTH",
   "dynamic_partition.time_zone" = "Asia/Shanghai",
   "dynamic_partition.start" = "-12",
   "dynamic_partition.end" = "1",
   "dynamic_partition.prefix" = "p",
   "dynamic_partition.replication_allocation" = "tag.location.default: 3",
   "dynamic_partition.buckets" = "8",
   "dynamic_partition.create_history_partition" = "true",
   "dynamic_partition.history_partition_num" = "400",
   "dynamic_partition.storage_medium" = "HDD",
   "dynamic_partition.start_day_of_month" = "1",
   "in_memory" = "false",
   "storage_format" = "V2",
   "disable_auto_compaction" = "false"
   );
   ```
   
   
   ### What You Expected?
   
   当使用Query SQL2时,正确结果应该如下:
   
   mt
   2023-03-01
   2023-03-01
   2023-03-01
   2023-03-01
   2023-04-01
   2023-04-01
   2023-04-01
   2023-04-01
   2023-05-01
   2023-05-01
   2023-05-01
   2023-05-01
   
   
   ### How to Reproduce?
   
   暂时只能在我们这个表的数据集下复现此问题
   
   ### 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