-
-
Save MasseGuillaume/ecc2cbd18d24451143ebded9b6346918 to your computer and use it in GitHub Desktop.
Tree imports
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source: https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/subquery.scala#L23-L29 | |
// ## Current Style | |
import org.apache.spark.sql.SparkSession | |
import org.apache.spark.sql.catalyst.{expressions, InternalRow} | |
import org.apache.spark.sql.catalyst.expressions.{Expression, ExprId, InSet, Literal, PlanExpression} | |
import org.apache.spark.sql.catalyst.expressions.codegen.{CodegenContext, ExprCode} | |
import org.apache.spark.sql.catalyst.rules.Rule | |
import org.apache.spark.sql.internal.SQLConf | |
import org.apache.spark.sql.types.{BooleanType, DataType, StructType} | |
// ## Relative | |
import org.apache.spark.sql.{SparkSession, catalyst, internal, types} | |
import catalyst.{expressions, InternalRow} | |
import catalyst.expressions.{Expression, ExprId, InSet, Literal, PlanExpression} | |
import catalyst.expressions.codegen.{CodegenContext, ExprCode} | |
import catalyst.rules.Rule | |
import internal.SQLConf | |
import types.{BooleanType, DataType, StructType} | |
// Good: works now | |
// Bad: name clash (org.example.internal vs org.apache.spark.sql.internal) | |
// ## Tree Import | |
import org.apache.spark.sql.{ | |
SparkSession, | |
catalyst.{ | |
expressions, | |
expressions.{ | |
Expression, ExprId, InSet, Literal, PlanExpression | |
codegen.{CodegenContext, ExprCode} | |
}, | |
rules.Rule, | |
InternalRow | |
}, | |
internal.SQLConf, | |
types.{BooleanType, DataType, StructType} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment