1fanwang opened a new pull request, #5219: URL: https://github.com/apache/calcite/pull/5219
## Jira Link [CALCITE-7558](https://issues.apache.org/jira/browse/CALCITE-7558) ## Changes Proposed A lattice can contain a built-in aggregate and a user-defined aggregate with the same name. `Lattice.Measure.compareTo()` treated those measures as equal even when `SqlOperator.equals()` did not, so the builder's `TreeSet` silently discarded one of them. Current main retains one of three unequal measures in the regression; this branch retains all three. The natural order still compares arguments, aggregate name, and the distinct flag in the same order as before. Aggregate kind and implementation class now break only ties that previously collapsed unequal measures. ### Testing ```console $ SOURCE=core/src/main/java/org/apache/calcite/materialize/Lattice.java $ git checkout c46c70cb26 -- "$SOURCE" $ JAVA_HOME=$(/usr/libexec/java_home -v 21) ./gradlew :core:test \ --tests 'org.apache.calcite.materialize.LatticeSuggesterTest.testMeasureNaturalOrderingKeepsDistinctAggregatorsWithSameName' \ --no-daemon --console=plain Expected: a collection with size <3> but: collection size was <1> $ git checkout a8981422fa -- "$SOURCE" $ JAVA_HOME=$(/usr/libexec/java_home -v 21) ./gradlew :core:test \ --tests 'org.apache.calcite.materialize.LatticeSuggesterTest.testMeasureNaturalOrderingKeepsDistinctAggregatorsWithSameName' \ --no-daemon --console=plain 0.1sec, 1 completed, 0 failed, 0 skipped BUILD SUCCESSFUL ``` -- 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]
