mkincaid commented on PR #56584: URL: https://github.com/apache/spark/pull/56584#issuecomment-5029456173
Thanks @zhengruifeng. Your `Word2Vec` counterexample convinced me that the `skipTransient` approach isn't good (`Word2Vec` stores its trained model in `@transient private val wordVectors`, so skipping transient ignores actual model data that should count). I also spent a while testing `estimatedSize = 0` on `SparkSession` and `SparkContext` but this wasn't sufficient. The object graph hits a bunch of other stuff like `log4j` and `Thread`/`ThreadGroup` as well. We could skip all of these by class in the graph traversal in `SizeEstimator` but it would turn into a messy ad-hoc list of exclusions. After considering all this I decided to go back to the original approach of unsetting the parent, but make this thread-safe by copying the object first, unsetting the parent on the copy and then sizing it. This is a cleaner change that doesn't touch core and should be easier to review. I also agree that the impl should override and explicitly size the things it cares about, but this seems like a low-risk improvement for default and 3rd party as you said. Let me know what you think. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
