Github user viirya commented on a diff in the pull request: https://github.com/apache/spark/pull/16417#discussion_r94721694 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateUnsafeProjection.scala --- @@ -92,46 +89,53 @@ object GenerateUnsafeProjection extends CodeGenerator[Seq[Expression], UnsafePro s"$rowWriter.reset();" } - val writeFields = inputs.zip(inputTypes).zipWithIndex.map { - case ((input, dataType), index) => + val writeFields = inputs.zip(inputsTypeAndNullable).zipWithIndex.map { + case ((input, (dataType, nullable)), index) => val dt = dataType match { case udt: UserDefinedType[_] => udt.sqlType case other => other } val tmpCursor = ctx.freshName("tmpCursor") val setNull = dt match { - case t: DecimalType if t.precision > Decimal.MAX_LONG_DIGITS => - // Can't call setNullAt() for DecimalType with precision larger than 18. - s"$rowWriter.write($index, (Decimal) null, ${t.precision}, ${t.scale});" + case dt if UnsafeRow.isMutable(dt) && !UnsafeRow.isFixedLength(dt) => + def varLenDataSize(s: DataType): Int = s match { --- End diff -- Is it good to put this `varLenDataSize` into `UnsafeRow`? Writing a constant like 16 here makes the code untraceable for new comers.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org