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

   ### 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
   
   doris 1.2.1
   
   ### What's Wrong?
   
   同一条语句,数据有时可以查询出来,有时无法查询。
   语句:
   ```
   SELECT
       /*+SET_VAR(parallel_fragment_exec_instance_num=4)  */
       p.enterprise_id,
       u.id  user_name,
       p.id  pack_id,
       f.id  frame_id,
       t.id  TId,
       t.ticket_id,
       UNIX_TIMESTAMP(p.post_time),
       UNIX_TIMESTAMP(t.post_time),
       UNIX_TIMESTAMP(f.post_time)
   FROM
       gsms_user_5  AS  u
       JOIN  gsms_msg_pack_sms_8  AS  p  ON  u.id  =  p.user_id
       JOIN  gsms_msg_frame_sms_8  AS  f  ON  p.id  =  f.msg_pack_id  AND  
f.post_time  =  p.post_time
       JOIN  gsms_msg_ticket_sms_8  t
           ON  t.frame_id  =  f.id  AND  t.post_time  =  p.post_time
   WHERE  t.user_id  =  182615
   --  AND  p.enterprise_id  =  186213
         
       AND  p.post_time  >=  '2022-12-23  00:00:00'
       AND  p.post_time  <=  '2022-12-26  00:00:00'
       AND  p.msg_type  IN  (0,  1)
       AND  (
           t.sms_type  =  0
           OR  (t.sms_type  =  2
               AND  t.number  =  1)
       )
   ORDER  BY  t.id
   LIMIT  0,  20
   ```
   表结构:
   ```
   CREATE TABLE `gsms_msg_pack_sms_8` (
     `enterprise_id` INT(11) NULL COMMENT "",
     `post_time` DATETIME NULL COMMENT "",
      `id` BIGINT(20) NOT NULL COMMENT "",
     `biz_type` INT(11) NULL COMMENT "",
     `user_id` INT(11) NULL COMMENT ""
   ) ENGINE=OLAP
   UNIQUE  KEY(`enterprise_id`,`post_time`,`id`)
   COMMENT "OLAP"
   PARTITION BY RANGE(`post_time`)()
   DISTRIBUTED BY HASH(`id`) BUCKETS 6
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 3",
   "in_memory" = "false",
   "storage_format" = "V2",
   "dynamic_partition.enable" = "true",  
   "dynamic_partition.time_unit" = "DAY", 
   "dynamic_partition.end" = "30",
   "dynamic_partition.prefix" = "p_",
   "dynamic_partition.buckets" = "6",
   "dynamic_partition.create_history_partition"="true",   
   "dynamic_partition.history_partition_num"= "365",
   "enable_unique_key_merge_on_write" = "true"
   );
   
   CREATE TABLE `gsms_msg_frame_sms_8` (
     `msg_pack_id` BIGINT(20) NULL COMMENT "",
     `post_time` DATETIME NULL COMMENT "",
     `id` BIGINT(20) NOT NULL COMMENT "",
     `biz_type` INT(11) NULL COMMENT "",
     `state` INT(11) NULL COMMENT "",
     `pack_uuid` VARCHAR(108) NULL COMMENT "",
     `enterprise_id` INT(11) NULL COMMENT "",
     `user_id` INT(11) NULL COMMENT ""
   ) ENGINE=OLAP
   UNIQUE KEY(`msg_pack_id`,`post_time`,`id`)
   COMMENT "OLAP"
   PARTITION BY RANGE(`post_time`)()
   DISTRIBUTED BY HASH(`msg_pack_id`) BUCKETS 6
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 3",
   "in_memory" = "false",
   "storage_format" = "V2",
   "dynamic_partition.enable" = "true",  
   "dynamic_partition.time_unit" = "DAY", 
   "dynamic_partition.end" = "30",
   "dynamic_partition.prefix" = "f_",
   "dynamic_partition.buckets" = "6",
   "dynamic_partition.create_history_partition"="true",   
   "dynamic_partition.history_partition_num"= "365",
     "enable_unique_key_merge_on_write" = "true"
   );
   
   CREATE TABLE `gsms_msg_ticket_sms_8` (
     `frame_id` BIGINT(20) NULL COMMENT "",
     `ticket_id` BIGINT(20) NULL COMMENT "",
     `post_time` DATETIME NULL COMMENT "",
     `pack_id` BIGINT(20) NULL COMMENT "",
     `biz_type` INT(11) NULL COMMENT "",
     `id` BIGINT(20) NOT NULL COMMENT "",
     `pack_uuid` VARCHAR(108) NULL COMMENT "",
     `enterprise_id` INT(11) NULL COMMENT "",
     `total` INT(11) NULL COMMENT "",
     `number` INT(11) NULL COMMENT "",
     `user_id` INT(11) NULL COMMENT ""
   ) ENGINE=OLAP
   UNIQUE KEY(`frame_id`,`ticket_id`,`post_time`)
   COMMENT "OLAP"
   PARTITION BY RANGE(`post_time`)()
   DISTRIBUTED BY HASH(`frame_id`) BUCKETS 11
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 3",
   "in_memory" = "false",
   "storage_format" = "V2",
   "dynamic_partition.enable" = "true",  
   "dynamic_partition.time_unit" = "DAY", 
   "dynamic_partition.end" = "30",
   "dynamic_partition.prefix" = "t_",
   "dynamic_partition.buckets" = "11",
   "dynamic_partition.create_history_partition"="true",   
   "dynamic_partition.history_partition_num"= "365",
   "enable_unique_key_merge_on_write" = "true"
   );
   ```
   连续两次查询,一次有数据,一次没数据。
   有数据的profile:
   
[941d75bb41da4b55-b4ef4467d4e42914-queryProfile.txt](https://github.com/apache/doris/files/10821727/941d75bb41da4b55-b4ef4467d4e42914-queryProfile.txt)
   
   没有数据的profile:
   
[af9c615c35d84899-abae3b01b483deab-queryProfile.txt](https://github.com/apache/doris/files/10821737/af9c615c35d84899-abae3b01b483deab-queryProfile.txt)
   
   语句的explain:
   
[问题语句的explain.txt](https://github.com/apache/doris/files/10821767/explain.txt)
   
   
   
   ### What You Expected?
   
   排查下具体原因
   
   ### 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