1. [SPARK-26618][SQL] Make typed Timestamp/Date literals consistent to (details)
Commit 34db5f565271ad9d9d5134a4e914c10f1677a38a by hvanhovell
[SPARK-26618][SQL] Make typed Timestamp/Date literals consistent to
## What changes were proposed in this pull request?
In the PR, I propose to make creation of typed Literals `TIMESTAMP` and
`DATE` consistent to the `Cast` expression. More precisely, reusing the
`Cast` expression in the type constructors. In this way, it allows:
- To use the same calendar in parsing methods
- To support the same set of timestamp/date patterns
For example, creating timestamp literal:
```sql SELECT TIMESTAMP '2019-01-14 20:54:00.000'
``` behaves similarly as casting the string literal:
```sql SELECT CAST('2019-01-14 20:54:00.000' AS TIMESTAMP)
## How was this patch tested?
This was tested by `SQLQueryTestSuite` as well as
Closes #23541 from MaxGekk/timestamp-date-constructors.
Lead-authored-by: Maxim Gekk <> Co-authored-by:
Maxim Gekk <> Signed-off-by: Herman van Hovell
The file was modifiedsql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/ExpressionParserSuite.scala (diff)
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala (diff)
The file was modifiedsql/core/src/test/resources/sql-tests/results/literals.sql.out (diff)