Skip to content

Add the glob table function - #2994

Merged
tamnd merged 1 commit into
mainfrom
d5-glob
Oct 10, 2026
Merged

tamnd merged 1 commit into
mainfrom
d5-glob

Conversation

@tamnd

@tamnd tamnd commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Part of #1446.

glob(path) is now a table function. It answers one file VARCHAR row for each file a pattern matches and reads none of them, which the corpus uses in 80 records and which rudb refused before as a table function that does not exist.

It takes a pattern or a list of them. The matches of one pattern come out sorted, and a list keeps the order it was written in, duplicates and all, so glob(['b.csv', '*.csv']) gives b.csv, a.csv, b.csv, as the pin does. ** matches at any depth, hidden files are listed, and a directory is not a file, so a pattern that names only directories gives no rows. A path that matches nothing, an empty string and an empty list give no rows rather than an error.

The refusals are the pin's: a NULL argument, a NULL in a list, a list of something other than strings, a number, and a named parameter, each in the pin's words. duckdb_functions() lists the three overloads the pin lists, for VARCHAR, ANY[] and VARIANT.

The paths are worked out in the binder the way read_text and read_blob work them out, so the executor is handed names rather than a pattern. A test in crates/rudb/tests/read_text.rs covers the patterns, the list order, the empty cases, the overloads and the refusals, checked on v2.0.0-dev84237.

@tamnd tamnd added kind/compat A gap against DuckDB, on any of the six surfaces. area/duckdb-compat The DuckDB compatibility surfaces. labels Oct 10, 2026
@tamnd
tamnd merged commit 4ce3b6e into main Oct 10, 2026
1 check failed
@tamnd
tamnd deleted the d5-glob branch October 10, 2026 03:14
@tamnd tamnd mentioned this pull request Oct 10, 2026
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/duckdb-compat The DuckDB compatibility surfaces. kind/compat A gap against DuckDB, on any of the six surfaces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant