Hi Apache IoTDB *PR:*https://github.com/apache/iotdb/pull/17843
Thanks for pointing out the two correctness issues in PR apache/iotdb#17843 <https://github.com/apache/iotdb/pull/17843>. I have fixed both problems: 1. GROUP BY alias resolution now only treats fields from the current query source scope as input columns, so correlated outer-scope columns no longer block SELECT alias resolution in the inner query. 2. ORDER BY references to SELECT aliases now reuse the SELECT output field instead of re-analyzing the aliased expression. This avoids planning a SELECT window function again as an ORDER BY window function. I also added regression tests for both cases, including the correlated subquery case and ORDER BY on a window function alias. Verification passed with: ./mvnw test -pl iotdb-core/datanode -am -Dtest=SelectAliasReuseTest -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false -DskipITs Best, Bryan Yang(杨易达)
