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/12/05 22:42:21 UTC

[GitHub] [spark] bersprockets commented on a diff in pull request #38923: `InterpretedMutableProjection` should use `setDecimal` to set null values for high-precision decimals in an unsafe row

bersprockets commented on code in PR #38923:
URL: https://github.com/apache/spark/pull/38923#discussion_r1040179271


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/InterpretedMutableProjection.scala:
##########
@@ -75,13 +78,28 @@ class InterpretedMutableProjection(expressions: Seq[Expression]) extends Mutable
     if (!e.nullable) {
       (v: Any) => writer(mutableRow, v)
     } else {
-      (v: Any) => {
-        if (v == null) {
-          mutableRow.setNullAt(i)
-        } else {
-          writer(mutableRow, v)
-        }
+      val nullSafeWriter: (InternalRow, Any) => Unit = e.dataType match {
+        case DecimalType.Fixed(precision, _) if precision > Decimal.MAX_LONG_DIGITS =>

Review Comment:
   This won't handle the case where the decimal type is nested in a struct or array. But in that case, the target row won't be an unsafe row (since `InterpretedMutableProjection#target` would reject such a row, AFAICT), so the plain `writer` will be fine.



-- 
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