EmmyMiao87 opened a new issue #3205: The 'between and' in having subquery is not rewritten. URL: https://github.com/apache/incubator-doris/issues/3205 **Describe the bug** query: ``` select k1, sum (k2) from all_type_table group by k1 having sum(k2) > (select k1 from all_type_table where k2 between 1 and 2); ERROR 1064 (HY000): BetweenPredicate needs to be rewritten into a CompoundPredicate. `` TPC-DS 14 throws the same error. **To Reproduce** 1. create table ``` CREATE TABLE `all_type_table` ( `k1` tinyint(4) NULL COMMENT "", `k2` smallint(6) NULL COMMENT "", `k3` int(11) NULL COMMENT "", `k4` bigint(20) NULL COMMENT "", `k5` largeint(40) NULL COMMENT "", `k6` float NULL COMMENT "", `k7` double NULL COMMENT "" ) ENGINE=OLAP DUPLICATE KEY(`k1`) COMMENT "OLAP" DISTRIBUTED BY HASH(`k1`) BUCKETS 3 PROPERTIES ( "storage_type" = "COLUMN", "replication_num" = "1", "in_memory" = "false" ); ``` 2. query ``` select k1, sum (k2) from all_type_table group by k1 having sum(k2) > (select k1 from all_type_table where k2 between 1 and 2); ``` **Expected behavior** subquery in having clause should be rewritten too. TPC-DS 14 should be passed.
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org