ESQL: Fix bug in pushed LENGTH(kwd)#143288
Conversation
Fixes a bug when ESQL pushes `LENGTH` to block loadering of ordinals. Closes elastic#143222 Closes elastic#143223 Closes elastic#143224 This was caused by elastic#143224
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
There was a problem hiding this comment.
Pull request overview
This PR fixes an ArrayIndexOutOfBoundsException that occurred when ESQL's LENGTH, BYTE_LENGTH, and BIT_LENGTH functions were pushed down to block loading of keyword field ordinals. The bug was introduced when support for reading blocks with non-zero offsets was added but the array indexing wasn't properly adjusted.
Changes:
- Fixed array indexing in
Utf8CodePointsFromOrdsBlockLoaderto usei - offsetinstead ofiwhen offset > 0 - Refactored test infrastructure to consolidate duplicate
read()helper methods into the base test class - Unmuted three previously failing CSV specification tests
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| server/src/main/java/org/elasticsearch/index/mapper/blockloader/docvalues/fn/Utf8CodePointsFromOrdsBlockLoader.java | Fixed array indexing bug by using i - offset for both SortedDocValues and SortedSetDocValues cases |
| test/framework/src/main/java/org/elasticsearch/index/mapper/TestBlock.java | Made constructor public to allow test infrastructure to create TestBlock instances |
| test/framework/src/main/java/org/elasticsearch/index/mapper/AbstractBlockLoaderTestCase.java | Added centralized read() helper method that tests reading with various offset scenarios |
| server/src/test/java/org/elasticsearch/index/mapper/blockloader/docvalues/fn/*.java | Removed duplicate read() methods and unused imports from 7 test classes |
| x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/lucene/read/ValuesFromManyReader.java | Expanded TODO comment with additional context |
| muted-tests.yml | Unmuted 3 CSV tests that were failing due to the fixed bug |
Comments suppressed due to low confidence (1)
server/src/test/java/org/elasticsearch/index/mapper/blockloader/docvalues/fn/Utf8CodePointsFromOrdsBlockLoaderTests.java:52
- Inconsistent try-with-resources statement formatting. Line 52 was updated to remove the trailing semicolon, but lines 59 and 66 in the same file still have trailing semicolons. For consistency, either all should have the trailing semicolon or none should.
try (TestBlock strings = read(stringsReader, docs); TestBlock codePoints = read(codePointsReader, docs)) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Copilot, that's pretty good feedback. It's easy to fix and will save someone some confusion later. |
Fixes a bug when ESQL pushes `LENGTH` to block loadering of ordinals. Closes elastic#143222 Closes elastic#143223 Closes elastic#143224 This was caused by elastic#143224
Fixes a bug when ESQL pushes
LENGTHto block loadering of ordinals.Closes #143222
Closes #143223
Closes #143224
This was caused by #143224