InterpretedProjection¶
InterpretedProjection
is a Projection.
Creating Instance¶
InterpretedProjection
takes the following to be created:
- Expressions
- Input Schema (Attributes)
InterpretedProjection
is created when:
HiveGenericUDTF
is requested toeval
HiveScriptTransformationExec
is requested toprocessIterator
SparkScriptTransformationExec
is requested toprocessIterator
UserDefinedGenerator
is requested toinitializeConverters
Demo¶
// HACK: Disable symbolToColumn implicit conversion
// It is imported automatically in spark-shell (and makes demos impossible)
// implicit def symbolToColumn(s: Symbol): org.apache.spark.sql.ColumnName
trait ThatWasABadIdea
implicit def symbolToColumn(ack: ThatWasABadIdea) = ack
import org.apache.spark.sql.catalyst.dsl.expressions._
val boundRef = 'hello.string.at(4)
import org.apache.spark.sql.catalyst.expressions.{Expression, Literal}
val expressions: Seq[Expression] = Seq(Literal(1), boundRef)
import org.apache.spark.sql.catalyst.expressions.InterpretedProjection
val ip = new InterpretedProjection(expressions)
scala> println(ip)
Row => [1,input[4, string, true]]