aggs_for_vecs
Aggregate functions for array inputs
Repository
pjungwir/aggs_for_vecs
https://github.com/pjungwir/aggs_for_vecs
Source
aggs_for_vecs-1.4.1.tar.gz
aggs_for_vecs-1.4.1.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
aggs_for_vecs | 1.4.1 | FUNC | MIT | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4740 | aggs_for_vecs | No | Yes | No | Yes | No | Yes | - |
| Related | intarray arraymath floatvec aggs_for_arrays |
|---|
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.4.1 | 1817161514 | aggs_for_vecs | - |
| RPM | PIGSTY | 1.4.1 | 1817161514 | aggs_for_vecs_$v | - |
| DEB | PIGSTY | 1.4.1 | 1817161514 | postgresql-$v-aggs-for-vecs | - |
Build
You can build the RPM / DEB packages for aggs_for_vecs using pig build:
Install
You can install aggs_for_vecs directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Install
pig
dnf
apt
Create Extension:
Usage
aggs_for_vecs: aggregate functions for arrays (vector/row-based)
Provides aggregate functions that operate on arrays as vectors, computing position-wise statistics across multiple rows. Supports SMALLINT, INTEGER, BIGINT, REAL, and DOUBLE PRECISION.
Aggregate Functions
| Function | Description |
|---|---|
vec_to_count(anyarray) | Count of non-nulls in each position |
vec_to_sum(anyarray) | Sum in each position |
vec_to_min(anyarray) | Minimum in each position |
vec_to_max(anyarray) | Maximum in each position |
vec_to_mean(anyarray) | Average in each position (returns FLOAT[]) |
vec_to_weighted_mean(values, weights) | Weighted average in each position |
vec_to_var_samp(anyarray) | Sample variance in each position |
vec_to_first(anyarray) | First non-null in each position (use with ORDER BY) |
vec_to_last(anyarray) | Last non-null in each position (use with ORDER BY) |
hist_2d(x, y, ...) | 2-D histogram |
hist_md(vals, indexes, ...) | N-dimensional histogram |
Non-Aggregate Functions
| Function | Description |
|---|---|
vec_add(l, r) | Element-wise addition |
vec_sub(l, r) | Element-wise subtraction |
vec_mul(l, r) | Element-wise multiplication |
vec_div(l, r) | Element-wise division |
vec_elements(array, indexes) | Select elements at given indexes |
pad_vec(array, length) | Extend array to given length with NULLs |
vec_coalesce(array, default) | Replace NULLs with default |
vec_trim_scale(numeric[]) | Trim trailing zeros from NUMERIC elements |
vec_without_outliers(vals, mins, maxs) | Replace outliers with NULL |
Examples
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)