ESQL: Ensure data types in field attributes are always widened #112691
Labels
:Analytics/ES|QL
AKA ESQL
Team:Analytics
Meta label for analytical engine team (ESQL/Aggs/Geo)
>tech debt
#112610 needs to address multiple places where "raw" Elasticsearch data types somehow proliferate into the planner/optimizer; this led to bugs because ESQL only cares about a subset of data types that actually occur within the compute engine. Small numeric types like
short
andfloat
are widened into compute engine's types, likeinteger
resp.double
.For the longest time, this was okay because there was only 1 place where we dealt with this difference: while processing an index' mapping, we decide if a type is supported, and if it needs widening, and stuff it into a FieldAttribute. This means, we had an implicit invariant: data types inside FieldAttributes are always widened, resp. FieldAttributes' types are always types supported by the compute engine.
Let's enforce this invariant, at least via asserts, and let's make sure that type widening happens in as few places as possible. (We could also separate compute engine types from ES types and have FieldAttributes use the former, but that probably has a much wider blast radius that's not worth it.)
The text was updated successfully, but these errors were encountered: