UnsafeProjection: InternalRow =[apply]=> UnsafeRow
UnsafeProjection — Generic Function to Map InternalRows to UnsafeRows
UnsafeProjection
is a Projection
function that takes InternalRow and gives UnsafeRow.
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
-
create
takes the DataTypes fromschema
and calls the 2ndcreate
-
create
creates 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
to CreateNamedStructUnsafe
in every BoundReference in the input exprs
.
In the end, create
requests GenerateUnsafeProjection
to generate a UnsafeProjection.
A variant of create
can take subexpressionEliminationEnabled
flag.