MCPcopy Index your code
hub / github.com/TanStack/db / getNullableJoinSources

Function getNullableJoinSources

packages/db/src/query/optimizer.ts:329–349  ·  view source on GitHub ↗

* Returns the set of source aliases that are on the nullable side of outer joins. * * For a LEFT join the joined (right) side is nullable. * For a RIGHT join the main (left/from) side is nullable. * For a FULL join both sides are nullable. * * WHERE clauses that reference only a nullable sourc

(query: QueryIR)

Source from the content-addressed store, hash-verified

327 * incorrectly survive residual filtering.
328 */
329function getNullableJoinSources(query: QueryIR): Set<string> {
330 const nullable = new Set<string>()
331 if (query.join) {
332 const leftAliases = new Set(
333 getFromSources(query.from).map((source) => source.alias),
334 )
335 for (const join of query.join) {
336 const joinedAlias = join.from.alias
337 if (join.type === `left` || join.type === `full`) {
338 nullable.add(joinedAlias)
339 }
340 if (join.type === `right` || join.type === `full`) {
341 for (const leftAlias of leftAliases) {
342 nullable.add(leftAlias)
343 }
344 }
345 leftAliases.add(joinedAlias)
346 }
347 }
348 return nullable
349}
350
351/**
352 * Applies recursive predicate pushdown optimization.

Callers 2

applyOptimizationsFunction · 0.85

Calls 3

getFromSourcesFunction · 0.70
mapMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected