Skip to content

Commit 84717ba

Browse files
committed
ES|QL: Add TBUCKET function
Add TBUCKET capability Closes #131068
1 parent cc16a42 commit 84717ba

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

x-pack/plugin/esql/qa/testFixtures/src/main/resources/tbucket.csv-spec

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// TBUCKET-specific tests
22

33
tbucketByTenSecondsDuration#[skip:-9.1.99,reason:new grouping function added in 9.2]
4+
required_capability: tbucket
45

56
FROM sample_data
67
| STATS min = MAX(@timestamp), max = MAX(@timestamp) BY bucket = TBUCKET(10 seconds)
@@ -19,6 +20,7 @@ min:datetime | max:datetime | bucket:datetime
1920

2021
tbucketByTenSecondsDurationAsString#[skip:-9.1.99,reason:new grouping function added in 9.2]
2122
required_capability: implicit_casting_string_literal_to_temporal_amount
23+
required_capability: tbucket
2224

2325
FROM sample_data
2426
| STATS min = MAX(@timestamp), max = MAX(@timestamp) BY bucket = TBUCKET("10 seconds")
@@ -36,6 +38,7 @@ min:datetime | max:datetime | bucket:datetime
3638
;
3739

3840
tbucketByTenMinutesDuration#[skip:-9.1.99,reason:new grouping function added in 9.2]
41+
required_capability: tbucket
3942

4043
FROM sample_data
4144
| STATS min = MAX(@timestamp), max = MAX(@timestamp) BY bucket = TBUCKET(10 minutes)
@@ -51,6 +54,7 @@ min:datetime | max:datetime | bucket:datetime
5154

5255
tbucketByTenMinutesDurationAsString#[skip:-9.1.99,reason:new grouping function added in 9.2]
5356
required_capability: implicit_casting_string_literal_to_temporal_amount
57+
required_capability: tbucket
5458

5559
FROM sample_data
5660
| STATS min = MAX(@timestamp), max = MAX(@timestamp) BY bucket = TBUCKET("10 minutes")
@@ -65,6 +69,7 @@ min:datetime | max:datetime | bucket:datetime
6569
;
6670

6771
docsTBucketByOneHourDuration#[skip:-9.1.99,reason:new grouping function added in 9.2]
72+
required_capability: tbucket
6873

6974
// tag::docsTBucketByOneHourDuration[]
7075
FROM sample_data
@@ -82,6 +87,7 @@ min:datetime | max:datetime | bucket:datetime
8287

8388
docsTBucketByOneHourDurationAsString#[skip:-9.1.99,reason:new grouping function added in 9.2]
8489
required_capability: implicit_casting_string_literal_to_temporal_amount
90+
required_capability: tbucket
8591

8692
// tag::docsTBucketByOneHourDurationAsString[]
8793
FROM sample_data
@@ -98,6 +104,7 @@ min:datetime | max:datetime | bucket:datetime
98104
;
99105

100106
tbucketByOneDayDuration#[skip:-9.1.99,reason:new grouping function added in 9.2]
107+
required_capability: tbucket
101108

102109
FROM sample_data
103110
| STATS min = MAX(@timestamp), max = MAX(@timestamp) BY bucket = TBUCKET(1 day)
@@ -110,6 +117,7 @@ min:datetime | max:datetime | bucket:datetime
110117

111118
tbucketByOneDayDurationAsString#[skip:-9.1.99,reason:new grouping function added in 9.2]
112119
required_capability: implicit_casting_string_literal_to_temporal_amount
120+
required_capability: tbucket
113121

114122
FROM sample_data
115123
| STATS min = MAX(@timestamp), max = MAX(@timestamp) BY bucket = TBUCKET("1 day")
@@ -121,6 +129,7 @@ min:datetime | max:datetime | bucket:datetime
121129
;
122130

123131
tbucketByOneWeekDuration#[skip:-9.1.99,reason:new grouping function added in 9.2]
132+
required_capability: tbucket
124133

125134
FROM sample_data
126135
| STATS min = MAX(@timestamp), max = MAX(@timestamp) BY bucket = TBUCKET(1 week)
@@ -133,6 +142,7 @@ min:datetime | max:datetime | bucket:datetime
133142

134143
tbucketByOneWeekDurationAsString#[skip:-9.1.99,reason:new grouping function added in 9.2]
135144
required_capability: implicit_casting_string_literal_to_temporal_amount
145+
required_capability: tbucket
136146

137147
FROM sample_data
138148
| STATS min = MAX(@timestamp), max = MAX(@timestamp) BY bucket = TBUCKET("1 week")
@@ -144,6 +154,7 @@ min:datetime | max:datetime | bucket:datetime
144154
;
145155

146156
tbucketByOneMonthDuration#[skip:-9.1.99,reason:new grouping function added in 9.2]
157+
required_capability: tbucket
147158

148159
FROM sample_data
149160
| STATS min = MAX(@timestamp), max = MAX(@timestamp) BY bucket = TBUCKET(1 month)
@@ -156,6 +167,7 @@ min:datetime | max:datetime | bucket:datetime
156167

157168
tbucketByOneMonthDurationAsString#[skip:-9.1.99,reason:new grouping function added in 9.2]
158169
required_capability: implicit_casting_string_literal_to_temporal_amount
170+
required_capability: tbucket
159171

160172
FROM sample_data
161173
| STATS min = MAX(@timestamp), max = MAX(@timestamp) BY bucket = TBUCKET("1 month")
@@ -167,6 +179,7 @@ min:datetime | max:datetime | bucket:datetime
167179
;
168180

169181
tbucketByOneYearDuration#[skip:-9.1.99,reason:new grouping function added in 9.2]
182+
required_capability: tbucket
170183

171184
FROM sample_data
172185
| STATS min = MAX(@timestamp), max = MAX(@timestamp) BY bucket = TBUCKET(1 year)
@@ -179,6 +192,7 @@ min:datetime | max:datetime | bucket:datetime
179192

180193
tbucketByOneYearDurationAsString#[skip:-9.1.99,reason:new grouping function added in 9.2]
181194
required_capability: implicit_casting_string_literal_to_temporal_amount
195+
required_capability: tbucket
182196

183197
FROM sample_data
184198
| STATS min = MAX(@timestamp), max = MAX(@timestamp) BY bucket = TBUCKET("1 year")

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,12 @@ public enum Cap {
13091309
/**
13101310
* Support correct counting of skipped shards.
13111311
*/
1312-
CORRECT_SKIPPED_SHARDS_COUNT;
1312+
CORRECT_SKIPPED_SHARDS_COUNT,
1313+
1314+
/**
1315+
* Support for tbucket function
1316+
*/
1317+
TBUCKET();
13131318

13141319
private final boolean enabled;
13151320

0 commit comments

Comments
 (0)