[fix](flinksql): fix elemet_at may coredump on arm#520
[fix](flinksql): fix elemet_at may coredump on arm#520yangzhg wants to merge 1 commit intobytedance:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses a crash in Flink SQL element_at on ARM by ensuring a valid (null constant) result vector is produced when a constant invalid index triggers an error, and it adds a regression test for the multi-row constant-zero-index case.
Changes:
- Return a null-constant vector early when constant index validation fails for arrays in
SubscriptUtil. - Add a new Flink SQL
element_atunit test covering constant index0across multiple rows.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| bolt/functions/lib/SubscriptUtil.h | Early-return a null constant vector for constant invalid index error cases to avoid undefined behavior/crash. |
| bolt/functions/flinksql/tests/ElementAtTest.cpp | Adds a multi-row regression test for constant zero index throwing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
16951aa to
f47b316
Compare
There was a problem hiding this comment.
Pull request overview
Fixes a crash in FlinkSQL element_at (notably on ARM) when a constant invalid index (e.g., 0) is applied across rows, by ensuring the array subscript path returns a correctly typed null constant vector when all rows are marked failed, and adds a regression test for the multi-row constant-zero-index case.
Changes:
- Return a typed null constant vector from
SubscriptImpl::applyArrayTypedwhen a constant index triggers a zero-subscript error for all selected rows. - Add a new FlinkSQL
element_atunit test covering constant index0across multiple input rows.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| bolt/functions/lib/SubscriptUtil.h | Prevents using uninitialized dictionary indices when constant index validation fails for all rows by returning a null constant vector early. |
| bolt/functions/flinksql/tests/ElementAtTest.cpp | Adds a regression test to ensure constant 0 index throws consistently for multi-row inputs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e08efbd to
08f3f33
Compare
08f3f33 to
eb31334
Compare
What problem does this PR solve?
fix elemet_at may coredump on arm
Type of Change
Description
This pull request focuses on improving the test coverage and error handling for the
element_atfunction in Flink SQL, as well as making a minor fix in theSubscriptUtilutility. The main changes include adding a new test case to verify exception handling when a zero index is used across multiple rows, and ensuring proper creation of null constants in the utility code.Performance Impact
No Impact: This change does not affect the critical path (e.g., build system, doc, error handling).
Positive Impact: I have run benchmarks.
Click to view Benchmark Results
Negative Impact: Explained below (e.g., trade-off for correctness).
Release Note
Please describe the changes in this PR
Release Note:
Checklist (For Author)
Breaking Changes
No
Yes (Description: ...)
Click to view Breaking Changes