aggs_for_vecs
Aggregate functions for array inputs
aggs_for_vecs : Aggregate functions for array inputs
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 4740 | aggs_for_vecs | aggs_for_vecs | 1.4.1 |
FUNC | MIT | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | intarray arraymath floatvec aggs_for_arrays |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.4.1 |
18 17 16 15 14 | aggs_for_vecs |
- |
| RPM | PIGSTY | 1.4.1 |
18 17 16 15 14 | aggs_for_vecs_$v |
- |
| DEB | PIGSTY | 1.4.1 |
18 17 16 15 14 | postgresql-$v-aggs-for-vecs |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 |
| el8.aarch64 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 |
| el9.x86_64 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 |
| el9.aarch64 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 |
| el10.x86_64 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 |
| el10.aarch64 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 |
| d12.x86_64 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 |
| d12.aarch64 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 |
| d13.x86_64 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 |
| d13.aarch64 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 |
| u22.x86_64 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 |
| u22.aarch64 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 |
| u24.x86_64 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 |
| u24.aarch64 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 |
| u26.x86_64 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 |
| u26.aarch64 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 | PIGSTY 1.4.1 |
Source
github.com/pjungwir/aggs_for_vecs
aggs_for_vecs-1.4.1.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Create this extension with:
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 |