Skip to content

Commit 19f3fc2

Browse files
committed
Fix assertion error when executing row query with filter (#133704)
(cherry picked from commit 12fd34d)
1 parent f9e0f96 commit 19f3fc2

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

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

Lines changed: 8 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;
@@ -147,6 +148,13 @@ public void testRow() {
147148
}
148149
}
149150

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

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
@@ -595,7 +595,9 @@ private static void analyzeAndMaybeRetry(
595595
if (result.indices.isValid() || requestFilter != null) {
596596
// We won't run this check with no filter and no valid indices since this may lead to false positive - missing index report
597597
// when the resolution result is not valid for a different reason.
598-
EsqlCCSUtils.updateExecutionInfoWithClustersWithNoMatchingIndices(executionInfo, result.indices, requestFilter != null);
598+
if (executionInfo.clusterInfo.isEmpty() == false) {
599+
EsqlCCSUtils.updateExecutionInfoWithClustersWithNoMatchingIndices(executionInfo, result.indices, requestFilter != null);
600+
}
599601
}
600602
plan = analyzeAction.apply(result);
601603
} catch (Exception e) {

0 commit comments

Comments
 (0)