Skip to content

Commit 3c46233

Browse files
committed
PromQL: fix incorrect usage of datetime literals
fixes #138636
1 parent 93d9a0b commit 3c46233

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/Literal.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public static Literal timeDuration(Source source, Duration literal) {
219219
}
220220

221221
public static Literal dateTime(Source source, Instant literal) {
222-
return new Literal(source, literal, DataType.DATETIME);
222+
return new Literal(source, literal.toEpochMilli(), DataType.DATETIME);
223223
}
224224

225225
public static Literal integer(Source source, Integer literal) {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
promql_start_end_step
2+
required_capability: promql_pre_tech_preview_v1
3+
TS k8s
4+
| PROMQL step 5m start "2024-05-10T00:20:00.000Z" end "2024-05-10T00:25:00.000Z" (
5+
sum(avg_over_time(network.cost[5m]))
6+
);
7+
8+
sum(avg_over_time(network.cost[5m])):double | step:date
9+
50.25 | 2024-05-10T00:20:00.000Z
10+
;
11+

0 commit comments

Comments
 (0)