Skip to content

Commit 1f4ec7a

Browse files
committed
Add new capability for function SPACE.
1 parent 91f62b9 commit 1f4ec7a

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,6 +1596,7 @@ emp_no:integer | languages:integer | first_name:keyword
15961596
;
15971597

15981598
space
1599+
required_capability: space
15991600
// tag::space[]
16001601
ROW message = CONCAT("Hello", SPACE(1), "World!");
16011602
// end::space[]
@@ -1607,13 +1608,15 @@ Hello World!
16071608
;
16081609

16091610
spaceLength
1611+
required_capability: space
16101612
ROW len = LENGTH(SPACE(12));
16111613

16121614
len:integer
16131615
12
16141616
;
16151617

16161618
spaceCalculated
1619+
required_capability: space
16171620
ROW inner_width = 20, title = "Title"
16181621
| EVAL lspace = SPACE((inner_width-LENGTH(title))/2),
16191622
rspace = SPACE(inner_width-LENGTH(lspace)-LENGTH(title)),
@@ -1625,20 +1628,23 @@ inner_width:integer | centered_title:keyword
16251628
;
16261629

16271630
spaceZero
1631+
required_capability: space
16281632
ROW s = SPACE(0);
16291633

16301634
s:keyword
16311635
""
16321636
;
16331637

16341638
spaceNull
1639+
required_capability: space
16351640
ROW s = SPACE(null);
16361641

16371642
s:keyword
16381643
null
16391644
;
16401645

16411646
spaceNegative
1647+
required_capability: space
16421648
FROM employees | SORT emp_no | LIMIT 1 | EVAL s = SPACE(-LENGTH(first_name)) | KEEP s;
16431649

16441650
warning:Line 1:51: evaluation of [SPACE(-LENGTH(first_name))] failed, treating result as null. Only first 20 failures recorded.

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
@@ -269,7 +269,12 @@ public enum Cap {
269269
/**
270270
* Allow mixed numeric types in coalesce
271271
*/
272-
MIXED_NUMERIC_TYPES_IN_COALESCE;
272+
MIXED_NUMERIC_TYPES_IN_COALESCE,
273+
274+
/**
275+
* Support for requesting the "SPACE" function.
276+
*/
277+
SPACE;
273278

274279
private final boolean snapshotOnly;
275280
private final FeatureFlag featureFlag;

0 commit comments

Comments
 (0)