Skip to content

Commit c121c03

Browse files
committed
Add tests + capability
1 parent c3c8245 commit c121c03

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

x-pack/plugin/esql/qa/testFixtures/src/main/resources/enrich.csv-spec

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,3 +643,21 @@ FROM airports
643643
abbrev:k | city_name:k | city_location:geo_point | country:k | location:geo_point | name:text | region:text | boundary_wkt_length:i
644644
IDR | Indore | POINT(75.8472 22.7167) | India | POINT(75.8092915005895 22.727749187571) | Devi Ahilyabai Holkar Int'l | Indore City | 231
645645
;
646+
647+
// Regression test for https://github.com/elastic/elasticsearch/issues/126030
648+
// We had wrong layouts from ReplaceMissingFieldsWithNull in case of indices that had relevant fields for the query,
649+
// but were **missing the field we enrich on**.
650+
fieldsInOtherIndicesBug
651+
required_capability: enrich_load
652+
required_capability: fix_replace_missing_field_with_null_duplicate_name_id_in_layout
653+
654+
from *
655+
| keep author.keyword, book_no, scalerank, street, bytes_in, @timestamp, abbrev, city_location, distance, description, birth_date, language_code, intersects, client_ip, event_duration, version
656+
| enrich languages_policy on author.keyword
657+
| sort book_no
658+
| limit 1
659+
;
660+
661+
author.keyword:keyword|book_no:keyword|scalerank:integer|street:keyword|bytes_in:ul|@timestamp:unsupported|abbrev:keyword|city_location:geo_point|distance:double|description:unsupported|birth_date:date|language_code:integer|intersects:boolean|client_ip:unsupported|event_duration:long|version:version|language_name:keyword
662+
Fyodor Dostoevsky |1211 |null |null |null |null |null |null |null |null |null |null |null |null |null |null |null
663+
;

x-pack/plugin/esql/qa/testFixtures/src/main/resources/lookup-join.csv-spec

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,6 +1453,10 @@ emp_no:integer | language_code:integer | language_name:keyword
14531453
10093 | 3 | Spanish
14541454
;
14551455

1456+
###############################################
1457+
# Bugfixes
1458+
###############################################
1459+
14561460
multipleBatchesWithSort
14571461
required_capability: join_lookup_v12
14581462
required_capability: remove_redundant_sort
@@ -1539,3 +1543,21 @@ from *
15391543
m:integer |birth_date:datetime
15401544
null |1952-02-27T00:00:00.000Z
15411545
;
1546+
1547+
// Regression test for https://github.com/elastic/elasticsearch/issues/126030
1548+
// We had wrong layouts from ReplaceMissingFieldsWithNull
1549+
1550+
enrichLookupStatsBug
1551+
required_capability: join_lookup_v12
1552+
required_capability: fix_replace_missing_field_with_null_duplicate_name_id_in_layout
1553+
1554+
from *
1555+
| enrich languages_policy on cluster
1556+
| rename languages.byte as language_code
1557+
| lookup join languages_lookup on language_code
1558+
| stats salary_change.long = max(ratings), foo = max(num)
1559+
;
1560+
1561+
salary_change.long:double|foo:long
1562+
5.0 |1698069301543123456
1563+
;

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,12 @@ public enum Cap {
942942
/**
943943
* Support for sorting when aggregate_metric_doubles are present
944944
*/
945-
AGGREGATE_METRIC_DOUBLE_SORTING(AGGREGATE_METRIC_DOUBLE_FEATURE_FLAG);
945+
AGGREGATE_METRIC_DOUBLE_SORTING(AGGREGATE_METRIC_DOUBLE_FEATURE_FLAG),
946+
947+
/**
948+
* Supercedes {@link Cap#MAKE_NUMBER_OF_CHANNELS_CONSISTENT_WITH_LAYOUT}.
949+
*/
950+
FIX_REPLACE_MISSING_FIELD_WITH_NULL_DUPLICATE_NAME_ID_IN_LAYOUT;
946951

947952
private final boolean enabled;
948953

0 commit comments

Comments
 (0)