Skip to content

fix: array_min/array_max on zero rows for non-primitive element types - #26073

Open
linuxpi wants to merge 1 commit into
apache:mainfrom
linuxpi:fix/array-min-max-zero-rows
Open

linuxpi wants to merge 1 commit into
apache:mainfrom
linuxpi:fix/array-min-max-zero-rows

Conversation

@linuxpi

@linuxpi linuxpi commented Oct 6, 2026

Copy link
Copy Markdown

Which issue does this PR close?

Rationale for this change

On a zero-row List<Utf8> (or other non-primitive element type), array_min / array_max fail with Empty iterator passed to ScalarValue::iter_to_array. ProjectionExec and TopK evaluate expressions on empty batches, so the query fails instead of returning no rows.

What changes are included in this PR?

  • array_min_max_helper returns new_empty_array(&array.value_type()) for an empty input before the ScalarValue fallback. The primitive fast path is unchanged.
  • First unit tests for min_max.rs: zero-row List/LargeList<Utf8>, zero-row List<Int64>, mixed rows, and invoke_with_args with number_rows: 0.

Are these changes tested?

Yes. Without the fix, the zero-row Utf8 tests fail with the error above.

Are there any user-facing changes?

No.

@github-actions github-actions Bot added the functions Changes to functions implementation label Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

array_min / array_max fail on a zero-row batch for non-primitive element types

1 participant