trinodb / trino

Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
https://trino.io
Apache License 2.0
10.36k stars 2.98k forks source link

Remove type-only coercions #8111

Open martint opened 3 years ago

martint commented 3 years ago

It's not clear that the notion of type-only coercions provides much benefit, and it carries a big burden in the planner and optimizer. We should consider and evaluate removing that concept from the planner.

The implementation of a type-only coercion is typically an identity function, which the JIT compiler should be able to inline and eliminate. The only cases where they might matter are for complex types (array, row), which have to do an element-wise cast and reconstruct a row/array. (Note that support for type-only row casts was only added recently, so it hasn't benefited that type until only recently)

If we determine it's a meaningful optimization for structural types, we can move the check to the code generation layer.

sopel39 commented 3 years ago

I guess such change should be benchmarked.