Commit 6e6d98d
[CORE] Address @yaooqinn review: defensive check on customMetrics array lengths
#12114 (comment)
If a future native-side producer ever ships mismatched key/value arrays,
the AIOOBE inside the synchronized block in `getCustomMetrics()` would
leave the volatile cache field unassigned — every subsequent call would
re-enter the synchronized block and re-throw, an unhelpful failure mode.
Adds an explicit length-match check (before the cache field is assigned
to a partial map) that throws `IllegalStateException` mentioning both
array lengths so the producer-side bug is unambiguous.
Adds two new `GlutenSplitResultSuite` cases covering:
- mismatched lengths (3-element keys + 1-element values)
- null values array when keys is non-empty
The second call after a failure must still throw (the cache field stays
null on the failure path); both new tests assert this.
Generated-by: GitHub Copilot CLI (Claude Opus 4.7 1M context)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 827f84b commit 6e6d98d
2 files changed
Lines changed: 32 additions & 0 deletions
File tree
- gluten-arrow/src
- main/java/org/apache/gluten/vectorized
- test/scala/org/apache/gluten/vectorized
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
161 | 174 | | |
162 | 175 | | |
163 | 176 | | |
| |||
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
97 | 116 | | |
0 commit comments