From 190e9b4b5e7982f36892ba12204539d37fa098a0 Mon Sep 17 00:00:00 2001 From: Zhen Wang <643348094@qq.com> Date: Mon, 28 Oct 2024 11:14:01 +0800 Subject: [PATCH] [GLUTEN-7661][VL] Fix missing validation for native IfThen expr --- cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc b/cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc index 2709fcda1d68..3b74caf8ba5a 100644 --- a/cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc +++ b/cpp/velox/substrait/SubstraitToVeloxPlanValidator.cc @@ -288,7 +288,12 @@ bool SubstraitToVeloxPlanValidator::validateIfThen( const ::substrait::Expression_IfThen& ifThen, const RowTypePtr& inputType) { for (const auto& subIfThen : ifThen.ifs()) { - return validateExpression(subIfThen.if_(), inputType) && validateExpression(subIfThen.then(), inputType); + if (!validateExpression(subIfThen.if_(), inputType) || !validateExpression(subIfThen.then(), inputType)) { + return false; + } + } + if (ifThen.has_else_() && !validateExpression(ifThen.else_(), inputType)) { + return false; } return true; }