Skip to main content

NEAREST_BY_JOIN error condition

SQLSTATE: 42604

Invalid nearest-by join.

CROSS_JOIN_NOT_ENABLED

Nearest-by join is implemented as a bounded cross-product internally and is therefore rejected when spark.sql.crossJoin.enabled = false. Set spark.sql.crossJoin.enabled = true to permit it, or rewrite the query without nearest-by.

EXACT_WITH_NONDETERMINISTIC_EXPRESSION

EXACT nearest-by join is incompatible with the nondeterministic ranking expression <expression>. Use APPROX, or replace the expression with a deterministic one.

NON_ORDERABLE_RANKING_EXPRESSION

The ranking expression <expression> of type <type> is not orderable. Provide an expression that returns an orderable type, such as a numeric distance like abs(a.col - b.col) or a numeric similarity score.

NUM_RESULTS_OUT_OF_RANGE

The number of results <numResults> must be between <min> and <max>. Update the literal in APPROX NEAREST <numResults> BY ... (or EXACT NEAREST <numResults> BY ...) to fall within that range.

STREAMING_NOT_SUPPORTED

Nearest-by join is not supported with streaming DataFrames/Datasets.

UNSUPPORTED_DIRECTION

Unsupported nearest-by join direction '<direction>'. Supported nearest-by join directions include: <supported>.

UNSUPPORTED_JOIN_TYPE

Unsupported nearest-by join type <joinType>. Supported types: <supported>.

UNSUPPORTED_MODE

Unsupported nearest-by join mode '<mode>'. Supported modes include: <supported>.