Skip to content

feat: implement variant_length UDF#61

Draft
getChan wants to merge 1 commit into
datafusion-contrib:mainfrom
getChan:feat/variant-length
Draft

feat: implement variant_length UDF#61
getChan wants to merge 1 commit into
datafusion-contrib:mainfrom
getChan:feat/variant-length

Conversation

@getChan
Copy link
Copy Markdown
Contributor

@getChan getChan commented May 22, 2026

Closes #41

Summary

Implements variant_length(VariantArray, path) as described in #41.

Returns the number of elements in a Variant Array or Object at the given path. Returns NULL for non-array/object variants (e.g. primitives) or NULL inputs.

Return type

UInt64 (Nullable)

Behavior

Input Result
[1, 2, 3] at "" 3
{"a": 1, "b": 2} at "" 2
{"a": [1,2,3,4]} at "a" 4
42 (primitive) NULL
NULL variant NULL

Tests

5 unit tests covering scalar array, scalar object, nested path, primitive→NULL, and columnar input.

@getChan getChan force-pushed the feat/variant-length branch from 957fad8 to 6e46ba7 Compare May 22, 2026 04:00
Closes datafusion-contrib#41

Returns the number of elements in a Variant Array or Object at the
given path. Returns NULL for non-array/object variants or NULL inputs.

- variant_length(VariantArray, path) -> UInt64 (Nullable)
- Supports scalar and columnar variant inputs with scalar path
- 5 unit tests covering array, object, nested path, primitive->NULL, columnar
@getChan getChan force-pushed the feat/variant-length branch from 6e46ba7 to 36ac068 Compare May 22, 2026 04:02
@getChan getChan marked this pull request as draft May 22, 2026 04:03
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.

variant_length: Initial implementation

1 participant