wForget commented on code in PR #1512:
URL: https://github.com/apache/datafusion-comet/pull/1512#discussion_r1992592521
##########
spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala:
##########
@@ -655,8 +655,23 @@ object QueryPlanSerde extends Logging with
ShimQueryPlanSerde with CometExprShim
(builder, mathExpr) => builder.setIntegralDivide(mathExpr))
if (divideExpr.isDefined) {
+ val childExpr = if (dataType.isInstanceOf[DecimalType]) {
+ // check overflow for decimal type
+ val builder = ExprOuterClass.CheckOverflow.newBuilder()
+ builder.setChild(divideExpr.get)
+ builder.setFailOnError(false)
+ builder.setDatatype(serializeDataType(dataType).get)
+ Some(
+ ExprOuterClass.Expr
+ .newBuilder()
+ .setCheckOverflow(builder)
+ .build())
+ } else {
+ divideExpr
+ }
+
// cast result to long
- castToProto(expr, None, LongType, divideExpr.get,
CometEvalMode.LEGACY)
+ castToProto(expr, None, LongType, childExpr.get,
CometEvalMode.LEGACY)
Review Comment:
> Could be just naming issue but why it is `child`?
It is for castToLong that is `child`, and it could be divide expr or
checkoverflow expor so I can't think of a better name, do you have any
suggestions?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]