MaxGekk opened a new pull request #31996: URL: https://github.com/apache/spark/pull/31996
### What changes were proposed in this pull request? 1. Add the SQL config `spark.sql.ansi.intervals.enabled` which will control when Spark SQL should prefer ANSI intervals over `CalendarIntervalType`. 2. Modify the `SubtractDates` expression to return values of `DayTimeIntervalType` when `spark.sql.ansi.intervals.enabled` is set to `true`. ### Why are the changes needed? To conform to the ANSI SQL standard which requires ANSI intervals as the result of dates subtraction, see <img width="656" alt="Screenshot 2021-03-29 at 19 09 34" src="https://user-images.githubusercontent.com/1580697/112866455-7e2f0d00-90c2-11eb-96e6-3feb7eea7e09.png"> ### Does this PR introduce _any_ user-facing change? Should not since dates subtraction returns day-time interval only when `spark.sql.ansi.intervals.enabled` is true but it is false by default. ### How was this patch tested? By running new tests: ``` $ build/sbt "test:testOnly *DateExpressionsSuite" $ build/sbt "test:testOnly *ColumnExpressionSuite" ``` -- 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: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
