Skip to content

Commit d590269

Browse files
update capability
1 parent 380e370 commit d590269

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/RestEsqlTestCase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -996,8 +996,8 @@ private void validateResultsOfDoubleParametersForIdentifiers(RequestObjectBuilde
996996

997997
public void testMultipleBatchesWithLookupJoin() throws IOException {
998998
assumeTrue(
999-
"Requires new null alias ids for join with multiple batches",
1000-
EsqlCapabilities.Cap.REPLACE_MISSING_FIELD_WITH_NULL_NEW_ALIAS_ID_FOR_JOIN_AND_MULTIPLE_BATCHES.isEnabled()
999+
"Makes numberOfChannels consistent with layout map for join with multiple batches",
1000+
EsqlCapabilities.Cap.MAKE_NUMBER_OF_CHANNELS_CONSISTENT_WITH_LAYOUT.isEnabled()
10011001
);
10021002
// Create more than 10 indices to trigger multiple batches of data node execution.
10031003
// The sort field should be missing on some indices to reproduce NullPointerException caused by duplicated items in layout

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,7 @@ emp_no:integer | language_code:integer | language_name:keyword
14561456
multipleBatchesWithSort
14571457
required_capability: join_lookup_v12
14581458
required_capability: remove_redundant_sort
1459-
required_capability: replace_missing_field_with_null_new_alias_id_for_join_and_multiple_batches
1459+
required_capability: make_number_of_channels_consistent_with_layout
14601460

14611461
from *
14621462
| rename city.country.continent.planet.name as message
@@ -1473,7 +1473,7 @@ language_code:integer
14731473
multipleBatchesWithMvExpand
14741474
required_capability: join_lookup_v12
14751475
required_capability: remove_redundant_sort
1476-
required_capability: replace_missing_field_with_null_new_alias_id_for_join_and_multiple_batches
1476+
required_capability: make_number_of_channels_consistent_with_layout
14771477

14781478
from *
14791479
| rename city.country.continent.planet.name as message
@@ -1491,7 +1491,7 @@ birth_date:datetime |language_code:integer
14911491
multipleBatchesWithAggregate1
14921492
required_capability: join_lookup_v12
14931493
required_capability: remove_redundant_sort
1494-
required_capability: replace_missing_field_with_null_new_alias_id_for_join_and_multiple_batches
1494+
required_capability: make_number_of_channels_consistent_with_layout
14951495

14961496
from *
14971497
| rename city.country.continent.planet.name as message
@@ -1507,7 +1507,7 @@ x:datetime |y:integer
15071507
multipleBatchesWithAggregate2
15081508
required_capability: join_lookup_v12
15091509
required_capability: remove_redundant_sort
1510-
required_capability: replace_missing_field_with_null_new_alias_id_for_join_and_multiple_batches
1510+
required_capability: make_number_of_channels_consistent_with_layout
15111511

15121512
from *
15131513
| rename city.country.continent.planet.name as message
@@ -1525,7 +1525,7 @@ null |1
15251525
multipleBatchesWithAggregate3
15261526
required_capability: join_lookup_v12
15271527
required_capability: remove_redundant_sort
1528-
required_capability: replace_missing_field_with_null_new_alias_id_for_join_and_multiple_batches
1528+
required_capability: make_number_of_channels_consistent_with_layout
15291529

15301530
from *
15311531
| rename city.country.continent.planet.name as message

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,9 +930,9 @@ public enum Cap {
930930
INDEX_COMPONENT_SELECTORS(DataStream.isFailureStoreFeatureFlagEnabled()),
931931

932932
/**
933-
* Create null alias with new id in ReplaceMissingFieldWithNull when there is lookup join with multiple batches.
933+
* Make numberOfChannels consistent with layout in DefaultLayout by removing duplicated ChannelSet.
934934
*/
935-
REPLACE_MISSING_FIELD_WITH_NULL_NEW_ALIAS_ID_FOR_JOIN_AND_MULTIPLE_BATCHES;
935+
MAKE_NUMBER_OF_CHANNELS_CONSISTENT_WITH_LAYOUT;
936936

937937
private final boolean enabled;
938938

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/Layout.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ public Layout build() {
111111
int channel = 0;
112112
for (NameId id : set.nameIds) {
113113
if (layout.containsKey(id)) {
114+
// If a NameId already exists in the map, do not increase the numberOfChannels, it can cause inverse() to create
115+
// a null in the list of channels, and NullPointerException when build() is called.
116+
// TODO avoid adding duplicated attributes with the same id in the plan, ReplaceMissingFieldWithNull may add nulls
117+
// with the same ids as the missing field ids.
114118
continue;
115119
}
116120
if (createNewChannel) {

0 commit comments

Comments
 (0)