[FEA][JSON] Support parsing single numbers in strings as dates in from_json
#9664
Labels
feature request
New feature or request
from_json
#9664
Is your feature request related to a problem? Please describe.
This is an edge case that I ran into when working on date support in
from_json
.When parsing a four-digit number as a date using the default
dateFormat
ofyyyy-MM-dd
, it gets parsed as the first day of that year. For example,1980
becomes1980-01-01
. However, different logic is used for five-digit numbers, which are interpreted as the number of days since1970-01-01
, as shown in the following example (using Spark 3.1.1).Describe the solution you'd like
Ideally, we should match Spark's behavior, even though it is confusing.
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: