Skip to content
Merged
Show file tree
Hide file tree
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 @@ -7,7 +7,6 @@

package org.elasticsearch.xpack.esql.analysis;

import org.elasticsearch.xpack.esql.EsqlIllegalArgumentException;
import org.elasticsearch.xpack.esql.core.expression.Alias;
import org.elasticsearch.xpack.esql.core.expression.Attribute;
import org.elasticsearch.xpack.esql.core.expression.Expression;
Expand Down Expand Up @@ -67,10 +66,13 @@ public LogicalPlan rule(TimeSeriesAggregate aggregate) {
}

if (lastNonTSAggFunction != null) {
throw new EsqlIllegalArgumentException(
"Cannot mix time-series aggregate [{}] and regular aggregate [{}] in the same TimeSeriesAggregate.",
lastTSAggFunction.sourceText(),
lastNonTSAggFunction.sourceText()
throw new IllegalArgumentException(
"Cannot mix time-series aggregate ["
+ lastTSAggFunction.sourceText()
+ "] and regular aggregate ["
+ lastNonTSAggFunction.sourceText()
+ "] in the same TimeSeriesAggregate."

);
}

Expand All @@ -86,9 +88,9 @@ public LogicalPlan rule(TimeSeriesAggregate aggregate) {

for (Expression grouping : aggregate.groupings()) {
if (Functions.isGrouping(Alias.unwrap(grouping)) == false) {
throw new EsqlIllegalArgumentException(
"Cannot mix time-series aggregate and grouping attributes. Found [{}].",
grouping.sourceText()
throw new IllegalArgumentException(
"Cannot mix time-series aggregate and grouping attributes. Found [" + grouping.sourceText() + "]."

);
}
groupings.add(grouping);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import org.elasticsearch.TransportVersion;
import org.elasticsearch.index.IndexMode;
import org.elasticsearch.xpack.esql.EsqlIllegalArgumentException;
import org.elasticsearch.xpack.esql.EsqlTestUtils;
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
import org.elasticsearch.xpack.esql.analysis.Analyzer;
Expand Down Expand Up @@ -264,7 +263,7 @@ public void testCountOverTime() {
public void testMixedBareOverTimeAndRegularAggregates() {
assumeTrue("requires metrics command", EsqlCapabilities.Cap.METRICS_GROUP_BY_ALL.isEnabled());

var error = expectThrows(EsqlIllegalArgumentException.class, () -> { planK8s("""
var error = expectThrows(IllegalArgumentException.class, () -> { planK8s("""
TS k8s
| STATS avg_over_time(network.cost), sum(network.total_bytes_in)
"""); });
Expand All @@ -277,7 +276,7 @@ public void testMixedBareOverTimeAndRegularAggregates() {
public void testGroupingKeyInAggregatesListPreserved() {
assumeTrue("requires metrics command", EsqlCapabilities.Cap.METRICS_GROUP_BY_ALL.isEnabled());

var error = expectThrows(EsqlIllegalArgumentException.class, () -> { planK8s("""
var error = expectThrows(IllegalArgumentException.class, () -> { planK8s("""
TS k8s
| STATS rate(network.total_bytes_out) BY region, TBUCKET(1hour)
"""); });
Expand Down