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

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
```esql
FROM employees
| KEEP emp_no, salary
| INLINESTATS avg_lt_50 = ROUND(AVG(salary)) WHERE salary < 50000,
avg_lt_60 = ROUND(AVG(salary)) WHERE salary >=50000 AND salary < 60000,
avg_gt_60 = ROUND(AVG(salary)) WHERE salary >= 60000
| INLINE STATS avg_lt_50 = ROUND(AVG(salary)) WHERE salary < 50000,
avg_lt_60 = ROUND(AVG(salary)) WHERE salary >=50000 AND salary < 60000,
avg_gt_60 = ROUND(AVG(salary)) WHERE salary >= 60000
```

| emp_no:integer | salary:integer | avg_lt_50:double | avg_lt_60:double | avg_gt_60:double |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
```esql
FROM employees
| KEEP emp_no, languages, salary
| INLINESTATS max_salary = MAX(salary)
| INLINE STATS max_salary = MAX(salary)
```

| emp_no:integer | languages:integer | salary:integer | max_salary:integer |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
```esql
FROM employees
| KEEP emp_no, languages, salary
| INLINESTATS max_salary = MAX(salary) BY languages
| INLINE STATS max_salary = MAX(salary) BY languages
```

| emp_no:integer | salary:integer | max_salary:integer | languages:integer |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FROM employees
| KEEP emp_no, languages, salary, hire_date
| EVAL tenure = DATE_DIFF("year", hire_date, now())
| DROP hire_date
| INLINESTATS avg_salary = AVG(salary), count = count(*) BY languages, tenure
| INLINE STATS avg_salary = AVG(salary), count = count(*) BY languages, tenure
```

| emp_no:integer | salary:integer | avg_salary:double | count:long | languages:integer | tenure:integer |
Expand Down

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 @@ -51,9 +51,8 @@
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.ENABLE_FORK_FOR_REMOTE_INDICES;
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.ENABLE_LOOKUP_JOIN_ON_REMOTE;
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.FORK_V9;
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.INLINESTATS;
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.INLINESTATS_SUPPORTS_REMOTE;
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.INLINESTATS_V11;
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.INLINE_STATS;
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.INLINE_STATS_SUPPORTS_REMOTE;
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.JOIN_LOOKUP_V12;
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.JOIN_PLANNING_V1;
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.METADATA_FIELDS_REMOTE_TEST;
Expand Down Expand Up @@ -140,16 +139,15 @@ protected void shouldSkipTest(String testName) throws IOException {
assumeFalse("can't test with _index metadata", (remoteMetadata == false) && hasIndexMetadata(testCase.query));
Version oldVersion = Version.min(Clusters.localClusterVersion(), Clusters.remoteClusterVersion());
assumeTrue("Test " + testName + " is skipped on " + oldVersion, isEnabled(testName, instructions, oldVersion));
if (testCase.requiredCapabilities.contains(INLINESTATS.capabilityName())
|| testCase.requiredCapabilities.contains(INLINESTATS_V11.capabilityName())
if (testCase.requiredCapabilities.contains(INLINE_STATS.capabilityName())
|| testCase.requiredCapabilities.contains(JOIN_PLANNING_V1.capabilityName())) {
assumeTrue(
"INLINESTATS in CCS not supported for this version",
hasCapabilities(adminClient(), List.of(INLINESTATS_SUPPORTS_REMOTE.capabilityName()))
"INLINE STATS in CCS not supported for this version",
hasCapabilities(adminClient(), List.of(INLINE_STATS_SUPPORTS_REMOTE.capabilityName()))
);
assumeTrue(
"INLINESTATS in CCS not supported for this version",
hasCapabilities(remoteClusterClient(), List.of(INLINESTATS_SUPPORTS_REMOTE.capabilityName()))
"INLINE STATS in CCS not supported for this version",
hasCapabilities(remoteClusterClient(), List.of(INLINE_STATS_SUPPORTS_REMOTE.capabilityName()))
);
}
if (testCase.requiredCapabilities.contains(JOIN_LOOKUP_V12.capabilityName())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,10 @@ public void assertDriverData(Map<String, Object> driverMetadata, Map<String, Obj

@AwaitsFix(bugUrl = "disabled until JOIN infrastructrure properly lands")
public void testInlineStatsProfile() throws IOException {
assumeTrue("INLINESTATS only available on snapshots", Build.current().isSnapshot());
assumeTrue("INLINE STATS only available on snapshots", Build.current().isSnapshot());
indexTimestampData(1);

RequestObjectBuilder builder = requestObjectBuilder().query(fromIndex() + " | INLINESTATS AVG(value) | SORT value ASC");
RequestObjectBuilder builder = requestObjectBuilder().query(fromIndex() + " | INLINE STATS AVG(value) | SORT value ASC");
builder.profile(true);
if (Build.current().isSnapshot()) {
// Lock to shard level partitioning, so we get consistent profile output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@ public void testComplexFieldNames() throws IOException {
}

/**
* INLINESTATS <strong>can</strong> group on {@code NOW()}. It's a little silly, but
* INLINE STATS <strong>can</strong> group on {@code NOW()}. It's a little silly, but
* doing something like {@code DATE_TRUNC(1 YEAR, NOW() - 1970-01-01T00:00:00Z)} is
* much more sensible. But just grouping on {@code NOW()} is enough to test this.
* <p>
Expand All @@ -1221,11 +1221,11 @@ public void testComplexFieldNames() throws IOException {
* </p>
*/
public void testInlineStatsNow() throws IOException {
assumeTrue("INLINESTATS only available on snapshots", Build.current().isSnapshot());
assumeTrue("INLINE STATS only available on snapshots", Build.current().isSnapshot());
indexTimestampData(1);

RequestObjectBuilder builder = requestObjectBuilder().query(
fromIndex() + " | EVAL now=NOW() | INLINESTATS AVG(value) BY now | SORT value ASC"
fromIndex() + " | EVAL now=NOW() | INLINE STATS AVG(value) BY now | SORT value ASC"
);
Map<String, Object> result = runEsql(builder);
ListMatcher values = matchesList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -688,15 +688,16 @@ emp_no:integer | job_positions:keyword | _fork:keyword
10087 | Junior Developer | fork2
;

// INLINESTATS is under development, we enable this once it will be available
// INLINE STATS is under development, we enable this once it will be available
forkBeforeInlineStats-Ignore
required_capability: fork_v9
required_capability: inline_stats

FROM employees
| KEEP emp_no, languages, gender
| FORK (WHERE emp_no == 10048 OR emp_no == 10081)
(WHERE emp_no == 10081 OR emp_no == 10087)
| INLINESTATS max_lang = MAX(languages) BY gender
| INLINE STATS max_lang = MAX(languages) BY gender
| SORT emp_no, gender, _fork
| LIMIT 5
;
Expand All @@ -705,16 +706,17 @@ emp_no:integer | languages:integer | _fork:keyword | max_lang:integer | gender:k
1 | 2 | 3 | 4 | 5
;

// INLINESTATS is under development, we enable this once it will be available
// INLINE STATS is under development, we enable this once it will be available
forkBranchWithInlineStats-Ignore
required_capability: fork_v9
required_capability: inline_stats

FROM employees
| KEEP emp_no, languages, gender
| FORK (WHERE emp_no == 10048 OR emp_no == 10081
| INLINESTATS x = MAX(languages) BY gender)
| INLINE STATS x = MAX(languages) BY gender)
(WHERE emp_no == 10081 OR emp_no == 10087
| INLINESTATS x = MIN(languages))
| INLINE STATS x = MIN(languages))
(WHERE emp_no == 10012 OR emp_no == 10012)
| SORT emp_no, gender, _fork
;
Expand All @@ -727,13 +729,14 @@ emp_no:integer | languages:integer | x:integer | gender:keyword | _fork:keyword
10087 | 5 | 2 | F | fork2
;

// INLINESTATS is under development, we enable this once it will be available
// INLINE STATS is under development, we enable this once it will be available
forkAfterInlineStats-Ignore
required_capability: fork_v9
required_capability: inline_stats

FROM employees
| KEEP emp_no, languages, gender
| INLINESTATS max_lang = MAX(languages) BY gender
| INLINE STATS max_lang = MAX(languages) BY gender
| FORK (WHERE emp_no == 10048 OR emp_no == 10081)
(WHERE emp_no == 10081 OR emp_no == 10087)
| SORT emp_no, gender, _fork
Expand Down
Loading