You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/04/13 15:23:17 UTC

[doris] 04/09: [fix](planner)keep all agg functions if there is any virtual slots in group by list (#18630)

This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 2761eb4fa0c0030ce2fa278449737f66089fd0fb
Author: starocean999 <40...@users.noreply.github.com>
AuthorDate: Thu Apr 13 19:44:46 2023 +0800

    [fix](planner)keep all agg functions if there is any virtual slots in group by list (#18630)
    
    Because of the limitation of ProjectPlanner, we have to keep set agg functions materialized if there is any virtual slots in the group by list, such as 'GROUPING_ID' in the group by list etc.
---
 fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfo.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfo.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfo.java
index 05d5284c08..84e9407693 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfo.java
@@ -888,13 +888,14 @@ public final class AggregateInfo extends AggregateInfoBase {
         int aggregateExprsSize = aggregateExprs.size();
         int groupExprsSize = groupingExprs.size();
         boolean isDistinctAgg = isDistinctAgg();
+        boolean hasVirtualSlot = groupingExprs.stream().anyMatch(expr -> expr instanceof VirtualSlotRef);
         for (int i = 0; i < aggregateExprsSize; ++i) {
             FunctionCallExpr functionCallExpr = aggregateExprs.get(i);
             SlotDescriptor slotDesc =
                     outputTupleDesc.getSlots().get(groupExprsSize + i);
             SlotDescriptor intermediateSlotDesc =
                     intermediateTupleDesc.getSlots().get(groupExprsSize + i);
-            if (isDistinctAgg || isUsingSetForDistinct) {
+            if (isDistinctAgg || isUsingSetForDistinct || hasVirtualSlot) {
                 slotDesc.setIsMaterialized(true);
                 intermediateSlotDesc.setIsMaterialized(true);
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org