From 60d198327048be0f83b9a0d5d029912e6ac80da9 Mon Sep 17 00:00:00 2001 From: zhejiangxiaomai Date: Tue, 5 Jul 2022 12:18:41 +0800 Subject: [PATCH] When only groupings exist, set the phase to be Single. --- velox/substrait/SubstraitToVeloxPlan.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/velox/substrait/SubstraitToVeloxPlan.cpp b/velox/substrait/SubstraitToVeloxPlan.cpp index 1d6dc2a2e441..aafc2b998eb2 100644 --- a/velox/substrait/SubstraitToVeloxPlan.cpp +++ b/velox/substrait/SubstraitToVeloxPlan.cpp @@ -822,6 +822,11 @@ std::string SubstraitVeloxPlanConverter::findFuncSpec(uint64_t id) { bool SubstraitVeloxPlanConverter::needsRowConstruct( const ::substrait::AggregateRel& sAgg, core::AggregationNode::Step& aggStep) { + if (sAgg.measures().size() == 0) { + // When only groupings exist, set the phase to be Single. + aggStep = core::AggregationNode::Step::kSingle; + return false; + } for (const auto& smea : sAgg.measures()) { auto aggFunction = smea.measure(); std::string funcName = subParser_->findVeloxFunction(