Github user sethah commented on a diff in the pull request: https://github.com/apache/spark/pull/14109#discussion_r70153596 --- Diff: mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala --- @@ -856,10 +870,10 @@ private class LeastSquaresAggregator( i += 1 } val offset = if (fitIntercept) labelMean / labelStd - sum else 0.0 - (coefficientsArray, offset, coefficientsArray.length) + (Vectors.dense(coefficientsArray), offset) } - - private val effectiveCoefficientsVector = Vectors.dense(effectiveCoefficientsArray) + @transient private lazy val effectiveCoefficientsVector = coefAndOffset._1 --- End diff -- Before, these values were assigned simultaneously implicitly using a pattern match. It turns out that marking it as `@transient lazy val` doesn't work because the unapply method generates a `Tuple2` which does not contain the transient tag. The individual vals are still transient, but the tuple is not and thus gets serialized. This obscure/hidden consequence of pattern matching is one good argument not to use the `@transient` approach. e.g. the following doesn't work ```scala @transient private lazy val (x, y) = { ... (x, y) } ```
--- 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