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 (HashedRelation
s) 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:
BroadcastHashJoinExec
physical operator is executed
close¶
close(): Unit
Used when:
ShuffledHashJoinExec
physical 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:
HashJoin
is requested to innerJoin, [outerJoin]/HashJoin.md#outerJoin), semiJoin, existenceJoin and antiJoinLongHashedRelation
is 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:
LongHashedRelation
is requested to get a value for a key
keyIsUnique¶
keyIsUnique: Boolean
Used when:
BroadcastHashJoinExec
physical operator is requested to multipleOutputForOneInput, codegenInner, codegenOuter, codegenSemi, codegenAnti, codegenExistence
keys¶
keys(): Iterator[InternalRow]
Used when:
SubqueryBroadcastExec
physical 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
ShuffledHashJoinExec
physical operator - Canonicalized build-side join keys of
HashedRelationBroadcastMode
(of BroadcastHashJoinExec physical operator)
apply
is used when:
ShuffledHashJoinExec
physical operator is requested to build a HashedRelation from InternalRowsHashedRelationBroadcastMode
is requested to transform InternalRows into a HashedRelation