DaZuiZui opened a new pull request, #17644: URL: https://github.com/apache/iotdb/pull/17644
```text [IOTDB-17635] Fix duplicate rank window functions with different OVER clauses ``` PR 正文填这个: ```md ## Description Fixes #17635. ### Bug fix This PR fixes an incorrect result issue when the same window function appears multiple times with different `OVER` clauses. For example, two `rank()` calls with different `ORDER BY` expressions could be treated as the same function expression during planning, causing one result symbol to be reused incorrectly. ### Root cause `FunctionCall` did not include its `window` specification in AST children, equality, hashing, or shallow AST comparison. As a result, scope-aware expression deduplication and symbol mapping could consider these two expressions equivalent: ```sql rank() OVER (PARTITION BY device ORDER BY time) rank() OVER (PARTITION BY device ORDER BY value) ``` ### Fix This PR updates `FunctionCall` identity to include window-related information: - includes `window` in `FunctionCall#getChildren()`; - includes `window` and `nullTreatment` in `equals()` and `hashCode()`; - updates `shallowEquals()` to distinguish function calls with and without window specs and different null treatment; - adds an integration test for duplicate `rank()` functions with different window ordering. <hr> This PR has: - [x] been self-reviewed. - [x] added integration tests. - [x] been tested in a test IoTDB cluster. <hr> ##### Key changed/added classes (or packages if there are too many classes) in this PR - `org.apache.iotdb.commons.queryengine.plan.relational.sql.ast.FunctionCall` - `org.apache.iotdb.relational.it.db.it.IoTDBWindowFunction3IT` ``` 测试命令也可以贴在 PR comment 或正文里: ```text ./mvnw spotless:apply -pl iotdb-core/node-commons,integration-test -P with-integration-tests ./mvnw verify -DskipUTs -Dit.test=IoTDBWindowFunction3IT#testSameWindowFunctionWithDifferentOrdering -DfailIfNoTests=false -Dfailsafe.failIfNoSpecifiedTests=false -pl integration-test -am -PTableSimpleIT -P with-integration-tests git diff --check ``` -- 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]
