AbsaOSS / spark-commons

Apache License 2.0
7 stars 0 forks source link

Alter `OncePerSparkSession` to be instantiatable even without provided `SparkSession` #82

Closed benedeki closed 1 year ago

benedeki commented 1 year ago

Background

Currently OnlyOncePerSparkSession can be instantiated only when provided with SparkSession. This turns out to be limiting for classes that needs to be created before Spark is available.

Feature

Up to consideration if to make the SparkSession parameter of the old constructor explicit, to avoid confusion when the (auto-) registration happened and when not. On the other hand that would create a breaking change for all current users.

benedeki commented 1 year ago

Bonus Please change the signature of the method register to return True if the actual registration happened or False if it has happened in an earlier call. (I think it's such a small change, no point creating a dedicated ticket to it)