Skip to content

feat(function): add list_min and list_max for list extrema - #1157

Open
mvanhorn wants to merge 1 commit into
LadybugDB:mainfrom
mvanhorn:fix/list-min-max
Open

mvanhorn wants to merge 1 commit into
LadybugDB:mainfrom
mvanhorn:fix/list-min-max

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Description

Adds LIST_MIN and LIST_MAX scalar functions. Each scans a list, skips nulls, and returns the smallest or largest remaining value. Empty lists, all-null lists, and a null list argument return null.

The functions cover comparable list children (numbers, strings, dates, booleans) so queries can read extrema from stored list properties without sorting.

Closes #1156

Demo

demo

Types of changes

  • Bug fix
  • New feature
  • Breaking change
  • Documentation Update

Checklist

  • I have changed storage version if on disk format has changed.
  • I have requested a review from a maintainer.
  • I have updated the documentation (if needed).

Add LIST_MIN and LIST_MAX scalars that skip nulls and return the
smallest or largest remaining value. Empty and all-null lists return
null. Comparable children include numbers, strings, dates, and booleans.

Bind untyped null as INT64[] so the result vector is not ANY, and set
the exec kernel so a null input yields null rather than default zeros.
@adsharma

adsharma commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Nit (non-blocking): src/function/list/list_agg_function.cpp:~32-39 silently rebinds scalar list_min(42) to dummy LIST(INT64) instead of throwing — suggest only fallback for NULL/ANY literal, else BinderException. Also suggest 1 test for long strings (>12B overflow path in copyFromVectorData) + 1 negative binder test. Core null-skip/empty→NULL logic LGTM.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Add LIST_MIN and LIST_MAX for list extrema

2 participants