Skip to content

Commit 7357711

Browse files
committed
[native] fix: Fail the query if the aggregation stats node fails the sanity check
1 parent 915f96a commit 7357711

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

presto-native-execution/presto_cpp/main/types/PrestoToVeloxQueryPlan.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -855,20 +855,19 @@ VeloxQueryPlanConverterBase::toColumnStatsSpec(
855855
sourceVeloxPlan);
856856

857857
// Sanity checks on aggregation node.
858-
if (aggregationNode->ignoreNullKeys() ||
859-
aggregationNode->groupId().has_value() ||
860-
aggregationNode->isPreGrouped() ||
861-
!aggregationNode->globalGroupingSets().empty() ||
862-
aggregationNode->aggregateNames().empty() ||
863-
(aggregationNode->aggregateNames().size() !=
864-
aggregationNode->aggregates().size())) {
865-
return std::nullopt;
866-
}
867-
return std::make_optional(core::ColumnStatsSpec{
858+
VELOX_CHECK(!aggregationNode->ignoreNullKeys());
859+
VELOX_CHECK(!aggregationNode->groupId().has_value());
860+
VELOX_CHECK(!aggregationNode->isPreGrouped());
861+
VELOX_CHECK(aggregationNode->globalGroupingSets().empty());
862+
VELOX_CHECK(!aggregationNode->aggregateNames().empty());
863+
VELOX_CHECK_EQ(
864+
aggregationNode->aggregateNames().size(),
865+
aggregationNode->aggregates().size());
866+
return core::ColumnStatsSpec{
868867
aggregationNode->groupingKeys(),
869868
aggregationNode->step(),
870869
aggregationNode->aggregateNames(),
871-
aggregationNode->aggregates()});
870+
aggregationNode->aggregates()};
872871
}
873872

874873
std::vector<protocol::VariableReferenceExpression>

0 commit comments

Comments
 (0)