Skip to content

Commit c602a60

Browse files
committed
Pick up latest changes in main
1 parent a8b2e19 commit c602a60

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/logical/promql/TranslatePromqlToTimeSeriesAggregate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ private LogicalPlan translate(LogicalPlan promqlPlan) {
9595
private record MapResult(LogicalPlan plan, Map<String, Expression> extras) {}
9696

9797
// Will pattern match on PromQL plan types:
98-
// - WithinSeriesAggregate -> TimeSeriesAggregate
9998
// - AcrossSeriesAggregate -> Aggregate over TimeSeriesAggregate
99+
// - WithinSeriesAggregate -> TimeSeriesAggregate
100100
// - Selector -> EsRelation + Filter
101101
private static MapResult map(LogicalPlan p) {
102102
if (p instanceof Selector selector) {

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/LogicalPlanBuilder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,9 @@ public PlanFactory visitPromqlCommand(EsqlBaseParser.PromqlCommandContext ctx) {
12051205
}
12061206

12071207
int promqlStartLine = source.source().getLineNumber();
1208-
int promqlStartColumn = terminalNode != null ? terminalNode.getSymbol().getCharPositionInLine() : source.source().getColumnNumber();
1208+
int promqlStartColumn = queryCtx != null && !queryCtx.isEmpty()
1209+
? queryCtx.get(0).start.getCharPositionInLine()
1210+
: source.source().getColumnNumber();
12091211

12101212
PromqlParser promqlParser = new PromqlParser();
12111213
LogicalPlan promqlPlan;

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/promql/PromqlLogicalPlanOptimizerTests.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,26 @@
77

88
package org.elasticsearch.xpack.esql.optimizer.promql;
99

10+
import org.elasticsearch.TransportVersion;
1011
import org.elasticsearch.index.IndexMode;
12+
import org.elasticsearch.transport.Transport;
1113
import org.elasticsearch.xpack.esql.EsqlTestUtils;
1214
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
1315
import org.elasticsearch.xpack.esql.analysis.Analyzer;
1416
import org.elasticsearch.xpack.esql.analysis.AnalyzerContext;
17+
import org.elasticsearch.xpack.esql.core.tree.Source;
1518
import org.elasticsearch.xpack.esql.expression.function.EsqlFunctionRegistry;
1619
import org.elasticsearch.xpack.esql.index.EsIndex;
1720
import org.elasticsearch.xpack.esql.index.IndexResolution;
1821
import org.elasticsearch.xpack.esql.optimizer.AbstractLogicalPlanOptimizerTests;
19-
import org.elasticsearch.xpack.esql.parser.QueryParams;
22+
import org.elasticsearch.xpack.esql.plan.IndexPattern;
2023
import org.elasticsearch.xpack.esql.plan.logical.LogicalPlan;
2124
import org.junit.BeforeClass;
22-
import org.junit.Ignore;
2325

26+
import java.util.Collections;
2427
import java.util.Map;
2528

29+
import static java.util.Collections.emptyMap;
2630
import static org.elasticsearch.xpack.esql.EsqlTestUtils.TEST_VERIFIER;
2731
import static org.elasticsearch.xpack.esql.EsqlTestUtils.emptyInferenceResolution;
2832
import static org.elasticsearch.xpack.esql.EsqlTestUtils.loadMapping;
@@ -45,9 +49,11 @@ public static void initTest() {
4549
new AnalyzerContext(
4650
EsqlTestUtils.TEST_CFG,
4751
new EsqlFunctionRegistry(),
48-
timeSeriesIndex,
52+
Map.of(new IndexPattern(Source.EMPTY, "k8s"), timeSeriesIndex),
53+
emptyMap(),
4954
enrichResolution,
50-
emptyInferenceResolution()
55+
emptyInferenceResolution(),
56+
TransportVersion.current()
5157
),
5258
TEST_VERIFIER
5359
);

0 commit comments

Comments
 (0)