table_join

Two tables combined by kind, keys, residual and nulls_equal.

ConstructDeterministic

Flags

Flag Value
Kind construct: makes a value from values
Rows changes the rows
Deterministic yes
Order matters no
Decomposable no
Makes a table value

Parameters

Parameter Type Required Notes
left reference yes A value's reference.
right reference yes A value's reference.
kind "inner" | "left" | "right" | "full" | "semi" | "anti" | "mark" | "single" | "cross" | "asof" yes Which rows are kept and which side may be null.
keys array of join_key no Equi-join keys: a left and a right expression; none for a cross join.
nulls_equal boolean no Whether null keys match each other.
residual expr no An extra Bool predicate over the left then the right columns; not for asof.
asof asof no For kind asof: the left and right values to match by nearness, the strategy (backward, forward, nearest) and an optional literal tolerance; keys are the equal by keys.
response_format "concise" | "detailed" no The byte budget: 64 KiB concise, 512 KiB detailed.

Example

Over the example tables orders, customers; ${input:name} is an input's reference and ${verb} the value an earlier call made.

JSON
table_join {
  "left": "${input:orders}",
  "right": "${input:customers}",
  "kind": "left",
  "keys": [
    {
      "left": {
        "col": 1
      },
      "right": {
        "col": 0
      }
    }
  ]
}

Result

240 rows

JSON
{
  "ref": "sha256:4959728ba6faf74064973a284f37be134f437ed0533b93ecf6e44f81b2621f26",
  "kind": "table",
  "rows": 240,
  "schema": "…"
}

In the hint language

The same step as a plan, as the language prints it.

Hint
output out = from orders
join customers (customer == cid) kind:left

Diagnostics

A refusal comes back as ok: false with coded diagnostics; every code, with its fix, is on the diagnostics page. A parameter that does not match the schema above is ARG_INVALID, with the parameter's path.