rui-mo commented on code in PR #5954:
URL: https://github.com/apache/incubator-gluten/pull/5954#discussion_r1717728139
##########
cpp/velox/substrait/SubstraitToVeloxPlan.cc:
##########
@@ -1600,17 +1600,26 @@ bool
SubstraitToVeloxPlanConverter::childrenFunctionsOnSameField(
bool SubstraitToVeloxPlanConverter::canPushdownFunction(
const ::substrait::Expression_ScalarFunction& scalarFunction,
const std::string& filterName,
- uint32_t& fieldIdx) {
- // Condtions can be pushed down.
+ uint32_t& fieldIdx,
+ const std::vector<TypePtr>& veloxTypeList) {
+ // Conditions can be pushed down.
static const std::unordered_set<std::string> supportedFunctions =
{sIsNotNull, sIsNull, sGte, sGt, sLte, sLt, sEqual};
- bool canPushdown = false;
- if (supportedFunctions.find(filterName) != supportedFunctions.end() &&
- fieldOrWithLiteral(scalarFunction.arguments(), fieldIdx)) {
- // The arg should be field or field with literal.
- canPushdown = true;
+ if (supportedFunctions.find(filterName) == supportedFunctions.end()) {
+ return false;
+ }
+
+ // The arg should be field or field with literal.
+ if (!fieldOrWithLiteral(scalarFunction.arguments(), fieldIdx)) {
+ return false;
}
- return canPushdown;
+
+ // Check whether data type is supported or not
+ if (!veloxTypeList.empty() && fieldIdx < veloxTypeList.size() &&
!isPushdownSupported(veloxTypeList.at(fieldIdx))) {
Review Comment:
Is it a bug if 'fieldIdx >= veloxTypeList.size()'? Shall we just add a check
to ensure it does not happen?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]