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 2022/04/05 09:10:57 UTC

[GitHub] [incubator-doris] heheha2012 opened a new issue, #8847: [Bug] 联合查询的结果不符合预期,不知道啥原因

heheha2012 opened a new issue, #8847:
URL: https://github.com/apache/incubator-doris/issues/8847

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/incubator-doris/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Version
   
   1.0.1
   
   ### What's Wrong?
   
   1. 涉及两张表,建表语句分写如下:
   CREATE TABLE if not exists `gw_dim_common_org_tree` (
     `tenant_id` varchar(36) NOT NULL COMMENT '租户id',
     `org_id` varchar(64) NOT NULL COMMENT '组织id',
     `org_type_code` varchar(32) DEFAULT NULL,
     `org_name` varchar(255) DEFAULT NULL,
     `parent_id` varchar(64) DEFAULT NULL,
     `sort_num` int(11) DEFAULT NULL COMMENT '排序号',
     `update_by` varchar(64) DEFAULT NULL,
     `update_time` datetime DEFAULT NULL COMMENT '最后一次更新时间',
     `remark` varchar(255) DEFAULT NULL,
     `root_id` varchar(20) DEFAULT NULL COMMENT '根节点'
   ) 
   UNIQUE KEY(`tenant_id`,`org_id`)
   COMMENT "组织关联关系表"
   DISTRIBUTED BY HASH(org_id) BUCKETS 4
   PROPERTIES("replication_num" = "3");
   
   
   
   CREATE TABLE if not exists `gw_ads_discrete_detailed_pv_wf` (
     `wfid` varchar(36) NOT NULL COMMENT '电场ID',
     `rectime` datetime NOT NULL COMMENT '标准状态发生时间',
     `discrete` decimal(8,2) NOT NULL COMMENT '离散率',
     `dim_day` varchar(10) NOT NULL COMMENT '基于rectime的日期,格式yyyy-MM-dd'
   ) 
   UNIQUE KEY(`wfid`,`rectime`)
   COMMENT "离散率数据表"
   PARTITION BY RANGE(rectime) ()
   DISTRIBUTED BY HASH(wfid)
   PROPERTIES
   (
   	"replication_num" = "3",
       "dynamic_partition.enable" = "true",
       "dynamic_partition.time_unit" = "MONTH",
       "dynamic_partition.end" = "2",
       "dynamic_partition.prefix" = "p",
       "dynamic_partition.buckets" = "8",
       "dynamic_partition.create_history_partition" = "true",
       "dynamic_partition.history_partition_num" = "20"
   );
   
   
   2. 联合查询语句如下,查询无结果:
   SELECT t.wfid orgId, t2.org_name orgName
   FROM gw_ads_discrete_detailed_pv_wf t 
   JOIN gw_dim_common_org_tree t2 ON t2.org_id = t.wfid 
   WHERE t.rectime >= '2021-01-01 00:00:00' AND t.rectime < '2021-01-03 00:00:00' 
           AND t.wfid IN ( '952724' ) ;
   4. 分别执行如下两个查询,均有结果:
   1)select * from gw_ads_discrete_detailed_pv_wf t 
   where t.rectime >= '2021-01-01 00:00:00' 
   AND t.rectime < '2021-01-03 00:00:00' 
   AND t.wfid IN ( '952724' ) ;
   2)select * from gw_dim_common_org_tree t where t.org_id = '952724';
   ![select](https://user-images.githubusercontent.com/1621300/161720383-4324199f-3a79-4dce-9576-9330f764c0db.png)
   
   如上所述,联合查询本应可查到记录,为啥查不到?
   
   
   ### 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-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] [incubator-doris] morningman closed issue #8847: [Bug] 联合查询的结果不符合预期,不知道啥原因

Posted by GitBox <gi...@apache.org>.
morningman closed issue #8847: [Bug] 联合查询的结果不符合预期,不知道啥原因
URL: https://github.com/apache/incubator-doris/issues/8847


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