Skip to content

Commit

Permalink
Filter out null for IN (#41)
Browse files Browse the repository at this point in the history
Remove alias (#46)
  • Loading branch information
rui-mo authored and zhejiangxiaomai committed Jan 31, 2023
1 parent 372cc43 commit 6e4af29
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 15 deletions.
11 changes: 0 additions & 11 deletions velox/substrait/SubstraitToVeloxExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,6 @@ SubstraitVeloxExprConverter::toVeloxExpr(
}
}

std::shared_ptr<const core::ITypedExpr>
SubstraitVeloxExprConverter::toAliasExpr(
const std::vector<std::shared_ptr<const core::ITypedExpr>>& params) {
VELOX_CHECK(params.size() == 1, "Alias expects one parameter.");
// Alias is omitted due to name change is not needed.
return params[0];
}

std::shared_ptr<const core::ITypedExpr>
SubstraitVeloxExprConverter::toIsNotNullExpr(
const std::vector<std::shared_ptr<const core::ITypedExpr>>& params,
Expand Down Expand Up @@ -271,9 +263,6 @@ SubstraitVeloxExprConverter::toVeloxExpr(
if (veloxFunction == "extract") {
return toExtractExpr(std::move(params), toVeloxType(typeName));
}
if (veloxFunction == "alias") {
return toAliasExpr(std::move(params));
}

if (veloxFunction == "is_not_null") {
return toIsNotNullExpr(std::move(params), toVeloxType(typeName));
Expand Down
4 changes: 0 additions & 4 deletions velox/substrait/SubstraitToVeloxExpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ class SubstraitVeloxExprConverter {
const ::substrait::Expression::Cast& castExpr,
const RowTypePtr& inputType);

/// Create expression for alias.
std::shared_ptr<const core::ITypedExpr> toAliasExpr(
const std::vector<std::shared_ptr<const core::ITypedExpr>>& params);

/// Create expression for is_not_null.
std::shared_ptr<const core::ITypedExpr> toIsNotNullExpr(
const std::vector<std::shared_ptr<const core::ITypedExpr>>& params,
Expand Down
2 changes: 2 additions & 0 deletions velox/substrait/SubstraitToVeloxPlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,8 @@ void SubstraitVeloxPlanConverter::constructSubfieldFilters(

// Handle 'in' filter.
if (filterInfo->valuesVector_.size() > 0) {
// To filter out null is a default behaviour of Spark IN expression.
nullAllowed = false;
setInFilter<KIND>(
filterInfo->valuesVector_, nullAllowed, inputName, filters);
// Currently, In cannot coexist with other filter conditions
Expand Down

0 comments on commit 6e4af29

Please sign in to comment.