Skip to main content

Class: MapIndex

Defined in: packages/core/src/indices/map-index.ts:13

A simple secondary index based on JavaScript Maps.

Implements

Constructors

Constructor

new MapIndex(expressions, db): MapIndex

Defined in: packages/core/src/indices/map-index.ts:21

Parameters

ParameterType
expressionsCalculation[]
dbDortDBAsFriend

Returns

MapIndex

Properties

calcBuilders

protected calcBuilders: Record<string, PlanVisitor<CalculationParams>>

Defined in: packages/core/src/indices/map-index.ts:19

Per-language calculation-builder visitors used to compile plan operators into Calculation instances.


eqCheckers

protected eqCheckers: Record<string, EqualityChecker>

Defined in: packages/core/src/indices/map-index.ts:17

Per-language EqualityChecker visitors used to compare index expressions structurally.


expressions

expressions: Calculation[]

Defined in: packages/core/src/indices/map-index.ts:22

The indexed expressions. More expressions result in multi-level index.

Implementation of

HashJoinIndex.expressions


map

protected map: Map<unknown, unknown[]>

Defined in: packages/core/src/indices/map-index.ts:15

Backing store: normalized key → list of source values.

Methods

allValues()

allValues(): Iterable<unknown[]>

Defined in: packages/core/src/indices/map-index.ts:127

Iterate over all stored values. Used in full outer joins.

Returns

Iterable<unknown[]>

Implementation of

HashJoinIndex.allValues


createAccessor()

createAccessor(expressions): Calculation

Defined in: packages/core/src/indices/map-index.ts:105

Create an accessor for the given expressions.

Parameters

ParameterTypeDescription
expressionsIndexMatchInput[]expressions matched by match

Returns

Calculation

  • a calculation returning iterable of matched values

Implementation of

HashJoinIndex.createAccessor


getAlternatives()

protected getAlternatives(value): unknown[]

Defined in: packages/core/src/indices/map-index.ts:76

The default equality comparison is not strict. This method returns alternative values that are considered equal.

Parameters

ParameterType
valueunknown

Returns

unknown[]


match()

match(expressions, renameMap?): number[]

Defined in: packages/core/src/indices/map-index.ts:46

Can the index be used to match the given expressions?

Parameters

ParameterTypeDescription
expressionsIndexMatchInput[]expressions to match against the index
renameMap?RenameMaprename the expressions before matching

Returns

number[]

  • ordered indices of the expressions that can be matched, or null if none can be matched

Implementation of

HashJoinIndex.match


normalizeKey()

protected normalizeKey(value): unknown

Defined in: packages/core/src/indices/map-index.ts:100

Normalizes a key before storage or lookup; maps undefined to null.

Parameters

ParameterType
valueunknown

Returns

unknown


reindex()

reindex(values): void

Defined in: packages/core/src/indices/map-index.ts:32

Rebuild the index with new values.

Parameters

ParameterTypeDescription
valuesIterable<IndexFillInput>the new values to index

Returns

void

Implementation of

HashJoinIndex.reindex


canIndex()

static canIndex(expressions): number[]

Defined in: packages/core/src/indices/map-index.ts:67

Returns the index of the first equality expression that this index type can handle, or null if none qualify.

Parameters

ParameterType
expressionsIndexMatchInput[]

Returns

number[]