UnsafeProjection¶
UnsafeProjection is an extension of the Projection abstraction for projection functions from InternalRows to (produce) UnsafeRows.
UnsafeProjection: InternalRow => UnsafeRow
UnsafeProjection is created for code generated and interpreted code evaluation paths (using UnsafeProjection factory object).
Contract¶
Encoding InternalRow as UnsafeRow¶
apply(
row: InternalRow): UnsafeRow
Encodes the given InternalRow to an UnsafeRow
Implementations¶
InterpretedUnsafeProjection
CodeGeneratorWithInterpretedFallback¶
UnsafeProjection factory object is a CodeGeneratorWithInterpretedFallback of UnsafeProjections (based on Expressions).
CodeGeneratorWithInterpretedFallback[Seq[Expression], UnsafeProjection]
createCodeGeneratedObject¶
CodeGeneratorWithInterpretedFallback
createCodeGeneratedObject(
in: Seq[Expression]): UnsafeProjection
createCodeGeneratedObject is part of the CodeGeneratorWithInterpretedFallback abstraction.
createCodeGeneratedObject generates an UnsafeProjection for the given Expressions (possibly with Subexpression Elimination based on spark.sql.subexpressionElimination.enabled configuration property).
createInterpretedObject¶
CodeGeneratorWithInterpretedFallback
createInterpretedObject(
in: Seq[Expression]): UnsafeProjection
createInterpretedObject is part of the CodeGeneratorWithInterpretedFallback abstraction.
createInterpretedObject creates an UnsafeProjection for the given Expressions.
Creating UnsafeProjection¶
create(
fields: Array[DataType]): UnsafeProjection
create(
expr: Expression): UnsafeProjection
create(
exprs: Seq[Expression]): UnsafeProjection // (1)!
create(
exprs: Seq[Expression],
inputSchema: Seq[Attribute]): UnsafeProjection
create(
schema: StructType): UnsafeProjection
- The main
createthat the other variants depend on
create creates an UnsafeProjection for the given Expressions.
create is used when:
ExpressionEncoderis requested to create a serializerV2Aggregatoris requested for aninputProjection- SerializeFromObjectExec physical operator is executed
SortExecphysical operator is requested to create an UnsafeExternalRowSorterHashAggregateExecphysical operator is requested to create a hash map and getEmptyAggregationBufferAggregationIteratoris created and requested to generateResultProjectionTungstenAggregationIteratoris requested to create an aggregation bufferScalaAggregatoris requested for the inputProjection- others