Skip to content

Commit 8ab6751

Browse files
authored
ESQL: Replace "representable" type error messages (elastic#131775)
Continuation of elastic#131694 (Issue: elastic#112006) - Moved more messages from "representable" to "any type but counter types". - Added missing docs on Count - Added unsigned long and missing docs on Sample and Values - Fixed Sample throwing error 500 on non-representable types
1 parent 6bf55e4 commit 8ab6751

File tree

35 files changed

+323
-72
lines changed

35 files changed

+323
-72
lines changed

docs/changelog/131775.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 131775
2+
summary: Replace "representable" type error messages
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

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

Lines changed: 3 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/count_over_time.md

Lines changed: 3 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/sample.md

Lines changed: 1 addition & 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/values.md

Lines changed: 1 addition & 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/definition/functions/count.json

Lines changed: 36 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/definition/functions/count_over_time.json

Lines changed: 36 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/definition/functions/sample.json

Lines changed: 18 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/definition/functions/values.json

Lines changed: 12 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-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/TypeResolutions.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import static org.elasticsearch.xpack.esql.core.type.DataType.DATETIME;
2323
import static org.elasticsearch.xpack.esql.core.type.DataType.IP;
2424
import static org.elasticsearch.xpack.esql.core.type.DataType.NULL;
25+
import static org.elasticsearch.xpack.esql.core.type.DataType.isSpatial;
2526

2627
public final class TypeResolutions {
2728

@@ -71,6 +72,23 @@ public static TypeResolution isDate(Expression e, String operationName, ParamOrd
7172
return isType(e, dt -> dt == DATETIME, operationName, paramOrd, "datetime");
7273
}
7374

75+
/**
76+
* @see DataType#isRepresentable(DataType)
77+
*/
78+
public static TypeResolution isRepresentableExceptCounters(Expression e, String operationName, ParamOrdinal paramOrd) {
79+
return isType(e, DataType::isRepresentable, operationName, paramOrd, "any type except counter types");
80+
}
81+
82+
public static TypeResolution isRepresentableExceptCountersAndSpatial(Expression e, String operationName, ParamOrdinal paramOrd) {
83+
return isType(
84+
e,
85+
(t) -> isSpatial(t) == false && DataType.isRepresentable(t),
86+
operationName,
87+
paramOrd,
88+
"any type except counter and spatial types"
89+
);
90+
}
91+
7492
public static TypeResolution isExact(Expression e, String message) {
7593
if (e instanceof FieldAttribute fa) {
7694
EsField.Exact exact = fa.getExactInfo();

0 commit comments

Comments
 (0)