UnsafeProjection — Generic Function to Encode InternalRows to UnsafeRows
UnsafeProjection
is a Projection
function that encodes InternalRows as UnsafeRows.
1 2 3 4 5 |
UnsafeProjection: InternalRow =[apply]=> UnsafeRow |
Note
|
Spark SQL uses The base |
Creating UnsafeProjection — create
Factory Method
1 2 3 4 5 6 7 8 9 10 11 12 13 |
create(schema: StructType): UnsafeProjection (1) create(fields: Array[DataType]): UnsafeProjection (2) create(expr: Expression): UnsafeProjection (3) create(exprs: Seq[Expression], inputSchema: Seq[Attribute]): UnsafeProjection (4) create(exprs: Seq[Expression]): UnsafeProjection (5) create( exprs: Seq[Expression], inputSchema: Seq[Attribute], subexpressionEliminationEnabled: Boolean): UnsafeProjection |
-
create
takes the DataTypes fromschema
and calls the 2ndcreate
-
create
creates a BoundReference per field infields
and calls the 5thcreate
-
create
calls the 5thcreate
-
create
calls the 5thcreate
-
The main
create
that does the heavy work
create
transforms all CreateNamedStruct expressions to CreateNamedStructUnsafe
in every BoundReference in the input exprs
.
In the end, create
requests GenerateUnsafeProjection
to generate a UnsafeProjection.
Note
|
A variant of create takes subexpressionEliminationEnabled flag (that usually is subexpressionEliminationEnabled flag of SparkPlan ).
|