Skip to content

Commit 16b48f3

Browse files
authored
[8.19] Fix assertion error when executing row query with filter (#133704) (#133792)
* Fix assertion error when executing row query with filter (#133704) (cherry picked from commit 12fd34d) * fix compilation
1 parent d57b83c commit 16b48f3

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/EsqlActionIT.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.elasticsearch.index.IndexSettings;
3939
import org.elasticsearch.index.mapper.DateFieldMapper;
4040
import org.elasticsearch.index.mapper.extras.MapperExtrasPlugin;
41+
import org.elasticsearch.index.query.BoolQueryBuilder;
4142
import org.elasticsearch.index.query.QueryBuilder;
4243
import org.elasticsearch.index.query.RangeQueryBuilder;
4344
import org.elasticsearch.index.shard.IndexShard;
@@ -86,6 +87,7 @@
8687
import static org.elasticsearch.test.MapMatcher.assertMap;
8788
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
8889
import static org.elasticsearch.xpack.esql.EsqlTestUtils.getValuesList;
90+
import static org.elasticsearch.xpack.esql.action.EsqlQueryRequest.syncEsqlQueryRequest;
8991
import static org.hamcrest.Matchers.allOf;
9092
import static org.hamcrest.Matchers.anyOf;
9193
import static org.hamcrest.Matchers.contains;
@@ -146,6 +148,16 @@ public void testRow() {
146148
}
147149
}
148150

151+
public void testRowWithFilter() {
152+
long value = randomLongBetween(0, Long.MAX_VALUE);
153+
EsqlQueryRequest request = syncEsqlQueryRequest();
154+
request.query("row " + value);
155+
request.filter(new BoolQueryBuilder().boost(1.0f));
156+
try (EsqlQueryResponse response = run(request)) {
157+
assertEquals(List.of(List.of(value)), getValuesList(response));
158+
}
159+
}
160+
149161
public void testFromStatsGroupingAvgWithSort() {
150162
testFromStatsGroupingAvgImpl("from test | stats avg(count) by data | sort data | limit 2", "data", "avg(count)");
151163
}

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session/EsqlSession.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,9 @@ private static void analyzeAndMaybeRetry(
568568
if (result.indices.isValid() || requestFilter != null) {
569569
// We won't run this check with no filter and no valid indices since this may lead to false positive - missing index report
570570
// when the resolution result is not valid for a different reason.
571-
EsqlCCSUtils.updateExecutionInfoWithClustersWithNoMatchingIndices(executionInfo, result.indices, requestFilter != null);
571+
if (executionInfo.clusterInfo.isEmpty() == false) {
572+
EsqlCCSUtils.updateExecutionInfoWithClustersWithNoMatchingIndices(executionInfo, result.indices, requestFilter != null);
573+
}
572574
}
573575
plan = analyzeAction.apply(result);
574576
} catch (Exception e) {

0 commit comments

Comments
 (0)