Open planesweep opened 3 years ago
Unfortunately the problem is deeper. Current implementation of Date, Datetime and Timestamp types in database core supports limited range of dates starting from 1.1.1970. It's not normal to my opinion and must be changed in some way.
Unfortunately the problem is deeper. Current implementation of Date, Datetime and Timestamp types in database core supports limited range of dates starting from 1.1.1970. It's not normal to my opinion and must be changed in some way.
@fomichev3000: What do you think, when can you fix this - eta? I would highly appreciate a fix because our data model uses dates for several reasons.
@fomichev3000: What do you think, when can you fix this - eta? I would highly appreciate a fix because our data model uses dates for several reasons. We need to add new functionality -- new datatypes. Then release it a new major version. So 4+ months at least. The problem is very deep, we need to add new datatypes and migrate old ones.
In the meantime, until new datatypes are available, a workaround could be to use the Int32 datatype instead, encoding the date as YYYYMMDD. That will work for all comparisons, and allow almost arbitrary date values - including the B.C. values, with negative numbers.
For sure this workaround has some drawbacks, like complicated date component extraction (like getting the week number and performing the week day alignment), and the large subset of unchecked incorrect values (like 20221597, being a valid Int32, does not represent a valid date).
Problem
The ydb-java-sdk does not allow to store a date, datetime or timestamp before 1.1.1970. In my opinion this does NOT make any sense. How do you suppose to store a birthdate before 1.1.1970.
How to reproduce
Store a birthdate before 1.1.1970 -> save birthdate 1.1.1930
Finally you get this exception
Issue (weird restriction of negative days since Epoch)
Please check PrimitiveValue.java https://github.com/yandex-cloud/ydb-java-sdk/blob/master/table/src/main/java/com/yandex/ydb/table/values/PrimitiveValue.java
All dates are finally converted into a long but a negative long is not allowed, why? Linux and Java can handle date before the epoch.