Skip to content

Commit

Permalink
Check a fallback case in validation: using literal partition key in w…
Browse files Browse the repository at this point in the history
…indow function (oap-project#148)
  • Loading branch information
PHILO-HE authored and zhejiangxiaomai committed Mar 29, 2023
1 parent 66329db commit 83f0ad5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion velox/substrait/SubstraitToVeloxPlanValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,17 @@ bool SubstraitToVeloxPlanValidator::validate(
expressions.reserve(groupByExprs.size());
try {
for (const auto& expr : groupByExprs) {
expressions.emplace_back(exprConverter_->toVeloxExpr(expr, rowType));
auto expression = exprConverter_->toVeloxExpr(expr, rowType);
auto expr_field =
dynamic_cast<const core::FieldAccessTypedExpr*>(expression.get());
if (expr_field == nullptr) {
std::cout
<< "Only field is supported for partition key in Window Operator!"
<< std::endl;
return false;
} else {
expressions.emplace_back(expression);
}
}
// Try to compile the expressions. If there is any unregistred funciton or
// mismatched type, exception will be thrown.
Expand Down

0 comments on commit 83f0ad5

Please sign in to comment.