From 52c58ef91971809010474cc99d153eae45ef9a47 Mon Sep 17 00:00:00 2001 From: lgbo-ustc Date: Tue, 5 Nov 2024 16:23:39 +0800 Subject: [PATCH] update --- .../gluten/execution/CHHashAggregateExecTransformer.scala | 2 ++ cpp-ch/local-engine/Parser/SerializedPlanParser.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHHashAggregateExecTransformer.scala b/backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHHashAggregateExecTransformer.scala index 1961fb0728a8..fcf6320f8ec4 100644 --- a/backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHHashAggregateExecTransformer.scala +++ b/backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHHashAggregateExecTransformer.scala @@ -56,6 +56,8 @@ object CHHashAggregateExecTransformer { aggExpr => aggExpr.mode match { case Partial | PartialMerge => + // For partial aggregate, the size of the result expressions of an aggregate expression + // is the same as aggBufferAttributes' length val aggBufferAttributesCount = aggExpr.aggregateFunction.aggBufferAttributes.length aggExpr.aggregateFunction match { case avg: Average => diff --git a/cpp-ch/local-engine/Parser/SerializedPlanParser.cpp b/cpp-ch/local-engine/Parser/SerializedPlanParser.cpp index 9799933b3385..c71acd6b9b33 100644 --- a/cpp-ch/local-engine/Parser/SerializedPlanParser.cpp +++ b/cpp-ch/local-engine/Parser/SerializedPlanParser.cpp @@ -123,11 +123,15 @@ void adjustOutput(const DB::QueryPlanPtr & query_plan, const substrait::PlanRel NamesWithAliases aliases; auto cols = query_plan->getCurrentHeader().getNamesAndTypesList(); if (cols.getNames().size() != static_cast(root_rel.root().names_size())) + { + LOG_ERROR(getLogger("SerializedPlanParser"), "invalid query plan:\n{}", PlanUtil::explainPlan(*query_plan)); + LOG_ERROR(getLogger("SerializedPlanParser"), "invalid substrait plan:\n{}", root_rel.DebugString()); throw Exception( ErrorCodes::LOGICAL_ERROR, "Missmatch result columns size. plan column size {}, subtrait plan size {}.", cols.getNames().size(), root_rel.root().names_size()); + } for (int i = 0; i < static_cast(cols.getNames().size()); i++) aliases.emplace_back(NameWithAlias(cols.getNames()[i], root_rel.root().names(i))); actions_dag.project(aliases);