Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.elasticsearch.index.IndexMode;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.esql.EsqlTestUtils;
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
import org.elasticsearch.xpack.esql.analysis.Analyzer;
import org.elasticsearch.xpack.esql.analysis.AnalyzerContext;
import org.elasticsearch.xpack.esql.analysis.AnalyzerTestUtils;
Expand Down Expand Up @@ -115,6 +116,7 @@ private LogicalPlan localPlan(String query) {
}

public void testSimple() {
assumeTrue("requires metrics command", EsqlCapabilities.Cap.METRICS_COMMAND.isEnabled());
LogicalPlan actual = localPlan("""
TS test
| STATS max(max_over_time(metric_1))
Expand Down Expand Up @@ -144,7 +146,7 @@ public void testRuleDoesNotApplyInNonTSMode() {
}

public void testDimensionsAreNotFiltered() {

assumeTrue("requires metrics command", EsqlCapabilities.Cap.METRICS_COMMAND.isEnabled());
LogicalPlan actual = localPlan("""
TS test
| STATS max(max_over_time(metric_1)) BY dimension_1
Expand All @@ -161,7 +163,7 @@ public void testDimensionsAreNotFiltered() {
}

public void testFiltersAreJoinedWithOr() {

assumeTrue("requires metrics command", EsqlCapabilities.Cap.METRICS_COMMAND.isEnabled());
LogicalPlan actual = localPlan("""
TS test
| STATS max(max_over_time(metric_1)), min(min_over_time(metric_2))
Expand Down Expand Up @@ -197,6 +199,7 @@ public void testFiltersAreJoinedWithOr() {
public void testSkipCoalescedMetrics() {
// Note: this test is passing because the reference attribute metric_2 in the stats block does not inherit the
// metric property from the original field.
assumeTrue("requires metrics command", EsqlCapabilities.Cap.METRICS_COMMAND.isEnabled());
LogicalPlan actual = localPlan("""
TS test
| EVAL metric_2 = coalesce(metric_2, 0)
Expand All @@ -218,6 +221,7 @@ public void testSkipCoalescedMetrics() {
* check that stats blocks after the first are not sourced for adding metrics to the filter
*/
public void testMultipleStats() {
assumeTrue("requires metrics command", EsqlCapabilities.Cap.METRICS_COMMAND.isEnabled());
LogicalPlan actual = localPlan("""
TS test
| STATS m = max(max_over_time(metric_1))
Expand All @@ -232,6 +236,5 @@ public void testMultipleStats() {
IsNotNull condition = as(filter.condition(), IsNotNull.class);
FieldAttribute attribute = as(condition.field(), FieldAttribute.class);
assertEquals("metric_1", attribute.fieldName().string());

}
}