Skip to content

fix: preserve inner list field name, nullability and metadata in array_append/array_prepend/array_replace* - #24350

Closed
waterWang wants to merge 4 commits into
apache:mainfrom
waterWang:fix/preserve-inner-field-array-funcs
Closed

fix: preserve inner list field name, nullability and metadata in array_append/array_prepend/array_replace*#24350
waterWang wants to merge 4 commits into
apache:mainfrom
waterWang:fix/preserve-inner-field-array-funcs

Conversation

@waterWang

Copy link
Copy Markdown

Which issue does this PR close?

Closes #24347.

Rationale for this change

array_append, array_prepend, array_replace, array_replace_n, and array_replace_all have the same defect that #24341 describes for array_slice: return_type promises the input list type verbatim (inner field name, nullability, and metadata included), but the kernel rebuilds the output's inner field from scratch with Field::new_list_field(..., true).

The promise sites return Ok(array_type.clone()) / Ok(args[0].clone()), but the kernels create a new Field::new_list_field(value_type, true) — discarding the input's inner field.

What changes are included in this PR?

Fix the payload sites (concat_internal, generic_append_and_prepend, general_replace, general_replace_with_scalar) to preserve the input list's inner field:

  • concat.rs: concat_internal at line 445 and generic_append_and_prepend at line 568 now extract the field from the input list's DataType instead of creating a new default field.
  • replace.rs: general_replace at line 505 and general_replace_with_scalar at line 601 now preserve the input list's field.

Are these changes tested?

Existing tests cover the functionality. The fix follows the same pattern as #24343 (array_slice). No new tests added — the existing test suite exercises the same code paths.

Are there any user-facing changes?

No. The bug is only observable on debug builds (return-type assertion from #17515) or when a downstream consumer inspects the inner field's name/nullability/metadata.

@github-actions github-actions Bot added the functions Changes to functions implementation label Aug 13, 2026
@Jefffrey

Copy link
Copy Markdown
Contributor

@Jefffrey Jefffrey closed this Aug 14, 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_append / array_prepend / array_replace* discard the input list's inner field, contradicting their promised return type

2 participants