@@ -79,7 +79,7 @@ protected LogicalPlan planK8s(String query) {
79
79
* }</pre>
80
80
*/
81
81
public void testMaxOverTime () {
82
- assumeTrue ("requires metrics command" , EsqlCapabilities .Cap .METRICS_COMMAND .isEnabled ());
82
+ assumeTrue ("requires metrics command" , EsqlCapabilities .Cap .TS_COMMAND_V0 .isEnabled ());
83
83
LogicalPlan plan = planK8s ("""
84
84
TS k8s
85
85
| STATS count(max_over_time(network.cost)) BY time_bucket = BUCKET(@timestamp, 1 minute)
@@ -94,7 +94,7 @@ public void testMaxOverTime() {
94
94
}
95
95
96
96
public void testMaxOfRate () {
97
- assumeTrue ("requires metrics command" , EsqlCapabilities .Cap .METRICS_COMMAND .isEnabled ());
97
+ assumeTrue ("requires metrics command" , EsqlCapabilities .Cap .TS_COMMAND_V0 .isEnabled ());
98
98
LogicalPlan plan = planK8s ("""
99
99
TS k8s
100
100
| STATS max(rate(network.total_bytes_in)) BY time_bucket = BUCKET(@timestamp, 1 minute)
@@ -126,7 +126,7 @@ public void testMaxOfRate() {
126
126
* }</pre>
127
127
*/
128
128
public void testAvgOfAvgOverTime () {
129
- assumeTrue ("requires metrics command" , EsqlCapabilities .Cap .METRICS_COMMAND .isEnabled ());
129
+ assumeTrue ("requires metrics command" , EsqlCapabilities .Cap .TS_COMMAND_V0 .isEnabled ());
130
130
LogicalPlan plan = planK8s ("""
131
131
TS k8s
132
132
| STATS avg_cost=avg(avg_over_time(network.cost)) BY cluster, time_bucket = bucket(@timestamp,1minute)
@@ -142,4 +142,31 @@ public void testAvgOfAvgOverTime() {
142
142
Eval bucketEval = as (innerStats .child (), Eval .class ); // compute the tbucket
143
143
EsRelation relation = as (bucketEval .child (), EsRelation .class );
144
144
}
145
+
146
+ public void testRenameTimestampWithRate () {
147
+ assumeTrue ("requires metrics command" , EsqlCapabilities .Cap .TS_COMMAND_V0 .isEnabled ());
148
+ LogicalPlan plan = planK8s ("""
149
+ TS k8s
150
+ | RENAME `@timestamp` AS newTs
151
+ | STATS maxRate = max(rate(network.total_cost)) BY tbucket = bucket(newTs, 1hour)
152
+ """ );
153
+ }
154
+
155
+ public void testRenameTimestampWithOverTimeFunction () {
156
+ assumeTrue ("requires metrics command" , EsqlCapabilities .Cap .TS_COMMAND_V0 .isEnabled ());
157
+ LogicalPlan plan = planK8s ("""
158
+ TS k8s
159
+ | RENAME `@timestamp` AS newTs
160
+ | STATS maxRate = max(max_over_time(network.eth0.tx)) BY tbucket = bucket(newTs, 1hour)
161
+ """ );
162
+ }
163
+
164
+ public void testRenameTimestampWithOverTimeFunctionWithTbucket () {
165
+ assumeTrue ("requires metrics command" , EsqlCapabilities .Cap .TS_COMMAND_V0 .isEnabled ());
166
+ LogicalPlan plan = planK8s ("""
167
+ TS k8s
168
+ | RENAME `@timestamp` AS newTs
169
+ | STATS maxRate = max(max_over_time(network.eth0.tx)) BY tbucket = tbucket(1hour)
170
+ """ );
171
+ }
145
172
}
0 commit comments