-
Notifications
You must be signed in to change notification settings - Fork 28.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-37714][SQL] ANSI mode: allow casting between numeric type and …
…timestamp type ### What changes were proposed in this pull request? * Allow casting between numeric type and timestamp type under ANSI mode * Remove the user-facing configuration `spark.sql.ansi.allowCastBetweenDatetimeAndNumeric` ### Why are the changes needed? Same reason as mentioned in #34459. It is for better adoption of ANSI SQL mode since users are relying on it: - As we did some data science, we found that many Spark SQL users are actually using `Cast(Timestamp as Numeric)` and `Cast(Numeric as Timestamp)`. - The Spark SQL connector for Tableau is using this feature for DateTime math. e.g. `CAST(FROM_UNIXTIME(CAST(CAST(%1 AS BIGINT) + (%2 * 86400) AS BIGINT)) AS TIMESTAMP)` ### Does this PR introduce _any_ user-facing change? Yes, casting between numeric type and timestamp type is allowed by default under ANSI SQL mode ### How was this patch tested? Unit tests. Here is the screenshot of the document change: ![image](https://user-images.githubusercontent.com/1097932/147194455-b86847f7-59ea-4d29-97ea-9615ec3a758e.png) Closes #34985 from gengliangwang/changeSubConf. Authored-by: Gengliang Wang <gengliang@apache.org> Signed-off-by: Gengliang Wang <gengliang@apache.org>
- Loading branch information
1 parent
e76ae9a
commit 198b90c
Showing
6 changed files
with
67 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters