Skip to content

[BP-2.4][FLINK-41370][table] Reject a literal index below 1 in SQL VARIANT array access - #29833

Merged
raminqaf merged 1 commit into
apache:release-2.4from
raminqaf:FLINK-41370-bp-2.4
Nov 9, 2026
Merged

raminqaf merged 1 commit into
apache:release-2.4from
raminqaf:FLINK-41370-bp-2.4

Conversation

@raminqaf

@raminqaf raminqaf commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

What is the purpose of the change

Backport of #29806 to release-2.4. On 2.4, SQL v[0] and v[-1] on an array VARIANT return NULL for every row, while the same literal fails during planning for a plain ARRAY. 2.4.0 is the first release that can restore a compiled plan with v[i], so landing this before 2.4.0 means no released plan holds such a literal.

Brief change log

  • Cherry-pick of 485da2c. The code and test hunks apply unchanged.
  • The variant '[' INT ']' entry in sql_functions.yml and sql_functions_zh.yml conflicted, because release-2.4 still has the older wording and no VARIANT_GET. I kept the 2.4 text and added the new rule. The zh entry now has the same English text as the en entry, as on master.

Verifying this change

VariantSemanticTest (25 tests) and ArrayTypeTest (8 tests) in flink-table-planner pass on this branch.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no. A query with a literal VARIANT index below 1 now fails during planning, see the release note on FLINK-41370.
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Code 2.1.319 (Claude Opus 5.5)

…ray access (apache#29806)

SQL `v[0]` and `v[-1]` on an array VARIANT returned NULL for every row, while the same literal fails during planning for a plain ARRAY and for `VARIANT.at(INT)` in the Table API. The index is 1-based, so such a literal can never address an element.

The ARRAY literal-index check now also runs for a VARIANT index of any integer type. A computed index below 1 still returns NULL.

Generated-by: Claude Code 2.1.319 (Claude Opus 5.5)
(cherry picked from commit 485da2c)
@flinkbot

flinkbot commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@twalthr twalthr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@raminqaf
raminqaf merged commit 8a0ea90 into apache:release-2.4 Nov 9, 2026
1 check passed
@raminqaf
raminqaf deleted the FLINK-41370-bp-2.4 branch November 9, 2026 13:40
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.

3 participants