Skip to content

Commit f0fa476

Browse files
author
Gal (Windows)
committed
Added note on UTF-8, added comment on telemetry
1 parent ce0a6b4 commit f0fa476

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/BitLength.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public class BitLength extends UnaryScalarFunction {
4040
@FunctionInfo(
4141
returnType = "integer",
4242
description = "Returns the bit length of a string.",
43+
note = "All strings are in UTF-8, so a single character can use multiple bytes.",
4344
examples = @Example(file = "docs", tag = "bitLength")
4445
)
4546
public BitLength(

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/ByteLength.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public class ByteLength extends UnaryScalarFunction {
3737
@FunctionInfo(
3838
returnType = "integer",
3939
description = "Returns the byte length of a string.",
40+
note = "All strings are in UTF-8, so a single character can use multiple bytes.",
4041
examples = @Example(file = "eval", tag = "byteLength")
4142
)
4243
public ByteLength(

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/Length.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public class Length extends UnaryScalarFunction {
3434
@FunctionInfo(
3535
returnType = "integer",
3636
description = "Returns the character length of a string.",
37+
note = "All strings are in UTF-8, so a single character can use multiple bytes.",
3738
examples = @Example(file = "eval", tag = "length")
3839
)
3940
public Length(

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/60_usage.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ setup:
3030
- method: POST
3131
path: /_query
3232
parameters: []
33-
capabilities: [ snapshot_test_for_telemetry, fn_bit_length ]
33+
capabilities: [ snapshot_test_for_telemetry, fn_byte_length ]
3434
reason: "Test that should only be executed on snapshot versions"
3535

3636
- do: {xpack.usage: {}}
@@ -91,6 +91,7 @@ setup:
9191
- match: {esql.functions.cos: $functions_cos}
9292
- gt: {esql.functions.to_long: $functions_to_long}
9393
- match: {esql.functions.coalesce: $functions_coalesce}
94+
# Testing for the entire function set isn't feasbile, so we just check that we return the correct count as an approximation.
9495
- length: {esql.functions: 120} # check the "sister" test below for a likely update to the same esql.functions length check
9596

9697
---
@@ -101,7 +102,7 @@ setup:
101102
- method: POST
102103
path: /_query
103104
parameters: []
104-
capabilities: [ non_snapshot_test_for_telemetry, fn_bit_length ]
105+
capabilities: [ non_snapshot_test_for_telemetry, fn_byte_length ]
105106
reason: "Test that should only be executed on release versions"
106107

107108
- do: {xpack.usage: {}}

0 commit comments

Comments
 (0)