MaxGekk opened a new pull request #35826:
URL: https://github.com/apache/spark/pull/35826
### What changes were proposed in this pull request?
In the PR, I propose to add new enum `datetimeUnit` and re-use it in the
datetime "function"s `TIMESTAMPADD` (see SPARK-38195) and `TIMESTAMPDIFF` (see
SPARK-38284):
SqlBaseParser.g4:
```
datetimeUnit
: YEAR | QUARTER | MONTH
| WEEK | DAY | DAYOFYEAR
| HOUR | MINUTE | SECOND | MILLISECOND | MICROSECOND
;
```
### Why are the changes needed?
1. The enum will allow to document the list of supported units in the
grammar which should improve user experience with Spark SQL.
2. Switching to unified parse error should improve UX too.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
By running test suites for `TIMESTAMPADD`/`TIMESTAMPDIFF`:
```
$ build/sbt "test:testOnly *SQLKeywordSuite"
$ build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite -- -z
timestamp.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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]