table_distinct
One row per key, the first or last by an order.
Flags
| Flag | Value |
|---|---|
| Kind | construct: makes a value from values |
| Rows | keeps some rows |
| Deterministic | yes |
| Order matters | yes |
| Decomposable | no |
| Makes | a table value |
Parameters
| Parameter | Type | Required | Notes |
|---|---|---|---|
table |
reference | yes | A value's reference. |
keys |
array of expr | no | The key; every column when empty. |
keep |
"first" | "last" | no | Which row of a key stays. |
order_by |
array of sort_key | no | The order keep follows; input order when empty. |
response_format |
"concise" | "detailed" | no | The byte budget: 64 KiB concise, 512 KiB detailed. |
Example
Over the example tables orders; ${input:name} is an input's reference and ${verb} the value an earlier call made.
table_project {
"table": "${input:orders}",
"columns": [
{
"name": "status",
"expr": {
"col": 7
}
}
]
}
table_distinct {
"table": "${table_project}"
}Result
5 rows
{
"ref": "sha256:622a1f98e672d9a8d66a72f56c5c7112893889ba0929ccf0784b956b0d9b1319",
"kind": "table",
"rows": 5,
"schema": {
"fields": [
{
"name": "status",
"type": {
"kind": "utf8"
},
"nullable": true,
"metadata": {}
}
],
"metadata": {}
}
}In the hint language
The same step as a plan, as the language prints it.
output out = from table
distinctDiagnostics
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.