Skip to content

Commit

Permalink
support null literal for decimal (facebookincubator#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
rui-mo authored and JkSelf committed Mar 23, 2023
1 parent 9071aa2 commit ed89b63
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion velox/substrait/SubstraitToVeloxExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,16 @@ SubstraitVeloxExprConverter::toVeloxExpr(
case ::substrait::Expression_Literal::LiteralTypeCase::kNull: {
auto veloxType =
toVeloxType(subParser_->parseType(substraitLit.null())->type);
return std::make_shared<core::ConstantTypedExpr>(
if (veloxType->isShortDecimal()) {
return std::make_shared<core::ConstantTypedExpr>(
veloxType, variant::shortDecimal(std::nullopt, veloxType));
} else if (veloxType->isLongDecimal()) {
return std::make_shared<core::ConstantTypedExpr>(
veloxType, variant::longDecimal(std::nullopt, veloxType));
} else {
return std::make_shared<core::ConstantTypedExpr>(
veloxType, variant::null(veloxType->kind()));
}
}
case ::substrait::Expression_Literal::LiteralTypeCase::kDate:
return std::make_shared<core::ConstantTypedExpr>(
Expand Down

0 comments on commit ed89b63

Please sign in to comment.