Skip to content

Instantly share code, notes, and snippets.

@MasseGuillaume
Last active October 20, 2017 13:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MasseGuillaume/ecc2cbd18d24451143ebded9b6346918 to your computer and use it in GitHub Desktop.
Save MasseGuillaume/ecc2cbd18d24451143ebded9b6346918 to your computer and use it in GitHub Desktop.
Tree imports
// 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