scalaapache-sparkapache-spark-sql

Is there any way to extend spark.sql.catalyst.plans.logical.Join?


Is there any way to extend spark.sql.catalyst.plans.logical.Join?

Join is a case class. However, I would like to extend it by adding extra fields. What's the correct and idiomatic approach to achieve this without introducing risks or errors into Spark behavior?


Solution

  • You shouldn’t subclass Spark’s Join directly because it’s a case class and final by design. Instead, wrap it in a custom logical plan node or attach extra info via metadata on expressions to safely extend functionality without breaking Spark’s optimizations.