geoparquet_aggregate_attribute
Group rows of a remote GeoParquet dataset by any column and aggregate with count, sum, avg, min, or max, optionally inside a lon/lat rectangle. Returns only summarized groups, saving bandwidth.
Instructions
Group the rows of a dataset by one column and aggregate them, optionally inside a lon/lat rectangle. The grouping runs inside the remote file.
WHEN TO USE IT. For "how many of each", "what is the average", "which is the most common" — any question whose answer is a table of groups rather than a set of features. This is the tool that makes a 10 GB dataset answerable in kilobytes: the grouping happens remotely and only the group rows cross the network, however many rows went into them. Reach for it before geoparquet_filter_spatial whenever counting would do.
PARAMETERS. source: dataset name. group_by: the column whose distinct values become the groups, for example 'categories.primary'. aggregate: one of count, sum, avg, min, max. Default count. measure: the column to aggregate. Required for sum, avg, min and max, and rejected for count, which counts rows. It must be numeric; a non-numeric one is refused before any byte is fetched. min_lon, min_lat, max_lon, max_lat: restrict the aggregate to a rectangle. Pass all four or none. Omitting them aggregates the entire dataset, which reads the grouped and measured columns in full — slow and expensive on a multi-gigabyte source. Pass a box unless you truly mean the whole world. limit: maximum groups returned, ordered by the aggregate descending.
WHAT COMES BACK. groups, each with group_value, value (the aggregate) and row_count (rows in the group); rows_aggregated; truncated; the sql that ran; and the scan block.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| source | No | overture_places | |
| max_lat | No | ||
| max_lon | No | ||
| measure | No | ||
| min_lat | No | ||
| min_lon | No | ||
| group_by | Yes | ||
| aggregate | No | count |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||