feiniaofeiafei commented on code in PR #60091:
URL: https://github.com/apache/doris/pull/60091#discussion_r2739866121


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/algebra/Repeat.java:
##########
@@ -192,15 +214,11 @@ default List<Set<Integer>> 
getGroupingSetsIndexesInOutput() {
      *   `c`: 2
      * )
      */
-    default Map<Expression, Integer> indexesOfOutput() {
+    default Map<Expression, Integer> indexesOfOutput(List<Slot> outputSlots) {

Review Comment:
   done



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalRepeat.java:
##########
@@ -140,6 +140,11 @@ public List<NamedExpression> 
getGroupingScalarFunctionAlias() {
         return functionList;
     }
 
+    public Set<GroupingScalarFunction> getGroupingScalarFunctions() {
+        return new HashSet<>(

Review Comment:
   done



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/algebra/Repeat.java:
##########
@@ -160,8 +182,8 @@ default List<Set<Integer>> 
computeRepeatSlotIdList(List<Integer> slotIdList) {
      * e.g. groupingSets=((b, a), (a)), output=[a, b]
      * return ((1, 0), (1))
      */
-    default List<Set<Integer>> getGroupingSetsIndexesInOutput() {
-        Map<Expression, Integer> indexMap = indexesOfOutput();
+    default List<Set<Integer>> getGroupingSetsIndexesInOutput(List<Slot> 
outputSlots) {

Review Comment:
   done



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/algebra/Repeat.java:
##########
@@ -140,8 +162,8 @@ default GroupingSetShapes toShapes() {
      *
      * return: [(4, 3), (3)]
      */
-    default List<Set<Integer>> computeRepeatSlotIdList(List<Integer> 
slotIdList) {
-        List<Set<Integer>> groupingSetsIndexesInOutput = 
getGroupingSetsIndexesInOutput();
+    default List<Set<Integer>> computeRepeatSlotIdList(List<Integer> 
slotIdList, List<Slot> outputSlots) {

Review Comment:
   done



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/algebra/Repeat.java:
##########
@@ -117,18 +117,40 @@ default List<List<Long>> computeGroupingFunctionsValues() 
{
 
     /**
      * flatten the grouping sets and build to a GroupingSetShapes.
+     * This method ensures that all expressions referenced by grouping 
functions are included
+     * in the flattenGroupingSetExpression, even if they are not in any 
grouping set.
+     * This is necessary for optimization scenarios where some expressions may 
only exist
+     * in the maximum grouping set that was removed during optimization.
      */
     default GroupingSetShapes toShapes() {

Review Comment:
   done



-- 
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]

Reply via email to