HashedRelation¶
HashedRelation is an extension of the KnownSizeEstimation abstraction for relations with values hashed by some key.
sealed trait
HashedRelation is a Scala sealed trait which means that all possible implementations (HashedRelations) are all in the same compilation unit (file).
Contract¶
asReadOnlyCopy¶
asReadOnlyCopy(): HashedRelation
A read-only copy of this HashedRelation to be safely used in a separate thread
Used when:
BroadcastHashJoinExecphysical operator is executed
close¶
close(): Unit
Used when:
ShuffledHashJoinExecphysical operator is requested to buildHashedRelation
get¶
get(
key: InternalRow): Iterator[InternalRow]
get(
key: Long): Iterator[InternalRow]
Gets internal rows for the given key or null
Used when:
HashJoinis requested to innerJoin, [outerJoin]/HashJoin.md#outerJoin), semiJoin, existenceJoin and antiJoinLongHashedRelationis requested to get a value for a key
getValue¶
getValue(
key: InternalRow): InternalRow
getValue(
key: Long): InternalRow
Gives the value internal row for the given key
Used when:
LongHashedRelationis requested to get a value for a key
keyIsUnique¶
keyIsUnique: Boolean
Used when:
BroadcastHashJoinExecphysical operator is requested to multipleOutputForOneInput, codegenInner, codegenOuter, codegenSemi, codegenAnti, codegenExistence
keys¶
keys(): Iterator[InternalRow]
Used when:
SubqueryBroadcastExecphysical operator is requested forrelationFuture
Implementations¶
Creating HashedRelation¶
apply(
input: Iterator[InternalRow],
key: Seq[Expression],
sizeEstimate: Int = 64,
taskMemoryManager: TaskMemoryManager = null,
isNullAware: Boolean = false,
allowsNullKey: Boolean = false): HashedRelation
With no elements in the input iterator and with the allowsNullKey flag disabled, apply returns the EmptyHashedRelation.
For exactly one key expression of type LongType and with the allowsNullKey flag disabled, apply returns a LongHashedRelation.
For all other cases, apply returns an UnsafeHashedRelation.
The input key expressions can be the following:
- Build join keys of
ShuffledHashJoinExecphysical operator - Canonicalized build-side join keys of
HashedRelationBroadcastMode(of BroadcastHashJoinExec physical operator)
apply is used when:
ShuffledHashJoinExecphysical operator is requested to build a HashedRelation from InternalRowsHashedRelationBroadcastModeis requested to transform InternalRows into a HashedRelation