Skip to content

Commit

Permalink
Fix IN pushdown and refactor (oap-project#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
rui-mo authored and zhejiangxiaomai committed Jan 3, 2023
1 parent d23e296 commit b6c4073
Show file tree
Hide file tree
Showing 7 changed files with 344 additions and 158 deletions.
27 changes: 0 additions & 27 deletions velox/substrait/SubstraitToVeloxExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,30 +231,6 @@ SubstraitVeloxExprConverter::toExtractExpr(
VELOX_FAIL("Constant is expected to be the first parameter in extract.");
}

std::shared_ptr<const core::ITypedExpr>
SubstraitVeloxExprConverter::toRowConstructorExpr(
const std::vector<std::shared_ptr<const core::ITypedExpr>>& params,
const std::string& typeName) {
std::vector<std::string> structTypeNames;
subParser_->getSubFunctionTypes(typeName, structTypeNames);
VELOX_CHECK(
structTypeNames.size() > 0, "At lease one type name is expected.");

// Preparation for the conversion from struct types to RowType.
std::vector<TypePtr> rowTypes;
std::vector<std::string> names;
for (int idx = 0; idx < structTypeNames.size(); idx++) {
std::string substraitTypeName = structTypeNames[idx];
names.emplace_back("col_" + std::to_string(idx));
rowTypes.emplace_back(std::move(toVeloxType(substraitTypeName)));
}

return std::make_shared<const core::CallTypedExpr>(
ROW(std::move(names), std::move(rowTypes)),
std::move(params),
"row_constructor");
}

std::shared_ptr<const core::ITypedExpr>
SubstraitVeloxExprConverter::toVeloxExpr(
const ::substrait::Expression::ScalarFunction& sFunc,
Expand All @@ -277,9 +253,6 @@ SubstraitVeloxExprConverter::toVeloxExpr(
if (veloxFunction == "is_not_null") {
return toIsNotNullExpr(std::move(params), toVeloxType(typeName));
}
if (veloxFunction == "row_constructor") {
return toRowConstructorExpr(std::move(params), typeName);
}

return std::make_shared<const core::CallTypedExpr>(
toVeloxType(typeName), std::move(params), veloxFunction);
Expand Down
5 changes: 0 additions & 5 deletions velox/substrait/SubstraitToVeloxExpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ class SubstraitVeloxExprConverter {
const std::vector<std::shared_ptr<const core::ITypedExpr>>& params,
const TypePtr& outputType);

/// Create expression for row_constructor.
std::shared_ptr<const core::ITypedExpr> toRowConstructorExpr(
const std::vector<std::shared_ptr<const core::ITypedExpr>>& params,
const std::string& typeName);

/// Used to convert Substrait Literal into Velox Expression.
std::shared_ptr<const core::ConstantTypedExpr> toVeloxExpr(
const ::substrait::Expression::Literal& substraitLit);
Expand Down
Loading

0 comments on commit b6c4073

Please sign in to comment.