table_aggregate_partial

One shard's aggregate state: keys and the exact states of count, count_all, bool_and, bool_or, min, max, and sum and mean over Int64.

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
table reference yes A value's reference.
group_by array of object no As table_aggregate's.
measures array of object yes 1 or more items. As table_aggregate's: count, count_all, bool_and, bool_or, min, max, and sum and mean over Int64.
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.

JSON
table_aggregate_partial {
  "table": "${input:orders}",
  "group_by": [
    {
      "name": "status",
      "expr": {
        "col": 7
      }
    }
  ],
  "measures": [
    {
      "name": "orders",
      "expr": {
        "fn": "count_all",
        "args": []
      }
    }
  ]
}

Result

5 state rows

JSON
{
  "ref": "sha256:5e459669d6ff548157d925bd4e2d2f80586b5a247c9135ab73b992b32bf08593",
  "kind": "table",
  "rows": 5,
  "schema": {
    "fields": [
      {
        "name": "status",
        "type": {
          "kind": "utf8"
        },
        "nullable": true,
        "metadata": {
          "hint.partial": "key"
        }
      },
      {
        "name": "orders",
        "type": {
          "kind": "int64"
        },
        "nullable": false,
        "metadata": {
          "hint.partial": "count_all"
        }
      }
    ],
    "metadata": {
      "hint.partial.output": "{\"fields\":[{\"metadata\":{},\"name\":\"status\",\"nullable\":true,\"type\":{\"kind\":\"utf8\"}},{\"metadata\":{},\"name\":\"orders\",\"nullable\":false,\"type\":{\"kind\":\"int64\"}}],\"metadata\":{}}"
    }
  }
}

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.