Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
PHILO-HE committed Jun 27, 2024
1 parent 32808dd commit 2496467
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
7 changes: 0 additions & 7 deletions cpp/velox/operators/functions/RegistrationAllFunctions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ void registerFunctionOverwrite() {
velox::registerFunction<RoundFunction, int64_t, int64_t, int32_t>({"round"});
velox::registerFunction<RoundFunction, double, double, int32_t>({"round"});
velox::registerFunction<RoundFunction, float, float, int32_t>({"round"});
// TODO: the below rand function registry can be removed after presto function registry is removed.
velox::registerFunction<velox::functions::sparksql::RandFunction, double, velox::Constant<int32_t>>({"spark_rand"});
velox::registerFunction<velox::functions::sparksql::RandFunction, double, velox::Constant<int64_t>>({"spark_rand"});

auto kRowConstructorWithNull = RowConstructorWithNullCallToSpecialForm::kRowConstructorWithNull;
velox::exec::registerVectorFunction(
Expand All @@ -74,10 +71,6 @@ void registerFunctionOverwrite() {
velox::exec::registerFunctionCallToSpecialForm(
kRowConstructorWithAllNull,
std::make_unique<RowConstructorWithNullCallToSpecialForm>(kRowConstructorWithAllNull));
velox::functions::registerBinaryIntegral<velox::functions::CheckedPlusFunction>({"check_add"});
velox::functions::registerBinaryIntegral<velox::functions::CheckedMinusFunction>({"check_subtract"});
velox::functions::registerBinaryIntegral<velox::functions::CheckedMultiplyFunction>({"check_multiply"});
velox::functions::registerBinaryIntegral<velox::functions::CheckedDivideFunction>({"check_divide"});

velox::functions::registerPrestoVectorFunctions();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,63 +564,63 @@ object ExpressionConverter extends SQLConfHelper with Logging {
replaceWithExpressionTransformerInternal(a.left, attributeSeq, expressionsMap),
replaceWithExpressionTransformerInternal(a.right, attributeSeq, expressionsMap),
tryEval,
ExpressionNames.CHECK_ADD
ExpressionNames.CHECKED_ADD
)
case tryEval @ TryEval(a: Subtract) =>
BackendsApiManager.getSparkPlanExecApiInstance.genTryArithmeticTransformer(
substraitExprName,
replaceWithExpressionTransformerInternal(a.left, attributeSeq, expressionsMap),
replaceWithExpressionTransformerInternal(a.right, attributeSeq, expressionsMap),
tryEval,
ExpressionNames.CHECK_SUBTRACT
ExpressionNames.CHECKED_SUBTRACT
)
case tryEval @ TryEval(a: Divide) =>
BackendsApiManager.getSparkPlanExecApiInstance.genTryArithmeticTransformer(
substraitExprName,
replaceWithExpressionTransformerInternal(a.left, attributeSeq, expressionsMap),
replaceWithExpressionTransformerInternal(a.right, attributeSeq, expressionsMap),
tryEval,
ExpressionNames.CHECK_DIVIDE
ExpressionNames.CHECKED_DIVIDE
)
case tryEval @ TryEval(a: Multiply) =>
BackendsApiManager.getSparkPlanExecApiInstance.genTryArithmeticTransformer(
substraitExprName,
replaceWithExpressionTransformerInternal(a.left, attributeSeq, expressionsMap),
replaceWithExpressionTransformerInternal(a.right, attributeSeq, expressionsMap),
tryEval,
ExpressionNames.CHECK_MULTIPLY
ExpressionNames.CHECKED_MULTIPLY
)
case a: Add =>
BackendsApiManager.getSparkPlanExecApiInstance.genArithmeticTransformer(
substraitExprName,
replaceWithExpressionTransformerInternal(a.left, attributeSeq, expressionsMap),
replaceWithExpressionTransformerInternal(a.right, attributeSeq, expressionsMap),
a,
ExpressionNames.CHECK_ADD
ExpressionNames.CHECKED_ADD
)
case a: Subtract =>
BackendsApiManager.getSparkPlanExecApiInstance.genArithmeticTransformer(
substraitExprName,
replaceWithExpressionTransformerInternal(a.left, attributeSeq, expressionsMap),
replaceWithExpressionTransformerInternal(a.right, attributeSeq, expressionsMap),
a,
ExpressionNames.CHECK_SUBTRACT
ExpressionNames.CHECKED_SUBTRACT
)
case a: Multiply =>
BackendsApiManager.getSparkPlanExecApiInstance.genArithmeticTransformer(
substraitExprName,
replaceWithExpressionTransformerInternal(a.left, attributeSeq, expressionsMap),
replaceWithExpressionTransformerInternal(a.right, attributeSeq, expressionsMap),
a,
ExpressionNames.CHECK_MULTIPLY
ExpressionNames.CHECKED_MULTIPLY
)
case a: Divide =>
BackendsApiManager.getSparkPlanExecApiInstance.genArithmeticTransformer(
substraitExprName,
replaceWithExpressionTransformerInternal(a.left, attributeSeq, expressionsMap),
replaceWithExpressionTransformerInternal(a.right, attributeSeq, expressionsMap),
a,
ExpressionNames.CHECK_DIVIDE
ExpressionNames.CHECKED_DIVIDE
)
case tryEval: TryEval =>
// This is a placeholder to handle try_eval(other expressions).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ object ExpressionNames {
final val IS_NAN = "isnan"
final val NANVL = "nanvl"
final val TRY_EVAL = "try"
final val CHECK_ADD = "check_add"
final val CHECK_SUBTRACT = "check_subtract"
final val CHECK_DIVIDE = "check_divide"
final val CHECK_MULTIPLY = "check_multiply"
final val CHECKED_ADD = "checked_add"
final val CHECKED_SUBTRACT = "checked_subtract"
final val CHECKED_DIVIDE = "checked_divide"
final val CHECKED_MULTIPLY = "checked_multiply"

// SparkSQL String functions
final val ASCII = "ascii"
Expand Down

0 comments on commit 2496467

Please sign in to comment.