Description
(on CSV spec dataset)
This query returns a correct validation exception
from airport* | stats foo = count_distinct(city_boundary) by type
"type": "verification_exception",
"reason": "Found 1 problem\nline 1:31: argument of [count_distinct(city_boundary)] must be [any exact type except unsigned_long, _source, or counter types], found value [city_boundary] type [geo_shape]"
Adding a FORK, the validation process apparently fails to spot the problem; the result is an esql_illegal_argument_exception
(error 500)
from airport*
| FORK ( WHERE true ) ( WHERE true )
| WHERE _fork == \"fork0\"
| DROP _fork
| stats foo = count_distinct(city_boundary) by type
{
"error": {
"root_cause": [
{
"type": "esql_illegal_argument_exception",
"reason": "illegal data type [geo_shape]"
}
],
"type": "esql_illegal_argument_exception",
"reason": "illegal data type [geo_shape]"
},
"status": 500
}
Relevant stack trace:
ESQL request failed with status [INTERNAL_SERVER_ERROR]: org.elasticsearch.xpack.esql.EsqlIllegalArgumentException: illegal data type [geo_shape]
at org.elasticsearch.xpack.esql.EsqlIllegalArgumentException.illegalDataType(EsqlIllegalArgumentException.java:43)
at org.elasticsearch.xpack.esql.EsqlIllegalArgumentException.illegalDataType(EsqlIllegalArgumentException.java:39)
at org.elasticsearch.xpack.esql.expression.function.aggregate.CountDistinct.supplier(CountDistinct.java:218)
at org.elasticsearch.xpack.esql.planner.AggregateMapper.entryForAgg(AggregateMapper.java:79)
at org.elasticsearch.xpack.esql.planner.AggregateMapper.computeEntryForAgg(AggregateMapper.java:67)
at org.elasticsearch.xpack.esql.planner.AggregateMapper.lambda$map$2(AggregateMapper.java:62)
at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1228)
at org.elasticsearch.xpack.esql.planner.AggregateMapper.map(AggregateMapper.java:62)
at org.elasticsearch.xpack.esql.planner.AggregateMapper.lambda$doMapping$0(AggregateMapper.java:53)
at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)