apache / apache/doris

[Bug](Executor) ARRAY_UNION with empty left array and nested-array right input reaches BE and fails with Unexpected columns

Open
#65,356 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
15.9k
Forks
3.9k
Avg merge
2d 23h
Merged PRs (30d)
520

Description

## Description
`ARRAY_UNION` fails on the backend when the left argument is an empty array and the right argument contains nested arrays. The expression reaches the BE and then reports an error like `Unexpected columns`.

## Discussion Summary
- The issue occurs when `ARRAY_UNION` is used with an empty left array and a nested-array right input.
- Related functions already support nested arrays; for example, `array_distinct(array_concat([[[1], [2]]], ...))` returns nested arrays.
- Extending the BE implementation of `ARRAY_UNION` to properly handle nested-array inputs is preferable to adding FE-side restrictions.

## Expected Behavior
`ARRAY_UNION` should either return a clean result for nested-array inputs or be rejected cleanly at the FE/BE boundary if unsupported. The current failure happens inside the BE, which is not user-friendly.

Contributor guide

Open the contributing guide

Research direction

Start by tracing ARRAY_UNION across the FE/BE boundary, focusing on the backend path that handles an empty left array and nested-array right input. Reproduce the Unexpected columns failure, then verify that nested-array input either returns the expected result or is rejected cleanly before reaching the backend.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.