This is an automated email from the ASF dual-hosted git repository.

wenchen pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new e415a42  [SPARK-31439][SQL] Fix perf regression of fromJavaDate
e415a42 is described below

commit e415a428bba8da40fe79523a8ad1be44d4e50d82
Author: Max Gekk <[email protected]>
AuthorDate: Tue Apr 14 14:44:00 2020 +0000

    [SPARK-31439][SQL] Fix perf regression of fromJavaDate
    
    ### What changes were proposed in this pull request?
    In the PR, I propose to re-use optimized implementation of days rebase 
function `rebaseJulianToGregorianDays()` introduced by the PR #28067 in 
conversion of `java.sql.Date` values to Catalyst's `DATE` values. The function 
`fromJavaDate` in `DateTimeUtils` was re-written by taking the implementation 
from Spark 2.4, and by rebasing the final results via 
`rebaseJulianToGregorianDays()`.
    
    Also I updated `DateTimeBenchmark`, and added a benchmark for conversion 
from `java.sql.Date`.
    
    ### Why are the changes needed?
    The PR fixes the regression of parallelizing a collection of 
`java.sql.Date` values, and improves performance of converting external values 
to Catalyst's `DATE` values:
    - x4 on the master branch
    - 30% against Spark 2.4.6-SNAPSHOT
    
    Spark 2.4.6-SNAPSHOT:
    ```
    To/from java.sql.Timestamp:               Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
    
------------------------------------------------------------------------------------------------------------------------
    From java.sql.Date                                  614            655      
    43          8.1         122.8       1.0X
    ```
    
    Before the changes:
    ```
    To/from java.sql.Timestamp:               Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
    
------------------------------------------------------------------------------------------------------------------------
    From java.sql.Date                                 1154           1206      
    46          4.3         230.9       1.0X
    ```
    
    After:
    ```
    To/from java.sql.Timestamp:               Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
    
------------------------------------------------------------------------------------------------------------------------
    From java.sql.Date                                  427            434      
     7         11.7          85.3       1.0X
    ```
    
    ### Does this PR introduce any user-facing change?
    No
    
    ### How was this patch tested?
    - By existing tests suites, in particular, `DateTimeUtilsSuite`, 
`RebaseDateTimeSuite`, `DateFunctionsSuite`, `DateExpressionsSuite`.
    - Re-run `DateTimeBenchmark` in the environment:
    
    | Item | Description |
    | ---- | ----|
    | Region | us-west-2 (Oregon) |
    | Instance | r3.xlarge |
    | AMI | ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-20190722.1 
(ami-06f2f779464715dc5) |
    | Java | OpenJDK 64-Bit Server VM 1.8.0_242 and OpenJDK 64-Bit Server VM 
11.0.6+10 |
    
    Closes #28205 from MaxGekk/optimize-fromJavaDate.
    
    Authored-by: Max Gekk <[email protected]>
    Signed-off-by: Wenchen Fan <[email protected]>
    (cherry picked from commit 2c5d489679ba3814973680d65853877664bcd931)
    Signed-off-by: Wenchen Fan <[email protected]>
---
 .../spark/sql/catalyst/util/DateTimeUtils.scala    |  14 +-
 .../benchmarks/DateTimeBenchmark-jdk11-results.txt | 221 +++++++++++----------
 sql/core/benchmarks/DateTimeBenchmark-results.txt  | 221 +++++++++++----------
 .../execution/benchmark/DateTimeBenchmark.scala    |   7 +-
 4 files changed, 232 insertions(+), 231 deletions(-)

diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
index 88ffd48..dede92f 100644
--- 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
+++ 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
@@ -103,16 +103,10 @@ object DateTimeUtils {
    * @return The number of days since epoch from java.sql.Date.
    */
   def fromJavaDate(date: Date): SQLDate = {
-    val era = if (date.before(julianCommonEraStart)) 0 else 1
-    val localDate = LocalDate
-      .of(date.getYear + 1900, date.getMonth + 1, 1)
-      .`with`(ChronoField.ERA, era)
-      // Add days separately to convert dates existed in Julian calendar but 
not
-      // in Proleptic Gregorian calendar. For example, 1000-02-29 is valid date
-      // in Julian calendar because 1000 is a leap year but 1000 is not a leap
-      // year in Proleptic Gregorian calendar. And 1000-02-29 doesn't exist in 
it.
-      .plusDays(date.getDate - 1) // Returns the next valid date after 
`date.getDate - 1` days
-    localDateToDays(localDate)
+    val millisUtc = date.getTime
+    val millisLocal = millisUtc + TimeZone.getDefault.getOffset(millisUtc)
+    val julianDays = Math.toIntExact(Math.floorDiv(millisLocal, 
MILLIS_PER_DAY))
+    rebaseJulianToGregorianDays(julianDays)
   }
 
   /**
diff --git a/sql/core/benchmarks/DateTimeBenchmark-jdk11-results.txt 
b/sql/core/benchmarks/DateTimeBenchmark-jdk11-results.txt
index 27917c2..1323a01 100644
--- a/sql/core/benchmarks/DateTimeBenchmark-jdk11-results.txt
+++ b/sql/core/benchmarks/DateTimeBenchmark-jdk11-results.txt
@@ -6,92 +6,92 @@ OpenJDK 64-Bit Server VM 
11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 4.15.0-1
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 cast to timestamp:                        Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-cast to timestamp wholestage off                    447            486         
 54         22.4          44.7       1.0X
-cast to timestamp wholestage on                     364            381         
 14         27.5          36.4       1.2X
+cast to timestamp wholestage off                    440            459         
 28         22.7          44.0       1.0X
+cast to timestamp wholestage on                     384            407         
 15         26.1          38.4       1.1X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 year of timestamp:                        Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-year of timestamp wholestage off                   1366           1374         
 11          7.3         136.6       1.0X
-year of timestamp wholestage on                    1278           1302         
 21          7.8         127.8       1.1X
+year of timestamp wholestage off                   1334           1352         
 27          7.5         133.4       1.0X
+year of timestamp wholestage on                    1301           1309         
  9          7.7         130.1       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 quarter of timestamp:                     Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-quarter of timestamp wholestage off                1606           1622         
 23          6.2         160.6       1.0X
-quarter of timestamp wholestage on                 1569           1584         
 16          6.4         156.9       1.0X
+quarter of timestamp wholestage off                1623           1636         
 18          6.2         162.3       1.0X
+quarter of timestamp wholestage on                 1592           1603         
  9          6.3         159.2       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 month of timestamp:                       Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-month of timestamp wholestage off                  1243           1259         
 24          8.0         124.3       1.0X
-month of timestamp wholestage on                   1267           1282         
 13          7.9         126.7       1.0X
+month of timestamp wholestage off                  1246           1250         
  5          8.0         124.6       1.0X
+month of timestamp wholestage on                   1277           1290         
 15          7.8         127.7       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 weekofyear of timestamp:                  Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-weekofyear of timestamp wholestage off             1837           1846         
 12          5.4         183.7       1.0X
-weekofyear of timestamp wholestage on              1842           1848         
  4          5.4         184.2       1.0X
+weekofyear of timestamp wholestage off             1881           1896         
 20          5.3         188.1       1.0X
+weekofyear of timestamp wholestage on              1865           1879         
 16          5.4         186.5       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 day of timestamp:                         Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-day of timestamp wholestage off                    1262           1289         
 39          7.9         126.2       1.0X
-day of timestamp wholestage on                     1263           1268         
  6          7.9         126.3       1.0X
+day of timestamp wholestage off                    1223           1249         
 37          8.2         122.3       1.0X
+day of timestamp wholestage on                     1261           1276         
 19          7.9         126.1       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 dayofyear of timestamp:                   Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-dayofyear of timestamp wholestage off              1302           1308         
  8          7.7         130.2       1.0X
-dayofyear of timestamp wholestage on               1300           1308         
  8          7.7         130.0       1.0X
+dayofyear of timestamp wholestage off              1291           1312         
 29          7.7         129.1       1.0X
+dayofyear of timestamp wholestage on               1284           1290         
  6          7.8         128.4       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 dayofmonth of timestamp:                  Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-dayofmonth of timestamp wholestage off             1244           1248         
  6          8.0         124.4       1.0X
-dayofmonth of timestamp wholestage on              1253           1263         
 10          8.0         125.3       1.0X
+dayofmonth of timestamp wholestage off             1241           1246         
  7          8.1         124.1       1.0X
+dayofmonth of timestamp wholestage on              1268           1276         
  6          7.9         126.8       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 dayofweek of timestamp:                   Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-dayofweek of timestamp wholestage off              1407           1408         
  2          7.1         140.7       1.0X
-dayofweek of timestamp wholestage on               1411           1432         
 14          7.1         141.1       1.0X
+dayofweek of timestamp wholestage off              1402           1408         
  9          7.1         140.2       1.0X
+dayofweek of timestamp wholestage on               1414           1423         
  8          7.1         141.4       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 weekday of timestamp:                     Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-weekday of timestamp wholestage off                1349           1352         
  5          7.4         134.9       1.0X
-weekday of timestamp wholestage on                 1347           1354         
 10          7.4         134.7       1.0X
+weekday of timestamp wholestage off                1349           1350         
  2          7.4         134.9       1.0X
+weekday of timestamp wholestage on                 1344           1352         
  5          7.4         134.4       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 hour of timestamp:                        Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-hour of timestamp wholestage off                   1038           1041         
  5          9.6         103.8       1.0X
-hour of timestamp wholestage on                     983            995         
  9         10.2          98.3       1.1X
+hour of timestamp wholestage off                    974            974         
  0         10.3          97.4       1.0X
+hour of timestamp wholestage on                    1009           1019         
 15          9.9         100.9       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 minute of timestamp:                      Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-minute of timestamp wholestage off                 1042           1043         
  1          9.6         104.2       1.0X
-minute of timestamp wholestage on                  1022           1030         
  9          9.8         102.2       1.0X
+minute of timestamp wholestage off                 1024           1028         
  6          9.8         102.4       1.0X
+minute of timestamp wholestage on                   978            992         
 11         10.2          97.8       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 second of timestamp:                      Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-second of timestamp wholestage off                  978            979         
  2         10.2          97.8       1.0X
-second of timestamp wholestage on                  1016           1028         
 21          9.8         101.6       1.0X
+second of timestamp wholestage off                 1023           1026         
  4          9.8         102.3       1.0X
+second of timestamp wholestage on                  1008           1024         
 14          9.9         100.8       1.0X
 
 
 
================================================================================================
@@ -102,15 +102,15 @@ OpenJDK 64-Bit Server VM 
11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 4.15.0-1
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 current_date:                             Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-current_date wholestage off                         295            299         
  6         33.9          29.5       1.0X
-current_date wholestage on                          321            327         
  7         31.2          32.1       0.9X
+current_date wholestage off                         296            299         
  5         33.8          29.6       1.0X
+current_date wholestage on                          316            318         
  2         31.7          31.6       0.9X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 current_timestamp:                        Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-current_timestamp wholestage off                    342            387         
 63         29.2          34.2       1.0X
-current_timestamp wholestage on                     324            376         
 97         30.9          32.4       1.1X
+current_timestamp wholestage off                    310            345         
 49         32.2          31.0       1.0X
+current_timestamp wholestage on                     316            332         
 11         31.7          31.6       1.0X
 
 
 
================================================================================================
@@ -121,43 +121,43 @@ OpenJDK 64-Bit Server VM 
11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 4.15.0-1
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 cast to date:                             Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-cast to date wholestage off                        1065           1067         
  3          9.4         106.5       1.0X
-cast to date wholestage on                         1044           1053         
 10          9.6         104.4       1.0X
+cast to date wholestage off                        1067           1071         
  7          9.4         106.7       1.0X
+cast to date wholestage on                         1050           1072         
 20          9.5         105.0       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 last_day:                                 Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-last_day wholestage off                            1241           1245         
  6          8.1         124.1       1.0X
-last_day wholestage on                             1276           1287         
 11          7.8         127.6       1.0X
+last_day wholestage off                            1240           1245         
  8          8.1         124.0       1.0X
+last_day wholestage on                             1273           1290         
 14          7.9         127.3       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 next_day:                                 Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-next_day wholestage off                            1130           1150         
 28          8.8         113.0       1.0X
-next_day wholestage on                             1086           1096         
  8          9.2         108.6       1.0X
+next_day wholestage off                            1121           1130         
 13          8.9         112.1       1.0X
+next_day wholestage on                             1099           1106         
 11          9.1         109.9       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_add:                                 Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_add wholestage off                            1048           1054         
  9          9.5         104.8       1.0X
-date_add wholestage on                             1077           1079         
  2          9.3         107.7       1.0X
+date_add wholestage off                            1045           1051         
  8          9.6         104.5       1.0X
+date_add wholestage on                             1078           1086         
 16          9.3         107.8       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_sub:                                 Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_sub wholestage off                            1047           1052         
  7          9.6         104.7       1.0X
-date_sub wholestage on                             1078           1087         
  7          9.3         107.8       1.0X
+date_sub wholestage off                            1049           1050         
  1          9.5         104.9       1.0X
+date_sub wholestage on                             1078           1083         
  4          9.3         107.8       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 add_months:                               Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-add_months wholestage off                          1392           1421         
 41          7.2         139.2       1.0X
-add_months wholestage on                           1441           1447         
  6          6.9         144.1       1.0X
+add_months wholestage off                          1411           1415         
  7          7.1         141.1       1.0X
+add_months wholestage on                           1435           1447         
 13          7.0         143.5       1.0X
 
 
 
================================================================================================
@@ -168,8 +168,8 @@ OpenJDK 64-Bit Server VM 
11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 4.15.0-1
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 format date:                              Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-format date wholestage off                         6034           6047         
 19          1.7         603.4       1.0X
-format date wholestage on                          5874           5891         
 16          1.7         587.4       1.0X
+format date wholestage off                         5736           5786         
 71          1.7         573.6       1.0X
+format date wholestage on                          5550           5575         
 29          1.8         555.0       1.0X
 
 
 
================================================================================================
@@ -180,8 +180,8 @@ OpenJDK 64-Bit Server VM 
11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 4.15.0-1
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 from_unixtime:                            Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-from_unixtime wholestage off                       7350           7371         
 29          1.4         735.0       1.0X
-from_unixtime wholestage on                        7415           7428         
 13          1.3         741.5       1.0X
+from_unixtime wholestage off                       7378           7379         
  1          1.4         737.8       1.0X
+from_unixtime wholestage on                        7441           7465         
 24          1.3         744.1       1.0X
 
 
 
================================================================================================
@@ -192,15 +192,15 @@ OpenJDK 64-Bit Server VM 
11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 4.15.0-1
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 from_utc_timestamp:                       Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-from_utc_timestamp wholestage off                  1235           1236         
  2          8.1         123.5       1.0X
-from_utc_timestamp wholestage on                   1300           1309         
 10          7.7         130.0       0.9X
+from_utc_timestamp wholestage off                  1238           1260         
 30          8.1         123.8       1.0X
+from_utc_timestamp wholestage on                   1300           1308         
  5          7.7         130.0       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 to_utc_timestamp:                         Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-to_utc_timestamp wholestage off                    1798           1805         
 10          5.6         179.8       1.0X
-to_utc_timestamp wholestage on                     1765           1779         
 11          5.7         176.5       1.0X
+to_utc_timestamp wholestage off                    1790           1793         
  5          5.6         179.0       1.0X
+to_utc_timestamp wholestage on                     1737           1748         
 13          5.8         173.7       1.0X
 
 
 
================================================================================================
@@ -211,29 +211,29 @@ OpenJDK 64-Bit Server VM 
11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 4.15.0-1
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 cast interval:                            Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-cast interval wholestage off                        345            350         
  7         29.0          34.5       1.0X
-cast interval wholestage on                         325            337         
 11         30.7          32.5       1.1X
+cast interval wholestage off                        347            350         
  4         28.8          34.7       1.0X
+cast interval wholestage on                         327            329         
  4         30.6          32.7       1.1X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 datediff:                                 Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-datediff wholestage off                            1833           1834         
  2          5.5         183.3       1.0X
-datediff wholestage on                             1807           1815         
  9          5.5         180.7       1.0X
+datediff wholestage off                            1836           1860         
 33          5.4         183.6       1.0X
+datediff wholestage on                             1811           1826         
 16          5.5         181.1       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 months_between:                           Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-months_between wholestage off                      5938           5941         
  4          1.7         593.8       1.0X
-months_between wholestage on                       5891           5920         
 19          1.7         589.1       1.0X
+months_between wholestage off                      5613           5617         
  6          1.8         561.3       1.0X
+months_between wholestage on                       5590           5624         
 35          1.8         559.0       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 window:                                   Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-window wholestage off                              2153           2313         
226          0.5        2153.3       1.0X
-window wholestage on                              47097          47143         
 31          0.0       47097.0       0.0X
+window wholestage off                              2222           2308         
122          0.5        2222.2       1.0X
+window wholestage on                              48721          48828         
101          0.0       48720.7       0.0X
 
 
 
================================================================================================
@@ -244,134 +244,134 @@ OpenJDK 64-Bit Server VM 
11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 4.15.0-1
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc YEAR:                          Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc YEAR wholestage off                     2458           2461         
  5          4.1         245.8       1.0X
-date_trunc YEAR wholestage on                      2433           2441         
  6          4.1         243.3       1.0X
+date_trunc YEAR wholestage off                     2482           2503         
 30          4.0         248.2       1.0X
+date_trunc YEAR wholestage on                      2520           2532         
 12          4.0         252.0       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc YYYY:                          Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc YYYY wholestage off                     2454           2457         
  4          4.1         245.4       1.0X
-date_trunc YYYY wholestage on                      2436           2442         
  7          4.1         243.6       1.0X
+date_trunc YYYY wholestage off                     2487           2493         
  9          4.0         248.7       1.0X
+date_trunc YYYY wholestage on                      2521           2527         
  8          4.0         252.1       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc YY:                            Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc YY wholestage off                       2467           2469         
  3          4.1         246.7       1.0X
-date_trunc YY wholestage on                        2435           2448         
 18          4.1         243.5       1.0X
+date_trunc YY wholestage off                       2479           2492         
 18          4.0         247.9       1.0X
+date_trunc YY wholestage on                        2519           2529         
  8          4.0         251.9       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc MON:                           Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc MON wholestage off                      2494           2494         
  1          4.0         249.4       1.0X
-date_trunc MON wholestage on                       2428           2441         
 14          4.1         242.8       1.0X
+date_trunc MON wholestage off                      2504           2519         
 21          4.0         250.4       1.0X
+date_trunc MON wholestage on                       2549           2563         
 15          3.9         254.9       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc MONTH:                         Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc MONTH wholestage off                    2502           2510         
 12          4.0         250.2       1.0X
-date_trunc MONTH wholestage on                     2438           2444         
  6          4.1         243.8       1.0X
+date_trunc MONTH wholestage off                    2517           2527         
 14          4.0         251.7       1.0X
+date_trunc MONTH wholestage on                     2538           2547         
 11          3.9         253.8       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc MM:                            Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc MM wholestage off                       2486           2487         
  1          4.0         248.6       1.0X
-date_trunc MM wholestage on                        2436           2441         
  4          4.1         243.6       1.0X
+date_trunc MM wholestage off                       2506           2507         
  2          4.0         250.6       1.0X
+date_trunc MM wholestage on                        2536           2546         
 10          3.9         253.6       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc DAY:                           Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc DAY wholestage off                      2406           2421         
 21          4.2         240.6       1.0X
-date_trunc DAY wholestage on                       2352           2370         
 23          4.3         235.2       1.0X
+date_trunc DAY wholestage off                      2443           2454         
 17          4.1         244.3       1.0X
+date_trunc DAY wholestage on                       2468           2479         
 12          4.1         246.8       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc DD:                            Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc DD wholestage off                       2414           2417         
  5          4.1         241.4       1.0X
-date_trunc DD wholestage on                        2355           2366         
  8          4.2         235.5       1.0X
+date_trunc DD wholestage off                       2440           2440         
  0          4.1         244.0       1.0X
+date_trunc DD wholestage on                        2459           2481         
 23          4.1         245.9       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc HOUR:                          Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc HOUR wholestage off                     2419           2426         
 10          4.1         241.9       1.0X
-date_trunc HOUR wholestage on                      2369           2374         
  4          4.2         236.9       1.0X
+date_trunc HOUR wholestage off                     2452           2453         
  2          4.1         245.2       1.0X
+date_trunc HOUR wholestage on                      2428           2435         
  5          4.1         242.8       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc MINUTE:                        Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc MINUTE wholestage off                    357            378         
 30         28.0          35.7       1.0X
-date_trunc MINUTE wholestage on                     331            335         
  4         30.2          33.1       1.1X
+date_trunc MINUTE wholestage off                    359            359         
  1         27.8          35.9       1.0X
+date_trunc MINUTE wholestage on                     382            388         
  8         26.2          38.2       0.9X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc SECOND:                        Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc SECOND wholestage off                    373            375         
  3         26.8          37.3       1.0X
-date_trunc SECOND wholestage on                     330            335         
  4         30.3          33.0       1.1X
+date_trunc SECOND wholestage off                    382            386         
  6         26.2          38.2       1.0X
+date_trunc SECOND wholestage on                     379            382         
  5         26.4          37.9       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc WEEK:                          Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc WEEK wholestage off                     2479           2480         
  2          4.0         247.9       1.0X
-date_trunc WEEK wholestage on                      2441           2450         
  8          4.1         244.1       1.0X
+date_trunc WEEK wholestage off                     2427           2429         
  3          4.1         242.7       1.0X
+date_trunc WEEK wholestage on                      2427           2441         
 12          4.1         242.7       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc QUARTER:                       Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc QUARTER wholestage off                  3337           3337         
  0          3.0         333.7       1.0X
-date_trunc QUARTER wholestage on                   3235           3244         
  8          3.1         323.5       1.0X
+date_trunc QUARTER wholestage off                  3551           3583         
 46          2.8         355.1       1.0X
+date_trunc QUARTER wholestage on                   3517           3526         
  6          2.8         351.7       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 trunc year:                               Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-trunc year wholestage off                           315            316         
  1         31.7          31.5       1.0X
-trunc year wholestage on                            293            302         
 16         34.2          29.3       1.1X
+trunc year wholestage off                           312            313         
  1         32.0          31.2       1.0X
+trunc year wholestage on                            319            326         
  7         31.3          31.9       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 trunc yyyy:                               Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-trunc yyyy wholestage off                           312            314         
  3         32.0          31.2       1.0X
-trunc yyyy wholestage on                            295            300         
  8         33.9          29.5       1.1X
+trunc yyyy wholestage off                           318            318         
  0         31.5          31.8       1.0X
+trunc yyyy wholestage on                            317            328         
 17         31.5          31.7       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 trunc yy:                                 Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-trunc yy wholestage off                             311            317         
  8         32.1          31.1       1.0X
-trunc yy wholestage on                              294            302         
  7         34.0          29.4       1.1X
+trunc yy wholestage off                             315            322         
 10         31.8          31.5       1.0X
+trunc yy wholestage on                              318            328         
  9         31.5          31.8       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 trunc mon:                                Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-trunc mon wholestage off                            312            314         
  3         32.0          31.2       1.0X
-trunc mon wholestage on                             296            299         
  5         33.8          29.6       1.1X
+trunc mon wholestage off                            311            313         
  2         32.1          31.1       1.0X
+trunc mon wholestage on                             322            326         
  6         31.0          32.2       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 trunc month:                              Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-trunc month wholestage off                          311            311         
  0         32.1          31.1       1.0X
-trunc month wholestage on                           293            297         
  4         34.2          29.3       1.1X
+trunc month wholestage off                          310            318         
 11         32.2          31.0       1.0X
+trunc month wholestage on                           319            326         
  8         31.3          31.9       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 trunc mm:                                 Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-trunc mm wholestage off                             315            320         
  7         31.7          31.5       1.0X
-trunc mm wholestage on                              291            296         
  8         34.4          29.1       1.1X
+trunc mm wholestage off                             311            314         
  4         32.2          31.1       1.0X
+trunc mm wholestage on                              318            324         
  7         31.4          31.8       1.0X
 
 
 
================================================================================================
@@ -382,36 +382,36 @@ OpenJDK 64-Bit Server VM 
11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 4.15.0-1
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 to timestamp str:                         Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-to timestamp str wholestage off                     161            171         
 15          6.2         160.6       1.0X
-to timestamp str wholestage on                      152            154         
  1          6.6         151.6       1.1X
+to timestamp str wholestage off                     166            167         
  2          6.0         165.7       1.0X
+to timestamp str wholestage on                      158            162         
  4          6.3         158.2       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 to_timestamp:                             Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-to_timestamp wholestage off                        1441           1450         
 13          0.7        1440.6       1.0X
-to_timestamp wholestage on                         1371           1381         
 20          0.7        1370.8       1.1X
+to_timestamp wholestage off                        1487           1488         
  1          0.7        1487.1       1.0X
+to_timestamp wholestage on                         1418           1422         
  4          0.7        1418.4       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 to_unix_timestamp:                        Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-to_unix_timestamp wholestage off                   1329           1335         
  9          0.8        1328.7       1.0X
-to_unix_timestamp wholestage on                    1354           1357         
  4          0.7        1353.7       1.0X
+to_unix_timestamp wholestage off                   1409           1420         
 15          0.7        1409.2       1.0X
+to_unix_timestamp wholestage on                    1422           1428         
  8          0.7        1422.1       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 to date str:                              Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-to date str wholestage off                          212            213         
  2          4.7         211.7       1.0X
-to date str wholestage on                           206            207         
  1          4.9         205.9       1.0X
+to date str wholestage off                          207            207         
  0          4.8         206.9       1.0X
+to date str wholestage on                           209            210         
  1          4.8         209.4       1.0X
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 to_date:                                  Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-to_date wholestage off                             3255           3309         
 76          0.3        3255.0       1.0X
-to_date wholestage on                              3146           3168         
 23          0.3        3146.4       1.0X
+to_date wholestage off                             3378           3398         
 28          0.3        3377.7       1.0X
+to_date wholestage on                              3372           3379         
  8          0.3        3372.2       1.0X
 
 
 
================================================================================================
@@ -420,10 +420,11 @@ Conversion from/to external types
 
 OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
-To/from java.sql.Timestamp:               Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
+To/from Java's date-time:                 Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-From java.sql.Timestamp                             359            365         
  8         13.9          71.8       1.0X
-Collect longs                                      1832           1895         
 84          2.7         366.3       0.2X
-Collect timestamps                                 1811           2046         
247          2.8         362.2       0.2X
+From java.sql.Date                                  427            443         
 23         11.7          85.4       1.0X
+From java.sql.Timestamp                             361            369         
 11         13.8          72.3       1.2X
+Collect longs                                      1942           2044         
170          2.6         388.3       0.2X
+Collect timestamps                                 1891           2093         
192          2.6         378.2       0.2X
 
 
diff --git a/sql/core/benchmarks/DateTimeBenchmark-results.txt 
b/sql/core/benchmarks/DateTimeBenchmark-results.txt
index ee70aa3..77b6f83 100644
--- a/sql/core/benchmarks/DateTimeBenchmark-results.txt
+++ b/sql/core/benchmarks/DateTimeBenchmark-results.txt
@@ -6,92 +6,92 @@ OpenJDK 64-Bit Server VM 
1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 4.15.0-
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 cast to timestamp:                        Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-cast to timestamp wholestage off                    416            439         
 32         24.0          41.6       1.0X
-cast to timestamp wholestage on                     370            399         
 31         27.1          37.0       1.1X
+cast to timestamp wholestage off                    410            428         
 25         24.4          41.0       1.0X
+cast to timestamp wholestage on                     364            379         
 17         27.5          36.4       1.1X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 year of timestamp:                        Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-year of timestamp wholestage off                   1328           1343         
 21          7.5         132.8       1.0X
-year of timestamp wholestage on                    1204           1247         
 27          8.3         120.4       1.1X
+year of timestamp wholestage off                   1308           1318         
 15          7.6         130.8       1.0X
+year of timestamp wholestage on                    1204           1234         
 19          8.3         120.4       1.1X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 quarter of timestamp:                     Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-quarter of timestamp wholestage off                1447           1451         
  6          6.9         144.7       1.0X
-quarter of timestamp wholestage on                 1384           1392         
  7          7.2         138.4       1.0X
+quarter of timestamp wholestage off                1439           1442         
  6          7.0         143.9       1.0X
+quarter of timestamp wholestage on                 1374           1385         
  9          7.3         137.4       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 month of timestamp:                       Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-month of timestamp wholestage off                  1233           1238         
  6          8.1         123.3       1.0X
-month of timestamp wholestage on                   1232           1252         
 15          8.1         123.2       1.0X
+month of timestamp wholestage off                  1228           1234         
  8          8.1         122.8       1.0X
+month of timestamp wholestage on                   1225           1241         
 25          8.2         122.5       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 weekofyear of timestamp:                  Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-weekofyear of timestamp wholestage off             1921           1923         
  3          5.2         192.1       1.0X
-weekofyear of timestamp wholestage on              1893           1914         
 14          5.3         189.3       1.0X
+weekofyear of timestamp wholestage off             1878           1880         
  3          5.3         187.8       1.0X
+weekofyear of timestamp wholestage on              1864           1870         
  6          5.4         186.4       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 day of timestamp:                         Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-day of timestamp wholestage off                    1224           1227         
  4          8.2         122.4       1.0X
-day of timestamp wholestage on                     1219           1238         
 15          8.2         121.9       1.0X
+day of timestamp wholestage off                    1218           1220         
  3          8.2         121.8       1.0X
+day of timestamp wholestage on                     1217           1226         
 10          8.2         121.7       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 dayofyear of timestamp:                   Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-dayofyear of timestamp wholestage off              1283           1283         
  1          7.8         128.3       1.0X
-dayofyear of timestamp wholestage on               1256           1261         
  5          8.0         125.6       1.0X
+dayofyear of timestamp wholestage off              1274           1282         
 12          7.8         127.4       1.0X
+dayofyear of timestamp wholestage on               1263           1274         
 14          7.9         126.3       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 dayofmonth of timestamp:                  Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-dayofmonth of timestamp wholestage off             1227           1233         
  8          8.2         122.7       1.0X
-dayofmonth of timestamp wholestage on              1220           1228         
  6          8.2         122.0       1.0X
+dayofmonth of timestamp wholestage off             1221           1226         
  6          8.2         122.1       1.0X
+dayofmonth of timestamp wholestage on              1215           1222         
  9          8.2         121.5       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 dayofweek of timestamp:                   Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-dayofweek of timestamp wholestage off              1404           1408         
  5          7.1         140.4       1.0X
-dayofweek of timestamp wholestage on               1376           1386         
  6          7.3         137.6       1.0X
+dayofweek of timestamp wholestage off              1404           1431         
 38          7.1         140.4       1.0X
+dayofweek of timestamp wholestage on               1374           1381         
  8          7.3         137.4       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 weekday of timestamp:                     Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-weekday of timestamp wholestage off                1346           1350         
  5          7.4         134.6       1.0X
-weekday of timestamp wholestage on                 1313           1319         
  6          7.6         131.3       1.0X
+weekday of timestamp wholestage off                1342           1350         
 12          7.5         134.2       1.0X
+weekday of timestamp wholestage on                 1311           1317         
  5          7.6         131.1       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 hour of timestamp:                        Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-hour of timestamp wholestage off                   1005           1011         
  8         10.0         100.5       1.0X
-hour of timestamp wholestage on                     953            961         
  9         10.5          95.3       1.1X
+hour of timestamp wholestage off                    997           1000         
  4         10.0          99.7       1.0X
+hour of timestamp wholestage on                     959            969         
  8         10.4          95.9       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 minute of timestamp:                      Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-minute of timestamp wholestage off                  995           1000         
  8         10.1          99.5       1.0X
-minute of timestamp wholestage on                   957            959         
  3         10.5          95.7       1.0X
+minute of timestamp wholestage off                  968            970         
  2         10.3          96.8       1.0X
+minute of timestamp wholestage on                   952            960         
  8         10.5          95.2       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 second of timestamp:                      Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-second of timestamp wholestage off                  960            963         
  4         10.4          96.0       1.0X
-second of timestamp wholestage on                   957            960         
  3         10.4          95.7       1.0X
+second of timestamp wholestage off                  971            974         
  5         10.3          97.1       1.0X
+second of timestamp wholestage on                   952            953         
  0         10.5          95.2       1.0X
 
 
 
================================================================================================
@@ -102,15 +102,15 @@ OpenJDK 64-Bit Server VM 
1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 4.15.0-
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 current_date:                             Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-current_date wholestage off                         290            295         
  7         34.4          29.0       1.0X
-current_date wholestage on                          287            295         
 13         34.9          28.7       1.0X
+current_date wholestage off                         277            282         
  7         36.1          27.7       1.0X
+current_date wholestage on                          283            290         
 11         35.3          28.3       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 current_timestamp:                        Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-current_timestamp wholestage off                    294            296         
  4         34.1          29.4       1.0X
-current_timestamp wholestage on                     280            303         
 19         35.7          28.0       1.0X
+current_timestamp wholestage off                    302            324         
 31         33.1          30.2       1.0X
+current_timestamp wholestage on                     281            292         
 13         35.6          28.1       1.1X
 
 
 
================================================================================================
@@ -121,43 +121,43 @@ OpenJDK 64-Bit Server VM 
1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 4.15.0-
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 cast to date:                             Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-cast to date wholestage off                        1066           1067         
  1          9.4         106.6       1.0X
-cast to date wholestage on                         1007           1014         
  6          9.9         100.7       1.1X
+cast to date wholestage off                        1064           1066         
  2          9.4         106.4       1.0X
+cast to date wholestage on                         1002           1010         
  8         10.0         100.2       1.1X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 last_day:                                 Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-last_day wholestage off                            1273           1289         
 22          7.9         127.3       1.0X
-last_day wholestage on                             1238           1246         
  9          8.1         123.8       1.0X
+last_day wholestage off                            1247           1250         
  4          8.0         124.7       1.0X
+last_day wholestage on                             1238           1245         
  4          8.1         123.8       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 next_day:                                 Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-next_day wholestage off                            1124           1125         
  2          8.9         112.4       1.0X
-next_day wholestage on                             1058           1064         
  8          9.5         105.8       1.1X
+next_day wholestage off                            1112           1113         
  1          9.0         111.2       1.0X
+next_day wholestage on                             1055           1059         
  5          9.5         105.5       1.1X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_add:                                 Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_add wholestage off                            1049           1049         
  0          9.5         104.9       1.0X
-date_add wholestage on                             1036           1041         
  7          9.6         103.6       1.0X
+date_add wholestage off                            1049           1051         
  3          9.5         104.9       1.0X
+date_add wholestage on                             1036           1043         
  9          9.6         103.6       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_sub:                                 Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_sub wholestage off                            1051           1052         
  2          9.5         105.1       1.0X
-date_sub wholestage on                             1040           1046         
  5          9.6         104.0       1.0X
+date_sub wholestage off                            1043           1063         
 29          9.6         104.3       1.0X
+date_sub wholestage on                             1036           1041         
  5          9.6         103.6       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 add_months:                               Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-add_months wholestage off                          1381           1388         
 11          7.2         138.1       1.0X
-add_months wholestage on                           1359           1367         
  8          7.4         135.9       1.0X
+add_months wholestage off                          1371           1373         
  2          7.3         137.1       1.0X
+add_months wholestage on                           1402           1409         
 10          7.1         140.2       1.0X
 
 
 
================================================================================================
@@ -168,8 +168,8 @@ OpenJDK 64-Bit Server VM 
1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 4.15.0-
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 format date:                              Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-format date wholestage off                         5766           5793         
 38          1.7         576.6       1.0X
-format date wholestage on                          5803           5812         
  7          1.7         580.3       1.0X
+format date wholestage off                         5741           5862         
171          1.7         574.1       1.0X
+format date wholestage on                          5589           5600         
 19          1.8         558.9       1.0X
 
 
 
================================================================================================
@@ -180,8 +180,8 @@ OpenJDK 64-Bit Server VM 
1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 4.15.0-
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 from_unixtime:                            Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-from_unixtime wholestage off                       8891           8915         
 34          1.1         889.1       1.0X
-from_unixtime wholestage on                        8870           8885         
 12          1.1         887.0       1.0X
+from_unixtime wholestage off                       8681           8684         
  4          1.2         868.1       1.0X
+from_unixtime wholestage on                        8669           8707         
 33          1.2         866.9       1.0X
 
 
 
================================================================================================
@@ -192,15 +192,15 @@ OpenJDK 64-Bit Server VM 
1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 4.15.0-
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 from_utc_timestamp:                       Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-from_utc_timestamp wholestage off                  1089           1094         
  7          9.2         108.9       1.0X
-from_utc_timestamp wholestage on                   1105           1107         
  3          9.0         110.5       1.0X
+from_utc_timestamp wholestage off                  1096           1101         
  7          9.1         109.6       1.0X
+from_utc_timestamp wholestage on                   1108           1116         
  6          9.0         110.8       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 to_utc_timestamp:                         Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-to_utc_timestamp wholestage off                    1620           1628         
 11          6.2         162.0       1.0X
-to_utc_timestamp wholestage on                     1600           1608         
  7          6.3         160.0       1.0X
+to_utc_timestamp wholestage off                    1626           1638         
 16          6.1         162.6       1.0X
+to_utc_timestamp wholestage on                     1594           1606         
 10          6.3         159.4       1.0X
 
 
 
================================================================================================
@@ -211,29 +211,29 @@ OpenJDK 64-Bit Server VM 
1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 4.15.0-
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 cast interval:                            Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-cast interval wholestage off                        334            336         
  3         30.0          33.4       1.0X
-cast interval wholestage on                         305            310         
  4         32.7          30.5       1.1X
+cast interval wholestage off                        331            335         
  6         30.2          33.1       1.0X
+cast interval wholestage on                         298            305         
  5         33.5          29.8       1.1X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 datediff:                                 Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-datediff wholestage off                            1811           1816         
  7          5.5         181.1       1.0X
-datediff wholestage on                             1758           1761         
  3          5.7         175.8       1.0X
+datediff wholestage off                            1821           1822         
  2          5.5         182.1       1.0X
+datediff wholestage on                             1759           1763         
  3          5.7         175.9       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 months_between:                           Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-months_between wholestage off                      4780           4789         
 12          2.1         478.0       1.0X
-months_between wholestage on                       4765           4772         
  8          2.1         476.5       1.0X
+months_between wholestage off                      4752           4770         
 25          2.1         475.2       1.0X
+months_between wholestage on                       4740           4746         
  5          2.1         474.0       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 window:                                   Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-window wholestage off                              1840           1967         
179          0.5        1840.4       1.0X
-window wholestage on                              46710          46792         
 57          0.0       46709.5       0.0X
+window wholestage off                              1936           2049         
160          0.5        1935.7       1.0X
+window wholestage on                              44821          44850         
 44          0.0       44820.6       0.0X
 
 
 
================================================================================================
@@ -244,134 +244,134 @@ OpenJDK 64-Bit Server VM 
1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 4.15.0-
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc YEAR:                          Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc YEAR wholestage off                     2350           2351         
  1          4.3         235.0       1.0X
-date_trunc YEAR wholestage on                      2317           2324         
  8          4.3         231.7       1.0X
+date_trunc YEAR wholestage off                     2382           2384         
  3          4.2         238.2       1.0X
+date_trunc YEAR wholestage on                      2309           2316         
  7          4.3         230.9       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc YYYY:                          Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc YYYY wholestage off                     2341           2343         
  3          4.3         234.1       1.0X
-date_trunc YYYY wholestage on                      2314           2332         
 22          4.3         231.4       1.0X
+date_trunc YYYY wholestage off                     2368           2375         
 10          4.2         236.8       1.0X
+date_trunc YYYY wholestage on                      2304           2313         
  7          4.3         230.4       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc YY:                            Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc YY wholestage off                       2348           2354         
  9          4.3         234.8       1.0X
-date_trunc YY wholestage on                        2313           2317         
  3          4.3         231.3       1.0X
+date_trunc YY wholestage off                       2381           2396         
 22          4.2         238.1       1.0X
+date_trunc YY wholestage on                        2303           2305         
  1          4.3         230.3       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc MON:                           Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc MON wholestage off                      2383           2385         
  3          4.2         238.3       1.0X
-date_trunc MON wholestage on                       2293           2307         
 22          4.4         229.3       1.0X
+date_trunc MON wholestage off                      2325           2333         
 11          4.3         232.5       1.0X
+date_trunc MON wholestage on                       2293           2301         
  6          4.4         229.3       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc MONTH:                         Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc MONTH wholestage off                    2380           2393         
 18          4.2         238.0       1.0X
-date_trunc MONTH wholestage on                     2296           2304         
  9          4.4         229.6       1.0X
+date_trunc MONTH wholestage off                    2335           2335         
  0          4.3         233.5       1.0X
+date_trunc MONTH wholestage on                     2296           2298         
  2          4.4         229.6       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc MM:                            Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc MM wholestage off                       2375           2380         
  7          4.2         237.5       1.0X
-date_trunc MM wholestage on                        2295           2302         
  8          4.4         229.5       1.0X
+date_trunc MM wholestage off                       2328           2329         
  1          4.3         232.8       1.0X
+date_trunc MM wholestage on                        2290           2295         
  4          4.4         229.0       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc DAY:                           Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc DAY wholestage off                      2145           2145         
  1          4.7         214.5       1.0X
-date_trunc DAY wholestage on                       2090           2096         
  6          4.8         209.0       1.0X
+date_trunc DAY wholestage off                      2139           2140         
  1          4.7         213.9       1.0X
+date_trunc DAY wholestage on                       2095           2101         
  7          4.8         209.5       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc DD:                            Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc DD wholestage off                       2142           2149         
 11          4.7         214.2       1.0X
-date_trunc DD wholestage on                        2090           2096         
  5          4.8         209.0       1.0X
+date_trunc DD wholestage off                       2143           2145         
  2          4.7         214.3       1.0X
+date_trunc DD wholestage on                        2087           2092         
  3          4.8         208.7       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc HOUR:                          Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc HOUR wholestage off                     2204           2212         
 11          4.5         220.4       1.0X
-date_trunc HOUR wholestage on                      2196           2201         
  5          4.6         219.6       1.0X
+date_trunc HOUR wholestage off                     2201           2207         
  8          4.5         220.1       1.0X
+date_trunc HOUR wholestage on                      2176           2185         
  6          4.6         217.6       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc MINUTE:                        Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc MINUTE wholestage off                    353            353         
  1         28.3          35.3       1.0X
-date_trunc MINUTE wholestage on                     331            335         
  4         30.2          33.1       1.1X
+date_trunc MINUTE wholestage off                    356            356         
  0         28.1          35.6       1.0X
+date_trunc MINUTE wholestage on                     333            344         
  7         30.1          33.3       1.1X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc SECOND:                        Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc SECOND wholestage off                    343            345         
  3         29.2          34.3       1.0X
-date_trunc SECOND wholestage on                     335            336         
  2         29.9          33.5       1.0X
+date_trunc SECOND wholestage off                    341            342         
  2         29.3          34.1       1.0X
+date_trunc SECOND wholestage on                     335            349         
 18         29.9          33.5       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc WEEK:                          Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc WEEK wholestage off                     2277           2279         
  3          4.4         227.7       1.0X
-date_trunc WEEK wholestage on                      2262           2270         
 10          4.4         226.2       1.0X
+date_trunc WEEK wholestage off                     2257           2257         
  1          4.4         225.7       1.0X
+date_trunc WEEK wholestage on                      2202           2211         
 11          4.5         220.2       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 date_trunc QUARTER:                       Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-date_trunc QUARTER wholestage off                  3395           3395         
  0          2.9         339.5       1.0X
-date_trunc QUARTER wholestage on                   3185           3193         
  6          3.1         318.5       1.1X
+date_trunc QUARTER wholestage off                  3180           3181         
  2          3.1         318.0       1.0X
+date_trunc QUARTER wholestage on                   3036           3043         
 12          3.3         303.6       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 trunc year:                               Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-trunc year wholestage off                           321            330         
 14         31.2          32.1       1.0X
-trunc year wholestage on                            293            308         
 14         34.1          29.3       1.1X
+trunc year wholestage off                           327            328         
  1         30.6          32.7       1.0X
+trunc year wholestage on                            310            325         
 13         32.3          31.0       1.1X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 trunc yyyy:                               Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-trunc yyyy wholestage off                           322            324         
  2         31.1          32.2       1.0X
-trunc yyyy wholestage on                            293            296         
  4         34.1          29.3       1.1X
+trunc yyyy wholestage off                           323            327         
  6         31.0          32.3       1.0X
+trunc yyyy wholestage on                            304            317         
 14         32.9          30.4       1.1X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 trunc yy:                                 Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-trunc yy wholestage off                             322            322         
  0         31.0          32.2       1.0X
-trunc yy wholestage on                              292            296         
  4         34.2          29.2       1.1X
+trunc yy wholestage off                             324            325         
  2         30.8          32.4       1.0X
+trunc yy wholestage on                              308            311         
  3         32.4          30.8       1.1X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 trunc mon:                                Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-trunc mon wholestage off                            319            320         
  1         31.3          31.9       1.0X
-trunc mon wholestage on                             293            295         
  1         34.1          29.3       1.1X
+trunc mon wholestage off                            323            323         
  1         31.0          32.3       1.0X
+trunc mon wholestage on                             303            310         
  7         33.0          30.3       1.1X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 trunc month:                              Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-trunc month wholestage off                          319            320         
  1         31.3          31.9       1.0X
-trunc month wholestage on                           293            295         
  2         34.1          29.3       1.1X
+trunc month wholestage off                          322            323         
  0         31.0          32.2       1.0X
+trunc month wholestage on                           307            337         
 65         32.6          30.7       1.1X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 trunc mm:                                 Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-trunc mm wholestage off                             318            319         
  1         31.4          31.8       1.0X
-trunc mm wholestage on                              293            312         
 26         34.1          29.3       1.1X
+trunc mm wholestage off                             324            325         
  2         30.9          32.4       1.0X
+trunc mm wholestage on                              294            306         
  7         34.0          29.4       1.1X
 
 
 
================================================================================================
@@ -382,36 +382,36 @@ OpenJDK 64-Bit Server VM 
1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 4.15.0-
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 to timestamp str:                         Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-to timestamp str wholestage off                     220            226         
  9          4.5         220.3       1.0X
-to timestamp str wholestage on                      212            214         
  4          4.7         212.2       1.0X
+to timestamp str wholestage off                     216            216         
  1          4.6         215.7       1.0X
+to timestamp str wholestage on                      207            209         
  3          4.8         207.0       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 to_timestamp:                             Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-to_timestamp wholestage off                        1875           1876         
  2          0.5        1874.7       1.0X
-to_timestamp wholestage on                         2075           2091         
 25          0.5        2075.1       0.9X
+to_timestamp wholestage off                        1751           1751         
  1          0.6        1750.6       1.0X
+to_timestamp wholestage on                         1798           1832         
 31          0.6        1798.4       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 to_unix_timestamp:                        Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-to_unix_timestamp wholestage off                   2141           2143         
  2          0.5        2141.2       1.0X
-to_unix_timestamp wholestage on                    2145           2177         
 21          0.5        2144.7       1.0X
+to_unix_timestamp wholestage off                   1770           1773         
  4          0.6        1770.2       1.0X
+to_unix_timestamp wholestage on                    1743           1754         
 10          0.6        1743.0       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 to date str:                              Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-to date str wholestage off                          276            284         
 11          3.6         276.1       1.0X
-to date str wholestage on                           264            270         
  8          3.8         264.3       1.0X
+to date str wholestage off                          260            266         
  9          3.8         260.1       1.0X
+to date str wholestage on                           257            260         
  3          3.9         257.3       1.0X
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
 to_date:                                  Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-to_date wholestage off                             3876           3903         
 38          0.3        3876.1       1.0X
-to_date wholestage on                              3833           3843         
  6          0.3        3833.4       1.0X
+to_date wholestage off                             3589           3620         
 44          0.3        3589.0       1.0X
+to_date wholestage on                              3565           3579         
 15          0.3        3565.0       1.0X
 
 
 
================================================================================================
@@ -420,10 +420,11 @@ Conversion from/to external types
 
 OpenJDK 64-Bit Server VM 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08 on Linux 
4.15.0-1063-aws
 Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
-To/from java.sql.Timestamp:               Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
+To/from Java's date-time:                 Best Time(ms)   Avg Time(ms)   
Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
 
------------------------------------------------------------------------------------------------------------------------
-From java.sql.Timestamp                             394            399         
  5         12.7          78.7       1.0X
-Collect longs                                      1336           2676        
1201          3.7         267.2       0.3X
-Collect timestamps                                 2025           2091         
 65          2.5         405.0       0.2X
+From java.sql.Date                                  416            420         
  6         12.0          83.2       1.0X
+From java.sql.Timestamp                             375            381         
  5         13.3          75.1       1.1X
+Collect longs                                      1225           1962        
1101          4.1         245.1       0.3X
+Collect timestamps                                 2013           2829        
1401          2.5         402.5       0.2X
 
 
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DateTimeBenchmark.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DateTimeBenchmark.scala
index 5a85762..5fa5b9b 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DateTimeBenchmark.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/DateTimeBenchmark.scala
@@ -131,7 +131,12 @@ object DateTimeBenchmark extends SqlBasedBenchmark {
           import spark.implicits._
           val rowsNum = 5000000
           val numIters = 3
-          val benchmark = new Benchmark("To/from java.sql.Timestamp", rowsNum, 
output = output)
+          val benchmark = new Benchmark("To/from Java's date-time", rowsNum, 
output = output)
+          benchmark.addCase("From java.sql.Date", numIters) { _ =>
+            spark.range(rowsNum)
+              .map(millis => new java.sql.Date(millis))
+              .noop()
+          }
           benchmark.addCase("From java.sql.Timestamp", numIters) { _ =>
             spark.range(rowsNum)
               .map(millis => new Timestamp(millis))


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to