Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zhli1142015 committed Jun 5, 2024
1 parent 67e6418 commit 9a60d8c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,39 +128,43 @@ class VeloxSparkPlanExecApi extends SparkPlanExecApi {
left: ExpressionTransformer,
right: ExpressionTransformer,
original: TryEval,
funcName: String): ExpressionTransformer = {
tryArithmeticExprName: String): ExpressionTransformer = {
if (SparkShimLoader.getSparkShims.withAnsiEvalMode(original.child)) {
throw new GlutenNotSupportException(s"$funcName with ansi mode is not supported")
throw new GlutenNotSupportException(s"$tryArithmeticExprName with ansi mode is not supported")
}
original.child.dataType match {
case LongType | IntegerType | ShortType | ByteType =>
case _ => throw new GlutenNotSupportException(s"$funcName is not supported")
case _ => throw new GlutenNotSupportException(s"$tryArithmeticExprName is not supported")
}
// Offload to velox for only IntegralTypes.
GenericExpressionTransformer(
substraitExprName,
Seq(GenericExpressionTransformer(funcName, Seq(left, right), original)),
Seq(GenericExpressionTransformer(tryArithmeticExprName, Seq(left, right), original)),
original)
}

/**
* Map arithmetic expr to different functions: substraitExprName or tryArithmeticExprName based on
* EvalMode.
*/
override def genArithmeticTransformer(
substraitExprName: String,
left: ExpressionTransformer,
right: ExpressionTransformer,
original: Expression,
funcName: String): ExpressionTransformer = {
tryArithmeticExprName: String): ExpressionTransformer = {
if (SparkShimLoader.getSparkShims.withTryEvalMode(original)) {
original.dataType match {
case LongType | IntegerType | ShortType | ByteType =>
case _ => throw new GlutenNotSupportException(s"$funcName is not supported")
case _ => throw new GlutenNotSupportException(s"$tryArithmeticExprName is not supported")
}
// Offload to velox for only IntegralTypes.
GenericExpressionTransformer(
ExpressionMappings.expressionsMap(classOf[TryEval]),
Seq(GenericExpressionTransformer(funcName, Seq(left, right), original)),
Seq(GenericExpressionTransformer(tryArithmeticExprName, Seq(left, right), original)),
original)
} else if (SparkShimLoader.getSparkShims.withAnsiEvalMode(original)) {
throw new GlutenNotSupportException(s"$funcName with ansi mode is not supported")
throw new GlutenNotSupportException(s"$tryArithmeticExprName with ansi mode is not supported")
} else {
GenericExpressionTransformer(substraitExprName, Seq(left, right), original)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ trait SparkPlanExecApi {
left: ExpressionTransformer,
right: ExpressionTransformer,
original: TryEval,
funcName: String): ExpressionTransformer = {
throw new GlutenNotSupportException(s"$funcName is not supported")
tryArithmeticExprName: String): ExpressionTransformer = {
throw new GlutenNotSupportException(s"$tryArithmeticExprName is not supported")
}

def genTryEvalTransformer(
Expand All @@ -227,7 +227,7 @@ trait SparkPlanExecApi {
left: ExpressionTransformer,
right: ExpressionTransformer,
original: Expression,
funcName: String): ExpressionTransformer = {
tryArithmeticExprName: String): ExpressionTransformer = {
GenericExpressionTransformer(substraitExprName, Seq(left, right), original)
}

Expand Down

0 comments on commit 9a60d8c

Please sign in to comment.