Type Coercion Gaps in Distributed SQL Engines: A Case Study of VARCHAR-to-INTERVAL Casting in Trino
Distributed SQL query engines expose large, federated type systems that grow incrementally over years. This makes it easy for individual coercions in the type lattice to go unimplemented long after the surrounding system has matured. This paper documents a concrete instance in Trino: the absence of CAST(VARCHAR AS INTERVAL DAY TO SECOND), a gap first reported by a Trino project founder in 2020 and left unresolved for six years despite the reverse operation (parsing INTERVAL literals) being present and battle-tested since the engine's earliest releases. We describe the gap, its practical impact on data pipelines that move interval values through text-based interchange formats, the design and implementation of a fix that reuses Trino's existing literal parser rather than introducing a parallel one, and a correctness lesson surfaced by continuous integration during that work. We distill three practical guidelines for engineers extending the type systems of mature distributed query engines. The implementation is available as a public pull request against the Trino project (github.com/trinodb/trino/pull/30737), addressing issue #4697.
Authors
- Haseeb Mohammed Afsar (ORCID: https://orcid.org/0009-0000-4038-1272)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-08-17
- DOI
- https://doi.org/10.5281/zenodo.21973272
- Primary Topic
- Advanced Database Systems and Queries
- Type
- preprint