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

   ### 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
   
   master
   
   ### What's Wrong?
   
   ```
   SELECT k1 FROM test GROUP BY k1 HAVING k1 IN (SELECT k1 FROM baseall WHERE 
k2 >= (SELECT min(k3) FROM bigtable WHERE k2 = baseall.k2));
   ERROR 1105 (HY000): errCode = 2, detailMessage = errCode = 2, detailMessage 
= Unknown column 'k2' in 'baseall'
   ```
   
   ### What You Expected?
   
   not exception
   
   ### How to Reproduce?
   
   ```
   CREATE TABLE `test` (
     `k1` tinyint(4) NULL,
     `k2` smallint(6) NULL,
     `k3` int(11) NULL,
     `k4` bigint(20) NULL,
     `k5` decimal(9, 3) NULL,
     `k6` char(5) NULL,
     `k10` date NULL,
     `k11` datetime NULL,
     `k7` varchar(20) NULL,
     `k8` double MAX NULL,
     `k9` float SUM NULL
   ) ENGINE=OLAP
   AGGREGATE KEY(`k1`, `k2`, `k3`, `k4`, `k5`, `k6`, `k10`, `k11`, `k7`)
   COMMENT 'OLAP'
   PARTITION BY RANGE(`k1`)
   (PARTITION p1 VALUES [("-128"), ("-64")),
   PARTITION p2 VALUES [("-64"), ("0")),
   PARTITION p3 VALUES [("0"), ("64")),
   PARTITION p4 VALUES [("64"), (MAXVALUE)))
   DISTRIBUTED BY HASH(`k1`) BUCKETS 5
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 3",
   "in_memory" = "false",
   "storage_format" = "V2",
   "disable_auto_compaction" = "false"
   );
   
    CREATE TABLE `baseall` (
     `k1` tinyint(4) NULL,
     `k2` smallint(6) NULL,
     `k3` int(11) NULL,
     `k4` bigint(20) NULL,
     `k5` decimal(9, 3) NULL,
     `k6` char(5) NULL,
     `k10` date NULL,
     `k11` datetime NULL,
     `k7` varchar(20) NULL,
     `k8` double MAX NULL,
     `k9` float SUM NULL
   ) ENGINE=OLAP
   AGGREGATE KEY(`k1`, `k2`, `k3`, `k4`, `k5`, `k6`, `k10`, `k11`, `k7`)
   COMMENT 'OLAP'
   DISTRIBUTED BY HASH(`k1`) BUCKETS 5
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 3",
   "in_memory" = "false",
   "storage_format" = "V2",
   "disable_auto_compaction" = "false"
   );
   
   CREATE TABLE `bigtable` (
     `k1` tinyint(4) NULL,
     `k2` smallint(6) NULL,
     `k3` int(11) NULL,
     `k4` bigint(20) NULL,
     `k5` decimal(9, 3) NULL,
     `k6` char(5) NULL,
     `k10` date NULL,
     `k11` datetime NULL,
     `k7` varchar(20) NULL,
     `k8` double MAX NULL,
     `k9` float SUM NULL
   ) ENGINE=OLAP
   AGGREGATE KEY(`k1`, `k2`, `k3`, `k4`, `k5`, `k6`, `k10`, `k11`, `k7`)
   COMMENT 'OLAP'
   DISTRIBUTED BY HASH(`k1`) BUCKETS 5
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 3",
   "in_memory" = "false",
   "storage_format" = "V2",
   "disable_auto_compaction" = "false"
   );
   
   SELECT k1 FROM test GROUP BY k1 HAVING k1 IN (SELECT k1 FROM baseall WHERE 
k2 >= (SELECT min(k3) FROM bigtable WHERE k2 = baseall.k2));
   ```
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] 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: [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