Skip to content

cast(timestamp): Velox throws for timestamp out of range while Presto outputs #12803

Open
@peterenescu

Description

@peterenescu

Description

Casting from timestamp to string will fail in Velox if timestamp is out Velox's accepted range. Presto will convert nonetheless.

Error Reproduction

Velox fails

presto:di> SELECT cast(from_unixtime(c0) as varchar) from (values (infinity())) t(c0);
Query 20250325_175521_00007_yjj2i failed:  Timepoint is outside of supported year range: [-32767, 32767], got -1701532 Top-level Expression: cast((presto.default.from_unixtime(field)) as VARCHAR). Input data: /tmp/velox_vector_cFVPJI. SQL expression: /tmp/velox_sql_wMzcem. All SQL expressions: /tmp/velox_allExprSql_ys4eSo.  Operator: FilterProject[4] 1

while Presto succeeds:

presto> SELECT cast(from_unixtime(c0) as varchar) from (values (infinity())) t(c0);
            _col0             
------------------------------
 292278994-08-17 00:12:55.807 
(1 row)

Query 20250325_175522_00004_zrrnp, FINISHED, 1 node
Splits: 17 total, 17 done (100.00%)
[Latency: client-side: 0:01, server-side: 0:01] [0 rows, 0B] [0 rows/s, 0B/s]

Additional Notes

Both Velox and Presto output from_unixtime for infinity with the same output

presto:di> select from_unixtime(c0) from (values (infinity())) t(c0);
             _col0             
-------------------------------
 +292278994-08-17 00:12:55.807 

The only complication is when we convert to varchar. This is quite particular and we likely need to look into why cast will throw under these conditions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfuzzerIssues related the to Velox fuzzer test components.fuzzer-found

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions