Clean-up VariantIterator API and unify it with vector iterator infrastructure by Mytherin · Pull Request #23346 · duckdb/duckdb · GitHub
Skip to content

Clean-up VariantIterator API and unify it with vector iterator infrastructure - #23346

Merged
Mytherin merged 2 commits into
duckdb:mainfrom
Mytherin:variantit2
Jun 18, 2026
Merged

Mytherin merged 2 commits into
duckdb:mainfrom
Mytherin:variantit2

Conversation

@Mytherin

Copy link
Copy Markdown
Member

Instead of having a separate iterator for variants, we can now do this:

auto variant_values = input.Values<VectorVariantType>();

for (idx_t r = 0; r < count; r++) {
    auto entry = variant_values[r];
    if (entry.IsNull()) {
        // top level variant is NULL
    }
    auto val = entry.GetValue(); // get the variant value
}

Also, for clarity, renamed:

  • VariantIteratorState -> VariantIterator - this represents the iterator over the variant vector that holds the unified vector formats, etc - created once per vector
  • VariantIterator -> VariantNode - this is a single node within the variant (e.g. an integer, an object, etc)

CC @Tishj

@Mytherin
Mytherin added this pull request to the merge queue Jun 18, 2026
Merged via the queue into duckdb:main with commit f401652 Jun 18, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant