You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/04/01 15:39:19 UTC
[GitHub] [spark] cloud-fan commented on a change in pull request #36040: [SPARK-38762][SQL] Provide query context in Decimal overflow errors
cloud-fan commented on a change in pull request #36040:
URL: https://github.com/apache/spark/pull/36040#discussion_r840707328
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/decimalExpressions.scala
##########
@@ -168,23 +176,31 @@ case class CheckOverflowInSum(
override def eval(input: InternalRow): Any = {
val value = child.eval(input)
if (value == null) {
- if (nullOnOverflow) null else throw QueryExecutionErrors.overflowInSumOfDecimalError
+ if (nullOnOverflow) null
+ else throw QueryExecutionErrors.overflowInSumOfDecimalError(origin.context)
} else {
value.asInstanceOf[Decimal].toPrecision(
dataType.precision,
dataType.scale,
Decimal.ROUND_HALF_UP,
- nullOnOverflow)
+ nullOnOverflow,
+ origin.context)
}
}
override protected def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
val childGen = child.genCode(ctx)
+ val errorContextCode = if (nullOnOverflow) {
+ ctx.addReferenceObj("errCtx", origin.context)
+ } else {
+ "null"
Review comment:
shall we pass empty string as that's the default parameter value?
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org