diff --git a/native/proto/src/proto/expr.proto b/native/proto/src/proto/expr.proto index 88940f386..61656c0cc 100644 --- a/native/proto/src/proto/expr.proto +++ b/native/proto/src/proto/expr.proto @@ -404,6 +404,7 @@ message ScalarFunc { string func = 1; repeated Expr args = 2; DataType return_type = 3; + bool fail_on_error = 4; } message BitwiseAnd { diff --git a/spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala b/spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala index 51b32b7df..b851a7e9a 100644 --- a/spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala +++ b/spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala @@ -1924,7 +1924,12 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde with CometExprShim // `scale` must be Int64 type in DataFusion val scaleExpr = exprToProtoInternal(Literal(_scale.toLong, LongType), inputs) val optExpr = - scalarExprToProtoWithReturnType("round", r.dataType, childExpr, scaleExpr) + scalarExprToProtoWithReturnTypeAnsi( + "round", + r.dataType, + r.ansiEnabled, + childExpr, + scaleExpr) optExprWithInfo(optExpr, expr, r.child) } @@ -2610,6 +2615,20 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde with CometExprShim } } + def scalarExprToProtoWithReturnTypeAnsi( + funcName: String, + returnType: DataType, + failOnError: Boolean, + args: Option[Expr]*): Option[Expr] = { + val builder = ExprOuterClass.ScalarFunc.newBuilder() + builder.setFunc(funcName) + builder.setFailOnError(failOnError) + serializeDataType(returnType).flatMap { t => + builder.setReturnType(t) + scalarExprToProto0(builder, args: _*) + } + } + def scalarExprToProto(funcName: String, args: Option[Expr]*): Option[Expr] = { val builder = ExprOuterClass.ScalarFunc.newBuilder() builder.setFunc(funcName)