Skip to content

Commit

Permalink
Integrate with Velox make_decimal function
Browse files Browse the repository at this point in the history
  • Loading branch information
rui-mo committed Nov 20, 2023
1 parent 7553cd1 commit 760497d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
1 change: 0 additions & 1 deletion cpp/velox/substrait/SubstraitParser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ std::unordered_map<std::string, std::string> SubstraitParser::substraitVeloxFunc
{"bit_and_merge", "bitwise_and_agg_merge"},
{"collect_set", "array_distinct"},
{"murmur3hash", "hash_with_seed"},
{"make_decimal", "make_decimal_by_unscaled_value"},
{"modulus", "mod"} /*Presto functions.*/
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,8 @@ case class MakeDecimalTransformer(
Seq(original.dataType, BooleanType),
FunctionConfig.OPT))

// use fake decimal literal, because velox function signature need to get return type
// scale and precision by input type variable
val toTypeNodes =
ExpressionBuilder.makeDecimalLiteral(new Decimal().set(0, original.precision, original.scale))
val expressionNodes =
Lists.newArrayList(childNode, toTypeNodes, new BooleanLiteralNode(original.nullOnOverflow))
Lists.newArrayList(childNode, new BooleanLiteralNode(original.nullOnOverflow))
val typeNode = ConverterUtils.getTypeNode(original.dataType, original.nullable)
ExpressionBuilder.makeScalarFunction(functionId, expressionNodes, typeNode)
}
Expand Down

0 comments on commit 760497d

Please sign in to comment.