diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalHashAggregate.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalHashAggregate.java index 79d13ccfc3..d1df4391ab 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalHashAggregate.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalHashAggregate.java @@ -228,7 +228,9 @@ public class PhysicalHashAggregate extends PhysicalUnar public PhysicalHashAggregate withChildren(List children) { Preconditions.checkArgument(children.size() == 1); return new PhysicalHashAggregate<>(groupByExpressions, outputExpressions, partitionExpressions, - aggregateParam, maybeUsingStream, getLogicalProperties(), requireProperties, children.get(0)); + aggregateParam, maybeUsingStream, groupExpression, getLogicalProperties(), + requireProperties, physicalProperties, statistics, + children.get(0)); } public PhysicalHashAggregate withPartitionExpressions(List partitionExpressions) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalQuickSort.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalQuickSort.java index aacefd1fcb..cb2e3118d2 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalQuickSort.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalQuickSort.java @@ -75,7 +75,8 @@ public class PhysicalQuickSort extends AbstractPhysical @Override public PhysicalQuickSort withChildren(List children) { Preconditions.checkArgument(children.size() == 1); - return new PhysicalQuickSort<>(orderKeys, phase, getLogicalProperties(), children.get(0)); + return new PhysicalQuickSort<>(orderKeys, phase, groupExpression, getLogicalProperties(), physicalProperties, + statistics, children.get(0)); } @Override diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalStorageLayerAggregate.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalStorageLayerAggregate.java index 21f1df9b99..e6e2ca9b9c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalStorageLayerAggregate.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalStorageLayerAggregate.java @@ -131,7 +131,9 @@ public class PhysicalStorageLayerAggregate extends PhysicalRelation { @Override public PhysicalPlan withPhysicalPropertiesAndStats(PhysicalProperties physicalProperties, Statistics statistics) { - return new PhysicalStorageLayerAggregate(relation, aggOp, groupExpression, + return new PhysicalStorageLayerAggregate( + (PhysicalRelation) relation.withPhysicalPropertiesAndStats(null, statistics), + aggOp, groupExpression, getLogicalProperties(), physicalProperties, statistics); } diff --git a/tools/cost_model_evaluate/sql_executor.py b/tools/cost_model_evaluate/sql_executor.py index 511e12c8ad..c38cc322db 100644 --- a/tools/cost_model_evaluate/sql_executor.py +++ b/tools/cost_model_evaluate/sql_executor.py @@ -18,6 +18,7 @@ from unittest import result import mysql.connector from typing import List, Tuple +import re class SQLExecutor: @@ -43,7 +44,28 @@ class SQLExecutor: def get_execute_time(self, query: str) -> float: self.execute_query(query, None) profile = self.execute_query("show query profile\"\"", None) - return float(profile[0][self.wait_fetch_time_index].replace("ms", "")) + return self.get_n_ms(profile[0][self.wait_fetch_time_index]) + + def get_n_ms(self, t: str): + res = re.search(r"(\d+h)*(\d+min)*(\d+s)*(\d+ms)", t) + if res is None: + raise Exception(f"invalid time {t}") + n = 0 + + h = res.group(1) + if h is not None: + n += int(h.replace("h", "")) * 60 * 60 * 1000 + min = res.group(2) + if min is not None != 0: + n += int(min.replace("min", "")) * 60 * 1000 + s = res.group(3) + if s is not None != 0: + n += int(s.replace("s", "")) * 1000 + ms = res.group(4) + if len(ms) != 0: + n += int(ms.replace("ms", "")) + + return n def execute_many_queries(self, queries: List[Tuple[str, Tuple]]) -> List[List[Tuple]]: results = []