Skip to content

Commit 004542b

Browse files
committed
ES|QL: Add PRESENT ES|QL function
Add unit tests and documentation for the PRESENT function. Part of #131069
1 parent 0ba57ea commit 004542b

File tree

12 files changed

+425
-21
lines changed

12 files changed

+425
-21
lines changed

docs/reference/query-languages/esql/_snippets/functions/description/present.md

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/_snippets/functions/examples/present.md

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/_snippets/functions/layout/present.md

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/_snippets/functions/parameters/present.md

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/_snippets/functions/types/present.md

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/functions-operators/aggregation-functions.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,6 @@ The [`STATS`](/reference/query-languages/esql/commands/stats-by.md) command supp
5656

5757
:::{include} ../_snippets/functions/layout/weighted_avg.md
5858
:::
59+
60+
:::{include} ../_snippets/functions/layout/present.md
61+
:::

docs/reference/query-languages/esql/images/functions/present.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/reference/query-languages/esql/kibana/definition/functions/present.json

Lines changed: 194 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/kibana/docs/functions/present.md

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,37 @@
11
// PRESENT-specific tests
22

3-
PRESENT
3+
PRESENT with no filter
44
required_capability: fn_present
55

6+
// tag::present[]
67
FROM employees
78
| STATS is_present = PRESENT(languages)
9+
// end::present[]
810
;
911

1012
is_present:integer
1113
1
1214
;
1315

16+
PRESENT with grouping
17+
required_capability: fn_present
18+
19+
// tag::present-by[]
20+
FROM employees
21+
| STATS is_present = PRESENT(salary) BY languages
22+
// end::present-by[]
23+
;
24+
ignoreOrder:true
25+
26+
is_present:integer | languages:integer
27+
1 | 1
28+
1 | 2
29+
1 | 3
30+
1 | 4
31+
1 | 5
32+
1 | null
33+
;
34+
1435
PRESENT with filter
1536
required_capability: fn_present
1637

@@ -57,7 +78,7 @@ is_present:integer
5778
0
5879
;
5980

60-
Not PRESENT with null evaluated field
81+
Not PRESENT with null evaluated field
6182
required_capability: fn_present
6283

6384
FROM employees
@@ -80,30 +101,14 @@ is_present:integer
80101
1
81102
;
82103

83-
PRESENT with grouping
84-
required_capability: fn_present
85-
86-
FROM employees
87-
| STATS is_present = PRESENT(salary) BY languages
88-
| SORT languages
89-
;
90-
91-
is_present:integer | languages:integer
92-
1 | 1
93-
1 | 2
94-
1 | 3
95-
1 | 4
96-
1 | 5
97-
1 | null
98-
;
99-
100104
Some fields are not PRESENT with grouping
101105
required_capability: fn_present
102106

103107
FROM employees
104108
| WHERE gender IS NULL
105109
| STATS is_present = PRESENT(gender) BY languages
106110
;
111+
ignoreOrder:true
107112

108113
is_present:integer | languages:integer
109114
0 | 4

0 commit comments

Comments
 (0)