cambyzju opened a new pull request, #15745: URL: https://github.com/apache/doris/pull/15745
# Proposed changes Issue Number: close #xxx ## Problem summary Describe your changes. 1. Having clause of Mysql is really very complex, we are hard to follow all rules, so we revert [pr15143](https://github.com/apache/doris/pull/15143) to keep the logic the same as before. 2. But the origin implementation has problem while having clause has multi-conditions. For example: case1: here `v2` inside having clause use table column `test_having_alias_tb.v2` `SELECT id, v1-2 as v, sum(v2) v2 FROM test_having_alias_tb GROUP BY id,v having(v2>1);` `ERROR 1105 (HY000): errCode = 2, detailMessage = HAVING clause not produced by aggregation output (missing from GROUP BY clause?): (`v2` > 1)` case2: here `v2` inside having clause use alias name `v2` =`sum(test_having_alias_tb.v2)`, another condition make logic of v2 differently. `SELECT id, v1-2 as v, sum(v2) v2 FROM test_having_alias_tb GROUP BY id,v having(v>0 AND v2>1) ORDER BY id,v;` ``` +------+------+------+ | id | v | v2 | +------+------+------+ | 2 | 1 | 3 | +------+------+------+ ``` ## Checklist(Required) 1. Does it affect the original behavior: - [ ] Yes - [ ] No - [ ] I don't know 4. Has unit tests been added: - [ ] Yes - [ ] No - [ ] No Need 5. Has document been added or modified: - [ ] Yes - [ ] No - [ ] No Need 6. Does it need to update dependencies: - [ ] Yes - [ ] No 7. Are there any changes that cannot be rolled back: - [ ] Yes (If Yes, please explain WHY) - [ ] No ## Further comments If this is a relatively large or complex change, kick off the discussion at [[email protected]](mailto:[email protected]) by explaining why you chose the solution you did and what alternatives you considered, etc... -- 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]
