Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/15847#discussion_r87541254
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala
---
@@ -1431,43 +1431,49 @@ case class FormatNumber(x: Expression, d:
Expression)
// Associated with the pattern, for the last d value, and we will update
the
// pattern (DecimalFormat) once the new coming d value differ with the
last one.
+ // This is an Option to distinguish between 0 (numberFormat is valid)
and uninitialized after
+ // serialization (numberFormat has not been updated for dValue = 0).
@transient
- private var lastDValue: Int = -100
+ private var lastDValue: Option[Int] = None
--- End diff --
Actually you can do this via a lazy val too, which is just
```
@transient private lazy var lastDValue: Int = -100
```
then I believe it gets initialized to -100 after deserialization
automatically.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]