Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/changelog/136441.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 136441
summary: Add TRANGE ES|QL function
area: ES|QL
type: enhancement
issues:
- 135599

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.time.Clock;
import java.time.Duration;
import java.time.Period;
import java.util.ArrayList;
Expand Down Expand Up @@ -477,6 +478,22 @@ private static ThreadPool createMockThreadPool() {
private EsqlTestUtils() {}

public static Configuration configuration(QueryPragmas pragmas, String query) {
return configuration(pragmas, query, null);
}

public static Configuration configuration(QueryPragmas pragmas) {
return configuration(pragmas, StringUtils.EMPTY);
}

public static Configuration configuration(String query) {
return configuration(new QueryPragmas(Settings.EMPTY), query);
}

public static Configuration configuration(Clock clock) {
return configuration(new QueryPragmas(Settings.EMPTY), StringUtils.EMPTY, clock);
}

public static Configuration configuration(QueryPragmas pragmas, String query, Clock clock) {
return new Configuration(
DateUtils.UTC,
Locale.US,
Expand All @@ -491,18 +508,11 @@ public static Configuration configuration(QueryPragmas pragmas, String query) {
System.nanoTime(),
false,
EsqlPlugin.QUERY_TIMESERIES_RESULT_TRUNCATION_MAX_SIZE.getDefault(Settings.EMPTY),
EsqlPlugin.QUERY_TIMESERIES_RESULT_TRUNCATION_DEFAULT_SIZE.getDefault(Settings.EMPTY)
EsqlPlugin.QUERY_TIMESERIES_RESULT_TRUNCATION_DEFAULT_SIZE.getDefault(Settings.EMPTY),
clock
);
}

public static Configuration configuration(QueryPragmas pragmas) {
return configuration(pragmas, StringUtils.EMPTY);
}

public static Configuration configuration(String query) {
return configuration(new QueryPragmas(Settings.EMPTY), query);
}

public static EsqlQueryClusterSettings queryClusterSettings() {
return new EsqlQueryClusterSettings(
EsqlPlugin.QUERY_RESULT_TRUNCATION_MAX_SIZE.getDefault(Settings.EMPTY),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,23 @@ events_received:integer | pod:keyword | time_bucket:datetime
0 | two | 2024-05-10T00:20:00.000Z
0 | two | 2024-05-10T00:22:00.000Z
;

trange_absolute_epoch_millis_with_aggregations
required_capability: ts_command_v0
required_capability: fn_trange

TS k8s
| WHERE TRANGE("2024-05-10T00:20:00.000Z", "2024-05-10T00:25:00.000Z")
| STATS events_received = max(absent_over_time(events_received)) BY pod, time_bucket = tbucket(1 minute)
| SORT time_bucket
| LIMIT 5
;
ignoreOrder:true

events_received:boolean | pod:keyword | time_bucket:datetime
false | one | 2024-05-10T00:20:00.000Z
false | three | 2024-05-10T00:20:00.000Z
false | three | 2024-05-10T00:21:00.000Z
false | two | 2024-05-10T00:20:00.000Z
true | one | 2024-05-10T00:21:00.000Z
;
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,26 @@ rate_bytes_in:double | cluster:keyword | region:keyword | time_bucket:datetime
5.4539153439153445 | prod | [eu, us] | 2024-05-10T00:00:00.000Z
5.241187469367376 | staging | us | 2024-05-10T00:00:00.000Z
;

trange_absolute_with_rate
required_capability: ts_command_v0
required_capability: fn_trange

TS k8s
| WHERE TRANGE("2024-05-10T00:15:00.000Z", "2024-05-10T00:25:00.000Z")
| STATS rate_bytes_in=avg(rate(network.total_bytes_in)) BY cluster, time_bucket = tbucket(2minute)
| SORT rate_bytes_in NULLS FIRST, time_bucket, cluster
| LIMIT 10;

rate_bytes_in:double | cluster:keyword | time_bucket:datetime
null | prod | 2024-05-10T00:14:00.000Z
null | staging | 2024-05-10T00:14:00.000Z
null | qa | 2024-05-10T00:22:00.000Z
0.0371323529411787 | staging | 2024-05-10T00:22:00.000Z
2.27097222222222 | qa | 2024-05-10T00:20:00.000Z
5.374305555555554 | staging | 2024-05-10T00:16:00.000Z
7.513221153846155 | staging | 2024-05-10T00:20:00.000Z
9.45 | prod | 2024-05-10T00:20:00.000Z
9.83125 | prod | 2024-05-10T00:22:00.000Z
10.525 | staging | 2024-05-10T00:18:00.000Z
;
Loading
Loading