Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhawvipul committed Jun 30, 2024
1 parent 2878d71 commit 79b0a4b
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala
Original file line number Diff line number Diff line change
Expand Up @@ -822,8 +822,7 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde with CometExprShim
}
None

case rem @ Remainder(left, right, _)
if supportedDataType(left.dataType) && !decimalBeforeSpark34(left.dataType) =>
case rem @ Remainder(left, right, _) if supportedDataType(left.dataType) =>
val leftExpr = exprToProtoInternal(left, inputs)
val rightExpr = exprToProtoInternal(nullIfWhenPrimitive(right), inputs)

Expand Down Expand Up @@ -905,7 +904,7 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde with CometExprShim
(left != negZeroLeft && right != negZeroRight) &&
(left != leftZero && right != rightZero) &&
(left != doubleNan && right != doubleNan) &&
(left != floatNan && right != floatNan)) {
(left != floatNan && right != floatNan) && isSpark34Plus) {
withInfo(expr, left, right)
return None
}
Expand All @@ -915,16 +914,18 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde with CometExprShim
}
}

val leftExpr = if (left.dataType == DoubleType || left.dataType == FloatType) {
exprToProtoInternal(If(EqualTo(left, negZeroLeft), leftZero, left), inputs)
} else {
exprToProtoInternal(left, inputs)
}
val rightExpr = if (right.dataType == DoubleType || right.dataType == FloatType) {
exprToProtoInternal(If(EqualTo(right, negZeroRight), rightZero, right), inputs)
} else {
exprToProtoInternal(right, inputs)
}
val leftExpr =
if (left.dataType == DoubleType || left.dataType == FloatType) {
exprToProtoInternal(If(EqualTo(left, negZeroLeft), leftZero, left), inputs)
} else {
exprToProtoInternal(left, inputs)
}
val rightExpr =
if (right.dataType == DoubleType || right.dataType == FloatType) {
exprToProtoInternal(If(EqualTo(right, negZeroRight), rightZero, right), inputs)
} else {
exprToProtoInternal(right, inputs)
}

buildEqualExpr(leftExpr, rightExpr)

Expand Down

0 comments on commit 79b0a4b

Please sign in to comment.