Skip to content

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:

  • BroadcastHashJoinExec physical operator is executed

close

close(): Unit

Used when:

get

get(
  key: InternalRow): Iterator[InternalRow]
get(
  key: Long): Iterator[InternalRow]

Gets internal rows for the given key or null

Used when:

getValue

getValue(
  key: InternalRow): InternalRow
getValue(
  key: Long): InternalRow

Gives the value internal row for the given key

Used when:

keyIsUnique

keyIsUnique: Boolean

Used when:

keys

keys(): Iterator[InternalRow]

Used when:

  • SubqueryBroadcastExec physical operator is requested for relationFuture

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:


apply is used when: