table_set

Union, intersect or except, by position with matching types.

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.
op "union" | "intersect" | "except" yes Which operation.
all boolean no Keep duplicates (multiset semantics).
response_format "concise" | "detailed" no The byte budget: 64 KiB concise, 512 KiB detailed.

Example

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

JSON
table_fetch {
  "table": "${input:customers}",
  "offset": 0,
  "count": 10
}

table_fetch {
  "table": "${input:customers}",
  "offset": 5,
  "count": 10
}

table_set {
  "left": "${table_fetch#0}",
  "right": "${table_fetch#1}",
  "op": "union",
  "all": false
}

Result

15 rows

JSON
{
  "ref": "sha256:c7ad2f7677ca6c89b4b7a53a8b39ed8152a9f7debfb7673125bb513fef10d271",
  "kind": "table",
  "rows": 15,
  "schema": {
    "fields": [
      {
        "name": "cid",
        "type": {
          "kind": "int64"
        },
        "nullable": false,
        "metadata": {}
      },
      {
        "name": "name",
        "type": {
          "kind": "utf8"
        },
        "nullable": false,
        "metadata": {}
      },
      {
        "name": "region",
        "type": {
          "kind": "utf8"
        },
        "nullable": true,
        "metadata": {}
      },
      {
        "name": "since",
        "type": {
          "kind": "date"
        },
        "nullable": false,
        "metadata": {}
      }
    ],
    "metadata": {}
  }
}

In the hint language

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

Hint
output out = from left
union right

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.