spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [spark] MaxGekk opened a new pull request #25708: [SPARK-28141][SQL] Support special date values
Date Fri, 06 Sep 2019 08:46:44 GMT
MaxGekk opened a new pull request #25708: [SPARK-28141][SQL] Support special date values
   ### What changes were proposed in this pull request?
   Supported special string values for `DATE` type. They are simply notational shorthands
that will be converted to ordinary date values when read. The following string values are
   - `epoch` - `1970-01-01`
   - `now` - the date of running the current query
   - `today` - the current date. The same as `now`.
   - `yesterday` - the current date -1
   - `tomorrow` - the current date + 1
   For example:
   spark-sql> SELECT date 'tomorrow' - date 'yesterday';
   ### Why are the changes needed?
   To maintain feature parity with PostgreSQL, see [ Special Values](
   ### Does this PR introduce any user-facing change?
   Previously, the parser fails on the special values with the error:
   spark-sql> select date 'today';
   Error in query: 
   Cannot parse the DATE value: today(line 1, pos 7)
   After the changes, the special values are converted to appropriate dates:
   spark-sql> select date 'today';
   ### How was this patch tested?
   - Added tests to `DateFormatterSuite` to check parsing special values from regular strings.
   - Tests in `DateTimeUtilsSuite` check parsing those values from `UTF8String`
   - Uncommented tests in `date.sql`

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message