Skip to content

feat(function): add list_has_any for list overlap checks - #1154

Merged
adsharma merged 1 commit into
LadybugDB:mainfrom
mvanhorn:fix/list-has-any
Oct 9, 2026
Merged

adsharma merged 1 commit into
LadybugDB:mainfrom
mvanhorn:fix/list-has-any

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Description

Adds the LIST_HAS_ANY scalar function. It returns true when two lists share any non-null element, false when they do not, and null when either argument is null.

This completes the overlap check next to LIST_HAS_ALL, so queries can test tag, name, or key lists without unfolding them in a lambda.

Closes #1153

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 a LIST_HAS_ANY scalar that returns true when two lists share any
non-null element, including nested lists and structs. Null inputs yield
null; empty lists and null-only probes yield false.

Cover the function with an empty-dataset e2e suite so the tests do not
depend on the tinysnb submodule.
@adsharma

adsharma commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Nit (correctness, non-blocking): src/function/list/list_has_any.cpp:19-30 skips NULLs on the right side but not the left. ListPosition → Equals::operation compares raw slot bytes and ignores null masks, so a NULL left slot with stale bytes equal to a right element could false-positive (e.g. [null,4] vs [4]). Suggest skipping null left slots via ListVector::getDataVector null check — same applies to list_has_all.cpp. Worth a 1-line regression test. Otherwise LGTM.

@adsharma
adsharma merged commit 35cf8db into LadybugDB:main Oct 9, 2026
4 checks passed
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_HAS_ANY for list overlap checks

2 participants