Skip to content

Commit dd4bb3d

Browse files
committed
pass index mode
1 parent 9e05446 commit dd4bb3d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public LogicalPlan visitRowCommand(EsqlBaseParser.RowCommandContext ctx) {
268268
return new Row(source(ctx), (List<Alias>) (List) mergeOutputExpressions(visitFields(ctx.fields()), List.of()));
269269
}
270270

271-
private UnresolvedRelation visitRelation(Source source, String commandName, EsqlBaseParser.IndexPatternAndMetadataFieldsContext ctx) {
271+
private UnresolvedRelation visitRelation(Source source, IndexMode indexMode, EsqlBaseParser.IndexPatternAndMetadataFieldsContext ctx) {
272272
IndexPattern table = new IndexPattern(source, visitIndexPattern(ctx.indexPattern()));
273273
Map<String, Attribute> metadataMap = new LinkedHashMap<>();
274274
if (ctx.metadata() != null) {
@@ -285,13 +285,13 @@ private UnresolvedRelation visitRelation(Source source, String commandName, Esql
285285
}
286286
}
287287
List<Attribute> metadataFields = List.of(metadataMap.values().toArray(Attribute[]::new));
288-
final IndexMode indexMode = commandName.equals("TS") ? IndexMode.TIME_SERIES : IndexMode.STANDARD;
288+
final String commandName = indexMode == IndexMode.TIME_SERIES ? "TS" : "FROM";
289289
return new UnresolvedRelation(source, table, false, metadataFields, indexMode, null, commandName);
290290
}
291291

292292
@Override
293293
public LogicalPlan visitFromCommand(EsqlBaseParser.FromCommandContext ctx) {
294-
return visitRelation(source(ctx), "FROM", ctx.indexPatternAndMetadataFields());
294+
return visitRelation(source(ctx), IndexMode.STANDARD, ctx.indexPatternAndMetadataFields());
295295
}
296296

297297
@Override
@@ -518,7 +518,7 @@ public LogicalPlan visitTimeSeriesCommand(EsqlBaseParser.TimeSeriesCommandContex
518518
if (Build.current().isSnapshot() == false) {
519519
throw new IllegalArgumentException("TS command currently requires a snapshot build");
520520
}
521-
return visitRelation(source(ctx), "TS", ctx.indexPatternAndMetadataFields());
521+
return visitRelation(source(ctx), IndexMode.TIME_SERIES, ctx.indexPatternAndMetadataFields());
522522
}
523523

524524
@Override

0 commit comments

Comments
 (0)