Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lgbo-ustc committed Nov 5, 2024
1 parent 189d45a commit 75a588e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class CHSparkPlanExecApi extends SparkPlanExecApi with Logging {
aggregateAttributes,
initialInputBufferOffset,
// resultExpressions.distinct,
replacedResultExpressions,
replacedResultExpressions.distinct,
child
)
agg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =>
Expand Down
4 changes: 4 additions & 0 deletions cpp-ch/local-engine/Parser/SerializedPlanParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<size_t>(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<int>(cols.getNames().size()); i++)
aliases.emplace_back(NameWithAlias(cols.getNames()[i], root_rel.root().names(i)));
actions_dag.project(aliases);
Expand Down

0 comments on commit 75a588e

Please sign in to comment.