databricks-sql-cli icon indicating copy to clipboard operation
databricks-sql-cli copied to clipboard

"year 0 is out of range" error when reading `date` fields with zero value

Open mdibaiee opened this issue 2 years ago • 1 comments

I'm trying to read data from a table that has a column of type Date, as well as one of Timestamp, and if there are date or datetimes with the value 0, that is, 0000-01-01 for date, and 0000-01-01T00:00:00Z for timestamp, then the cli fails with the following error.

year 0 is out of range

I have verified that if I filter out zero values, it works:

dbsqlcli -e "SELECT id, datetime FROM my_table WHERE datetime > TIMESTAMP('0000-01-01T00:00:00Z');" 
dbsqlcli -e "SELECT id, date FROM my_table WHERE date > DATE('0000-01-01');" 

mdibaiee avatar Nov 03 '23 13:11 mdibaiee