UnsafeProjection: InternalRow =[apply]=> UnsafeRow
UnsafeProjection — Generic Function to Encode InternalRows to UnsafeRows
UnsafeProjection is a Projection function that encodes InternalRows as UnsafeRows.
|
Note
|
Spark SQL uses The base |
Creating UnsafeProjection — create Factory Method
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
-
createtakes the DataTypes fromschemaand calls the 2ndcreate -
createcreates a BoundReference per field infieldsand calls the 5thcreate -
createcalls the 5thcreate -
createcalls the 5thcreate -
The main
createthat 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).
|