GitHub user hvanhovell opened a pull request: https://github.com/apache/spark/pull/21005
[SPARK-23898][SQL] Simplify add & subtract code generation ## What changes were proposed in this pull request? Code generation for the `Add` and `Subtract` expressions was not done using the `BinaryArithmetic.doCodeGen` method because these expressions also support `CalendarInterval`. This leads to a bit of duplication. This PR gets rid of that duplication by adding `calendarIntervalMethod` to `BinaryArithmetic` and doing the code generation for `CalendarInterval` in `BinaryArithmetic` instead. ## How was this patch tested? Existing tests. You can merge this pull request into a Git repository by running: $ git pull https://github.com/hvanhovell/spark SPARK-23898 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/21005.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #21005 ---- commit 15c13e356606b936f9755a3e8b1d203f06ffd01a Author: Herman van Hovell <hvanhovell@...> Date: 2018-04-08T19:34:58Z Simplify add & subtract code generation by centralizing code generation for calendar intervals. ---- --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org