Repository navigation
fix(core): a value Elasticsearch ignored as malformed reads as NULL for every kind, and no number narrows silently - #472
Merged
Conversation
…or every kind, and no number narrows silently (SCHEMA-17) Story SCHEMA-17-R172. Reviewed: r0:must-fix, r1:must-fix, r2:clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fupelaqu
marked this pull request as ready for review
November 21, 2026 11:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two fixes to how a stored value reaches a typed column, both in the JDBC driver's getters and Arrow cells:
ignore_malformed, Elasticsearch indexes the document, skips the bad value and names the field in the hit's_ignored. Dates already followed that verdict. Other kinds came back as stored instead. A"x"in alongarrived as text in aBIGINTcolumn, and the getter failed withFor input string: "x". A3000000000in anintegerarrived as aLongin anINTcolumn, andgetIntreturned-1294967296without any error.TINYINT,SMALLINT,INT,BIGINTorREALnow fails withValue <v> is out of range for <TYPE>, as DuckDB's conversion error does, instead of wrapping. This also closes three silent paths with no_ignoredinvolved:INTover alongfield;INTsum past the int range;Change
HitReadingbuilds, once per statement, a map from each top-level path to its Elasticsearch kind, from the column's mapping type. That gives a single lookup for every hit-reading path._ignorednames is NULL;ARRAY<X>column, only the elements Elasticsearch refused are NULL; an element its own parser accepts keeps its value.byte/short/integer/long: a value outside the type's range;unsigned_long: a negative value or one with a decimal part (a whole value of any size is indexed);float/half_float(after its rounding) /double/scaled_float: a non-finite value;boolean: anything but Elasticsearch's own literals;ip: anything but a literal IPv4 or IPv6 address, checked without any DNS lookup;geo_point: anything that is not a point.keyword,wildcard,constant_keywordandtextnever become NULL._ignoredalso names a keyword overignore_above, and that value is valid: it keeps its text.ValueCoercion.coerceToByte/Short/Int/Long/Float:REALfails on a finite value aboveFloat.MaxValueand keepsNaN/±Infinity.documentation/client/gateway.mdanddocumentation/client/jdbc.mddescribe both rules.Cost
10,000-row numeric-only extraction on Elasticsearch 8.18.3, runs interleaved main / branch / main / branch:
The
_ignoredcheck is one constant-time lookup per hit, and it allocates nothing when the hit has no_ignored.Testing
Unit tests:
sql/test2376/0 andcore/test1728/0;ValueCoercionRangeSpec, which covers every bound;HitReadingIgnoredValuesSpec, 10/10, failing on the base commit.+ compilepasses on Scala 2.12 and 2.13.es6rest,es7restandes9javatest sources compile.Elasticsearch 8.18.3:
JavaClientIgnoredValueReadingSpec, 8/8, over every kind acrossSELECT *, a named column, a WHERE filter, scroll, arrays,ARRAY<X>columns, a keyword overignore_aboveand the three range-guard paths;These ES runs used the commit before the last review round. That round changed the
unsigned_longacceptance (unit-tested) and one test literal.Probe before the change, on Elasticsearch 8.18.3 and 6.8.23: it measured what each kind returns and what
_ignorednames.CI lint line passes.
Not run locally: Elasticsearch 7.17 and 9 (runners added, CI).
Elasticsearch versions
scaled_float: covered from 8.6, the first version that names a refused one in_ignored. Before 8.6 its value is answered as stored, and the test gates that row by version.short/integer/long, even underignore_malformed, so the silent case does not exist there.scaled_floatin_ignored.Release note
ip,geo_point,booleanwhere accepted) now reads as NULL, as dates already did. In arrays only the ignored elements are NULL, and a keyword overignore_abovekeeps its text. Verified on Elasticsearch 7.17 and later; ascaled_floatfrom 8.6.Value <v> is out of range for <TYPE>instead of returning a wrapped number.Recorded, not fixed
obj.nholding"x") is still read as stored text, so it fails loudly in the getter.obj.iholding3000000000now fails through the range guard.integerandlongintoBIGINTjudges array elements bylong.2147483647.9gives INT2147483647).🤖 Generated with Claude Code