Widen numeric mapping conflicts to one deterministic type #5902
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 640 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.387
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5902"
general
weight: 0.35
Swiddis
Description
When the indices behind one source map a field to two different number types, the plugin keeps the type of whichever index the merge reads last, and that order can change between nodes and after a restart. Under the wrong winner a value changes or comes back null with HTTP 200, so a
long5000000000read asintegerreturns705032704.|
fin index 0 |fin index 1 | merged type onmain|fields f|| --- | --- | --- | --- |
|
long5000000000|integer3|int| 705032704, 3 ||
long5000000000|integer3|bigint| 5000000000, 3 ||
double1.5|long5|bigint| null, 5 ||
double1.5|long5|double| 1.5, 5.0 ||
long16777217|half_float1.5|float| 16777216.0, 1.5 ||
long16777217|half_float1.5|bigint| 16777217, null |Fix. A new
NumericWideningRuleruns ahead ofLatestRuleinMergeRuleHelperand merges a numeric conflict to one type, whatever the read order. Two integer types merge to the wider one,half_floatandfloatmerge tofloat, and any other numeric pair merges todouble. The PPL limitations page now states the same rule.Each pair gave one merged type across 12 index name prefixes. Twelve indices covering all eight number types also merged to
double, and twelve integer indices tobigint, under five index name prefixes each.|
fin index 0 |fin index 1 | merged type with the rule |fields f|| --- | --- | --- | --- |
|
long5000000000|integer3|bigint| 5000000000, 3 ||
double1.5|long5|double| 1.5, 5.0 ||
long16777217|half_float1.5|double| 16777217.0, 1.5 |Notes, as mentioned in #5901
1. Why an integer with
floatgivesdouble- Core'sWideningTypeRulewould pickfloat, and afloatholds integers exactly only up to 2^24, so16777217would read16777216.0. The cost is that an integer row next to a floating point index renders as a double, so3reads3.0. A pushedminover afloatindex also prints0.1as0.10000000149011612, the stored float's exact value.2. What still reaches
LatestRule- A number against a string ordatetype, and analiasof a number field, keep today's behaviour.Related Issues
Part of #5828 - This fixes the number against number rows. Its other rows, such as
longagainstdate, are unchanged, so this PR does not resolve it.Resolves #5901
Testing
NumericWideningRuleTest, 13 cases that merge throughMergeRuleHelperin both orders, plus three type sets in all six orders. Taking the rule out ofRULESfails 6 of them, and makinghalf_floatwithfloatreturndoublefails 2.issues/5901.yml, 3 cases. The first spansbyte,short,integerandlong, the others pairlongwithdoubleand withhalf_float. Each asserts the schema type and the values. With the rule taken out ofRULES, the first and third failed on the type, reportingintandfloat. Thelongwithhalf_floatcase always fails without the rule, since its expecteddoubleis a type neither index holds. The other two fail only when a narrower index is read last, which depends on the index names in each JVM, so thelongwithdoublecase passed in that run.:opensearch:testran 1835 tests with 0 failures.| Engine | Result against
main|| --- | --- |
| PPL on Calcite, the rule alone against
mainat31eea45a8, about 100 templates | results that depend on read order fell from 1,627 of 5,768 to 0, 108 errors became a 200, and none got worse || PPL on V2, the same sweep with Calcite off, against
mainatf36c99f84| none worse || SQL, 50 queries and 1,400 results, against
mainatf36c99f84| none worse, and 558 improved |The SQL results improved where
mainread floating point values as null, read ashort300as44undertinyint, or cut a pushedMAXto an integer. The Calcite sweep changed no single-index result.Check List
- [x] New functionality has javadoc added.
- [x] New functionality has a user manual doc added.
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.