From fa42c0e2f6967f183968b45180f5742317ad203c Mon Sep 17 00:00:00 2001 From: Nhat Nguyen Date: Wed, 27 Aug 2025 09:40:54 -0700 Subject: [PATCH] Fix TimeSeriesIT#testProfile --- muted-tests.yml | 3 --- .../org/elasticsearch/xpack/esql/action/TimeSeriesIT.java | 7 +++++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/muted-tests.yml b/muted-tests.yml index a2b013eec364d..5d08417d75276 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -648,9 +648,6 @@ tests: - class: org.elasticsearch.compute.data.BasicBlockTests method: testFloatBlock issue: https://github.com/elastic/elasticsearch/issues/133621 -- class: org.elasticsearch.xpack.esql.action.TimeSeriesIT - method: testProfile - issue: https://github.com/elastic/elasticsearch/issues/133624 # Examples: # diff --git a/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/TimeSeriesIT.java b/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/TimeSeriesIT.java index 182d75e7e437c..efaef24675e2b 100644 --- a/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/TimeSeriesIT.java +++ b/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/TimeSeriesIT.java @@ -33,6 +33,7 @@ import static org.elasticsearch.index.mapper.DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER; import static org.hamcrest.Matchers.closeTo; import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.either; import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasSize; @@ -553,7 +554,9 @@ public void testProfile() { if (p.operators().stream().anyMatch(s -> s.status() instanceof TimeSeriesSourceOperator.Status)) { assertThat(p.operators(), hasSize(2)); TimeSeriesSourceOperator.Status status = (TimeSeriesSourceOperator.Status) p.operators().get(0).status(); - assertThat(status.processedShards(), hasSize(1)); + // If the target shard is empty or does not match the query, processedShards will be empty. + // TODO: Update ComputeService to avoid creating pipelines for non-matching or empty shards. + assertThat(status.processedShards(), either(hasSize(1)).or(empty())); assertThat(p.operators().get(1).operator(), equalTo("ExchangeSinkOperator")); } else if (p.operators().stream().anyMatch(s -> s.status() instanceof TimeSeriesAggregationOperator.Status)) { assertThat(p.operators(), hasSize(3)); @@ -587,7 +590,7 @@ public void testProfile() { assertThat(ops.get(0).operator(), containsString("LuceneSourceOperator")); assertThat(ops.get(0).status(), Matchers.instanceOf(LuceneSourceOperator.Status.class)); LuceneSourceOperator.Status status = (LuceneSourceOperator.Status) ops.get(0).status(); - assertThat(status.processedShards(), hasSize(3)); + assertThat(status.processedShards().size(), Matchers.lessThanOrEqualTo(3)); assertThat(ops.get(1).operator(), containsString("EvalOperator")); assertThat(ops.get(2).operator(), containsString("ValuesSourceReaderOperator")); assertThat(ops.get(3).operator(), containsString("TimeSeriesAggregationOperator"));