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 56259dfb114c2..021072cd131d2 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 @@ -26,6 +26,8 @@ import java.util.concurrent.TimeUnit._ import scala.util.control.NonFatal +import sun.util.calendar.ZoneInfo + import org.apache.spark.sql.catalyst.util.DateTimeConstants._ import org.apache.spark.sql.catalyst.util.RebaseDateTime._ import org.apache.spark.sql.types.Decimal @@ -121,8 +123,13 @@ object DateTimeUtils { * @return A `java.sql.Date` from number of days since epoch. */ def toJavaDate(daysSinceEpoch: SQLDate): Date = { - val localDate = LocalDate.ofEpochDay(daysSinceEpoch) - new Date(localDate.getYear - 1900, localDate.getMonthValue - 1, localDate.getDayOfMonth) + val rebasedDays = rebaseGregorianToJulianDays(daysSinceEpoch) + val localMillis = Math.multiplyExact(rebasedDays, MILLIS_PER_DAY) + val timeZoneOffset = TimeZone.getDefault match { + case zoneInfo: ZoneInfo => zoneInfo.getOffsetsByWall(localMillis, null) + case timeZone: TimeZone => timeZone.getOffset(localMillis - timeZone.getRawOffset) + } + new Date(localMillis - timeZoneOffset) } /** diff --git a/sql/core/benchmarks/DateTimeBenchmark-jdk11-results.txt b/sql/core/benchmarks/DateTimeBenchmark-jdk11-results.txt index 1323a013332d2..0dfd66e4e98d2 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 440 459 28 22.7 44.0 1.0X -cast to timestamp wholestage on 384 407 15 26.1 38.4 1.1X +cast to timestamp wholestage off 453 469 22 22.1 45.3 1.0X +cast to timestamp wholestage on 378 416 44 26.5 37.8 1.2X 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 1334 1352 27 7.5 133.4 1.0X -year of timestamp wholestage on 1301 1309 9 7.7 130.1 1.0X +year of timestamp wholestage off 1381 1388 9 7.2 138.1 1.0X +year of timestamp wholestage on 1218 1229 14 8.2 121.8 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 quarter of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +quarter of timestamp wholestage off 1621 1627 9 6.2 162.1 1.0X +quarter of timestamp wholestage on 1593 1596 2 6.3 159.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 month of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +month of timestamp wholestage off 1241 1243 2 8.1 124.1 1.0X +month of timestamp wholestage on 1261 1277 10 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 weekofyear of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +weekofyear of timestamp wholestage off 2206 2207 1 4.5 220.6 1.0X +weekofyear of timestamp wholestage on 1848 1863 13 5.4 184.8 1.2X 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 1223 1249 37 8.2 122.3 1.0X -day of timestamp wholestage on 1261 1276 19 7.9 126.1 1.0X +day of timestamp wholestage off 1239 1242 4 8.1 123.9 1.0X +day of timestamp wholestage on 1258 1274 11 8.0 125.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 dayofyear of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +dayofyear of timestamp wholestage off 1266 1269 3 7.9 126.6 1.0X +dayofyear of timestamp wholestage on 1294 1305 13 7.7 129.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 1241 1246 7 8.1 124.1 1.0X -dayofmonth of timestamp wholestage on 1268 1276 6 7.9 126.8 1.0X +dayofmonth of timestamp wholestage off 1244 1245 2 8.0 124.4 1.0X +dayofmonth of timestamp wholestage on 1253 1265 6 8.0 125.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 dayofweek of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +dayofweek of timestamp wholestage off 1431 1436 7 7.0 143.1 1.0X +dayofweek of timestamp wholestage on 1412 1424 12 7.1 141.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 weekday of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +weekday of timestamp wholestage off 1347 1347 0 7.4 134.7 1.0X +weekday of timestamp wholestage on 1347 1358 12 7.4 134.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 hour of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +hour of timestamp wholestage off 1023 1024 1 9.8 102.3 1.0X +hour of timestamp wholestage on 980 988 8 10.2 98.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 minute of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +minute of timestamp wholestage off 1030 1034 6 9.7 103.0 1.0X +minute of timestamp wholestage on 986 992 6 10.1 98.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 second of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +second of timestamp wholestage off 1031 1032 1 9.7 103.1 1.0X +second of timestamp wholestage on 985 991 11 10.2 98.5 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 296 299 5 33.8 29.6 1.0X -current_date wholestage on 316 318 2 31.7 31.6 0.9X +current_date wholestage off 308 311 3 32.5 30.8 1.0X +current_date wholestage on 309 314 6 32.4 30.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 current_timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +current_timestamp wholestage off 312 332 28 32.0 31.2 1.0X +current_timestamp wholestage on 312 328 13 32.1 31.2 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 1067 1071 7 9.4 106.7 1.0X -cast to date wholestage on 1050 1072 20 9.5 105.0 1.0X +cast to date wholestage off 1067 1078 17 9.4 106.7 1.0X +cast to date wholestage on 1075 1084 8 9.3 107.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 last_day: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +last_day wholestage off 1246 1249 3 8.0 124.6 1.0X +last_day wholestage on 1269 1272 3 7.9 126.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 next_day: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +next_day wholestage off 1116 1124 11 9.0 111.6 1.0X +next_day wholestage on 1120 1129 7 8.9 112.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_add: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_add wholestage off 1054 1064 15 9.5 105.4 1.0X +date_add wholestage on 1071 1082 17 9.3 107.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_sub: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_sub wholestage off 1066 1069 4 9.4 106.6 1.0X +date_sub wholestage on 1075 1084 14 9.3 107.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 add_months: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +add_months wholestage off 1411 1417 9 7.1 141.1 1.0X +add_months wholestage on 1472 1476 5 6.8 147.2 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 5736 5786 71 1.7 573.6 1.0X -format date wholestage on 5550 5575 29 1.8 555.0 1.0X +format date wholestage off 5778 5801 33 1.7 577.8 1.0X +format date wholestage on 5718 5726 11 1.7 571.8 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 7378 7379 1 1.4 737.8 1.0X -from_unixtime wholestage on 7441 7465 24 1.3 744.1 1.0X +from_unixtime wholestage off 7739 7744 8 1.3 773.9 1.0X +from_unixtime wholestage on 7742 7758 10 1.3 774.2 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 1238 1260 30 8.1 123.8 1.0X -from_utc_timestamp wholestage on 1300 1308 5 7.7 130.0 1.0X +from_utc_timestamp wholestage off 1236 1243 11 8.1 123.6 1.0X +from_utc_timestamp wholestage on 1327 1333 8 7.5 132.7 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 to_utc_timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +to_utc_timestamp wholestage off 1787 1795 11 5.6 178.7 1.0X +to_utc_timestamp wholestage on 1791 1794 2 5.6 179.1 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 347 350 4 28.8 34.7 1.0X -cast interval wholestage on 327 329 4 30.6 32.7 1.1X +cast interval wholestage off 371 372 2 27.0 37.1 1.0X +cast interval wholestage on 340 348 10 29.4 34.0 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 1836 1860 33 5.4 183.6 1.0X -datediff wholestage on 1811 1826 16 5.5 181.1 1.0X +datediff wholestage off 1844 1859 22 5.4 184.4 1.0X +datediff wholestage on 1813 1822 10 5.5 181.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 months_between: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +months_between wholestage off 5391 5395 5 1.9 539.1 1.0X +months_between wholestage on 5353 5374 12 1.9 535.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 window: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -window wholestage off 2222 2308 122 0.5 2222.2 1.0X -window wholestage on 48721 48828 101 0.0 48720.7 0.0X +window wholestage off 2601 2709 152 0.4 2601.3 1.0X +window wholestage on 45767 45831 46 0.0 45767.4 0.1X ================================================================================================ @@ -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 2482 2503 30 4.0 248.2 1.0X -date_trunc YEAR wholestage on 2520 2532 12 4.0 252.0 1.0X +date_trunc YEAR wholestage off 2494 2506 17 4.0 249.4 1.0X +date_trunc YEAR wholestage on 2482 2499 12 4.0 248.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 date_trunc YYYY: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc YYYY wholestage off 2485 2504 26 4.0 248.5 1.0X +date_trunc YYYY wholestage on 2477 2489 9 4.0 247.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 YY: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc YY wholestage off 2492 2493 1 4.0 249.2 1.0X +date_trunc YY wholestage on 2468 2479 7 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 MON: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc MON wholestage off 2510 2523 19 4.0 251.0 1.0X +date_trunc MON wholestage on 2497 2503 9 4.0 249.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 MONTH: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc MONTH wholestage off 2509 2526 25 4.0 250.9 1.0X +date_trunc MONTH wholestage on 2495 2503 7 4.0 249.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 date_trunc MM: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc MM wholestage off 2513 2517 6 4.0 251.3 1.0X +date_trunc MM wholestage on 2494 2500 5 4.0 249.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 date_trunc DAY: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc DAY wholestage off 2415 2429 19 4.1 241.5 1.0X +date_trunc DAY wholestage on 2369 2379 7 4.2 236.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 DD: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc DD wholestage off 2403 2406 4 4.2 240.3 1.0X +date_trunc DD wholestage on 2372 2379 4 4.2 237.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 date_trunc HOUR: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc HOUR wholestage off 2394 2409 22 4.2 239.4 1.0X +date_trunc HOUR wholestage on 2344 2352 6 4.3 234.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 date_trunc MINUTE: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc MINUTE wholestage off 346 347 1 28.9 34.6 1.0X +date_trunc MINUTE wholestage on 365 370 5 27.4 36.5 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 382 386 6 26.2 38.2 1.0X -date_trunc SECOND wholestage on 379 382 5 26.4 37.9 1.0X +date_trunc SECOND wholestage off 377 392 21 26.5 37.7 1.0X +date_trunc SECOND wholestage on 361 363 2 27.7 36.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 WEEK: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc WEEK wholestage off 2428 2436 12 4.1 242.8 1.0X +date_trunc WEEK wholestage on 2405 2414 8 4.2 240.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 date_trunc QUARTER: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc QUARTER wholestage off 3705 3709 5 2.7 370.5 1.0X +date_trunc QUARTER wholestage on 3673 3682 8 2.7 367.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 trunc year: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +trunc year wholestage off 314 316 2 31.9 31.4 1.0X +trunc year wholestage on 315 323 6 31.7 31.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 trunc yyyy: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +trunc yyyy wholestage off 309 310 1 32.4 30.9 1.0X +trunc yyyy wholestage on 309 332 33 32.4 30.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 yy: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +trunc yy wholestage off 310 311 1 32.3 31.0 1.0X +trunc yy wholestage on 307 315 6 32.5 30.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 mon: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +trunc mon wholestage off 308 312 7 32.5 30.8 1.0X +trunc mon wholestage on 309 315 11 32.4 30.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 month: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +trunc month wholestage off 307 311 6 32.6 30.7 1.0X +trunc month wholestage on 308 312 3 32.4 30.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 mm: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +trunc mm wholestage off 307 308 2 32.6 30.7 1.0X +trunc mm wholestage on 307 313 6 32.6 30.7 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 166 167 2 6.0 165.7 1.0X -to timestamp str wholestage on 158 162 4 6.3 158.2 1.0X +to timestamp str wholestage off 173 174 1 5.8 173.1 1.0X +to timestamp str wholestage on 167 169 1 6.0 167.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 to_timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +to_timestamp wholestage off 1460 1461 2 0.7 1459.7 1.0X +to_timestamp wholestage on 1464 1472 13 0.7 1463.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 to_unix_timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +to_unix_timestamp wholestage off 1499 1500 3 0.7 1498.6 1.0X +to_unix_timestamp wholestage on 1448 1452 7 0.7 1447.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 to date str: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +to date str wholestage off 215 216 2 4.7 214.9 1.0X +to date str wholestage on 213 215 3 4.7 212.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 to_date: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +to_date wholestage off 3581 3596 22 0.3 3580.8 1.0X +to_date wholestage on 3629 3634 6 0.3 3629.0 1.0X ================================================================================================ @@ -422,9 +422,10 @@ 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/from Java's date-time: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +From java.sql.Date 435 439 3 11.5 87.1 1.0X +Collect dates 3409 3756 343 1.5 681.9 0.1X +From java.sql.Timestamp 350 351 1 14.3 70.1 1.2X +Collect longs 1316 1433 124 3.8 263.2 0.3X +Collect timestamps 1752 2013 231 2.9 350.4 0.2X diff --git a/sql/core/benchmarks/DateTimeBenchmark-results.txt b/sql/core/benchmarks/DateTimeBenchmark-results.txt index 77b6f833221e5..d4259a9e6c9b8 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 410 428 25 24.4 41.0 1.0X -cast to timestamp wholestage on 364 379 17 27.5 36.4 1.1X +cast to timestamp wholestage off 403 433 42 24.8 40.3 1.0X +cast to timestamp wholestage on 377 386 14 26.6 37.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 year of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +year of timestamp wholestage off 1327 1328 1 7.5 132.7 1.0X +year of timestamp wholestage on 1341 1368 23 7.5 134.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 quarter of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +quarter of timestamp wholestage off 1460 1468 11 6.9 146.0 1.0X +quarter of timestamp wholestage on 1396 1418 14 7.2 139.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 month of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +month of timestamp wholestage off 1232 1239 11 8.1 123.2 1.0X +month of timestamp wholestage on 1252 1267 14 8.0 125.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 weekofyear of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +weekofyear of timestamp wholestage off 1852 1853 0 5.4 185.2 1.0X +weekofyear of timestamp wholestage on 1865 1881 19 5.4 186.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 day of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +day of timestamp wholestage off 1224 1226 2 8.2 122.4 1.0X +day of timestamp wholestage on 1236 1250 9 8.1 123.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 dayofyear of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +dayofyear of timestamp wholestage off 1276 1276 1 7.8 127.6 1.0X +dayofyear of timestamp wholestage on 1287 1294 8 7.8 128.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 dayofmonth of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +dayofmonth of timestamp wholestage off 1225 1227 3 8.2 122.5 1.0X +dayofmonth of timestamp wholestage on 1234 1243 11 8.1 123.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 dayofweek of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +dayofweek of timestamp wholestage off 1398 1407 13 7.2 139.8 1.0X +dayofweek of timestamp wholestage on 1394 1401 6 7.2 139.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 1342 1350 12 7.5 134.2 1.0X -weekday of timestamp wholestage on 1311 1317 5 7.6 131.1 1.0X +weekday of timestamp wholestage off 1339 1345 9 7.5 133.9 1.0X +weekday of timestamp wholestage on 1333 1340 9 7.5 133.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 hour of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +hour of timestamp wholestage off 992 996 5 10.1 99.2 1.0X +hour of timestamp wholestage on 973 981 7 10.3 97.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 minute of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +minute of timestamp wholestage off 988 995 10 10.1 98.8 1.0X +minute of timestamp wholestage on 980 990 7 10.2 98.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 second of timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +second of timestamp wholestage off 1008 1013 8 9.9 100.8 1.0X +second of timestamp wholestage on 976 987 13 10.2 97.6 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 277 282 7 36.1 27.7 1.0X -current_date wholestage on 283 290 11 35.3 28.3 1.0X +current_date wholestage off 287 287 0 34.8 28.7 1.0X +current_date wholestage on 301 302 1 33.2 30.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 current_timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +current_timestamp wholestage off 292 295 5 34.3 29.2 1.0X +current_timestamp wholestage on 306 315 10 32.7 30.6 1.0X ================================================================================================ @@ -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 1064 1066 2 9.4 106.4 1.0X -cast to date wholestage on 1002 1010 8 10.0 100.2 1.1X +cast to date wholestage off 1062 1071 13 9.4 106.2 1.0X +cast to date wholestage on 1030 1039 13 9.7 103.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 last_day: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +last_day wholestage off 1282 1303 29 7.8 128.2 1.0X +last_day wholestage on 1257 1262 4 8.0 125.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 next_day: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +next_day wholestage off 1114 1120 9 9.0 111.4 1.0X +next_day wholestage on 1075 1085 8 9.3 107.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_add: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_add wholestage off 1056 1061 7 9.5 105.6 1.0X +date_add wholestage on 1057 1063 6 9.5 105.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_sub: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_sub wholestage off 1069 1080 15 9.4 106.9 1.0X +date_sub wholestage on 1056 1064 15 9.5 105.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 1371 1373 2 7.3 137.1 1.0X -add_months wholestage on 1402 1409 10 7.1 140.2 1.0X +add_months wholestage off 1367 1367 1 7.3 136.7 1.0X +add_months wholestage on 1432 1438 6 7.0 143.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 5741 5862 171 1.7 574.1 1.0X -format date wholestage on 5589 5600 19 1.8 558.9 1.0X +format date wholestage off 5900 5918 25 1.7 590.0 1.0X +format date wholestage on 6364 6393 34 1.6 636.4 0.9X ================================================================================================ @@ -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 8681 8684 4 1.2 868.1 1.0X -from_unixtime wholestage on 8669 8707 33 1.2 866.9 1.0X +from_unixtime wholestage off 8740 8753 18 1.1 874.0 1.0X +from_unixtime wholestage on 8689 8714 26 1.2 868.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 1096 1101 7 9.1 109.6 1.0X -from_utc_timestamp wholestage on 1108 1116 6 9.0 110.8 1.0X +from_utc_timestamp wholestage off 1086 1087 2 9.2 108.6 1.0X +from_utc_timestamp wholestage on 1168 1173 5 8.6 116.8 0.9X 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 1626 1638 16 6.1 162.6 1.0X -to_utc_timestamp wholestage on 1594 1606 10 6.3 159.4 1.0X +to_utc_timestamp wholestage off 1640 1642 3 6.1 164.0 1.0X +to_utc_timestamp wholestage on 1600 1612 20 6.2 160.0 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 331 335 6 30.2 33.1 1.0X -cast interval wholestage on 298 305 5 33.5 29.8 1.1X +cast interval wholestage off 329 330 2 30.4 32.9 1.0X +cast interval wholestage on 321 333 17 31.1 32.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 datediff: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -datediff wholestage off 1821 1822 2 5.5 182.1 1.0X -datediff wholestage on 1759 1763 3 5.7 175.9 1.0X +datediff wholestage off 1819 1820 1 5.5 181.9 1.0X +datediff wholestage on 1783 1789 6 5.6 178.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 months_between: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +months_between wholestage off 4791 4793 3 2.1 479.1 1.0X +months_between wholestage on 4739 4745 6 2.1 473.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 window: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -window wholestage off 1936 2049 160 0.5 1935.7 1.0X -window wholestage on 44821 44850 44 0.0 44820.6 0.0X +window wholestage off 1955 2108 217 0.5 1954.9 1.0X +window wholestage on 46222 46285 41 0.0 46222.1 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 2382 2384 3 4.2 238.2 1.0X -date_trunc YEAR wholestage on 2309 2316 7 4.3 230.9 1.0X +date_trunc YEAR wholestage off 2341 2343 3 4.3 234.1 1.0X +date_trunc YEAR wholestage on 2288 2298 8 4.4 228.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 date_trunc YYYY: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc YYYY wholestage off 2337 2338 2 4.3 233.7 1.0X +date_trunc YYYY wholestage on 2286 2295 7 4.4 228.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 YY: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc YY wholestage off 2339 2340 2 4.3 233.9 1.0X +date_trunc YY wholestage on 2288 2292 3 4.4 228.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 date_trunc MON: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc MON wholestage off 2308 2309 1 4.3 230.8 1.0X +date_trunc MON wholestage on 2348 2357 11 4.3 234.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 date_trunc MONTH: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc MONTH wholestage off 2316 2318 3 4.3 231.6 1.0X +date_trunc MONTH wholestage on 2346 2356 9 4.3 234.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 2328 2329 1 4.3 232.8 1.0X -date_trunc MM wholestage on 2290 2295 4 4.4 229.0 1.0X +date_trunc MM wholestage off 2313 2315 3 4.3 231.3 1.0X +date_trunc MM wholestage on 2348 2355 4 4.3 234.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 date_trunc DAY: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc DAY wholestage off 2162 2164 3 4.6 216.2 1.0X +date_trunc DAY wholestage on 2177 2183 4 4.6 217.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 DD: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc DD wholestage off 2162 2169 10 4.6 216.2 1.0X +date_trunc DD wholestage on 2178 2181 2 4.6 217.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 date_trunc HOUR: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc HOUR wholestage off 2230 2237 9 4.5 223.0 1.0X +date_trunc HOUR wholestage on 2242 2251 7 4.5 224.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 MINUTE: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc MINUTE wholestage off 367 373 8 27.2 36.7 1.0X +date_trunc MINUTE wholestage on 343 347 3 29.1 34.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 341 342 2 29.3 34.1 1.0X -date_trunc SECOND wholestage on 335 349 18 29.9 33.5 1.0X +date_trunc SECOND wholestage off 369 369 1 27.1 36.9 1.0X +date_trunc SECOND wholestage on 343 346 2 29.2 34.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 WEEK: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +date_trunc WEEK wholestage off 2238 2245 10 4.5 223.8 1.0X +date_trunc WEEK wholestage on 2222 2231 10 4.5 222.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 3180 3181 2 3.1 318.0 1.0X -date_trunc QUARTER wholestage on 3036 3043 12 3.3 303.6 1.0X +date_trunc QUARTER wholestage off 3092 3093 2 3.2 309.2 1.0X +date_trunc QUARTER wholestage on 3074 3077 4 3.3 307.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 trunc year: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +trunc year wholestage off 320 328 12 31.3 32.0 1.0X +trunc year wholestage on 344 365 18 29.1 34.4 0.9X 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 323 327 6 31.0 32.3 1.0X -trunc yyyy wholestage on 304 317 14 32.9 30.4 1.1X +trunc yyyy wholestage off 316 318 3 31.6 31.6 1.0X +trunc yyyy wholestage on 352 372 21 28.4 35.2 0.9X 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 324 325 2 30.8 32.4 1.0X -trunc yy wholestage on 308 311 3 32.4 30.8 1.1X +trunc yy wholestage off 313 314 1 31.9 31.3 1.0X +trunc yy wholestage on 346 364 27 28.9 34.6 0.9X 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 323 323 1 31.0 32.3 1.0X -trunc mon wholestage on 303 310 7 33.0 30.3 1.1X +trunc mon wholestage off 317 318 1 31.5 31.7 1.0X +trunc mon wholestage on 347 367 17 28.8 34.7 0.9X 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 322 323 0 31.0 32.2 1.0X -trunc month wholestage on 307 337 65 32.6 30.7 1.1X +trunc month wholestage off 320 321 1 31.2 32.0 1.0X +trunc month wholestage on 352 410 77 28.4 35.2 0.9X 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 324 325 2 30.9 32.4 1.0X -trunc mm wholestage on 294 306 7 34.0 29.4 1.1X +trunc mm wholestage off 315 318 5 31.8 31.5 1.0X +trunc mm wholestage on 353 382 29 28.3 35.3 0.9X ================================================================================================ @@ -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 216 216 1 4.6 215.7 1.0X -to timestamp str wholestage on 207 209 3 4.8 207.0 1.0X +to timestamp str wholestage off 217 221 5 4.6 217.3 1.0X +to timestamp str wholestage on 212 214 2 4.7 212.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_timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +to_timestamp wholestage off 1957 1964 11 0.5 1956.6 1.0X +to_timestamp wholestage on 1993 1998 9 0.5 1993.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_unix_timestamp: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +to_unix_timestamp wholestage off 2071 2073 3 0.5 2071.0 1.0X +to_unix_timestamp wholestage on 2082 2092 11 0.5 2082.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 date str: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +to date str wholestage off 262 262 0 3.8 261.7 1.0X +to date str wholestage on 258 261 4 3.9 258.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 to_date: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +to_date wholestage off 3551 3567 22 0.3 3550.7 1.0X +to_date wholestage on 3505 3513 9 0.3 3505.3 1.0X ================================================================================================ @@ -422,9 +422,10 @@ 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/from Java's date-time: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative ------------------------------------------------------------------------------------------------------------------------ -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 +From java.sql.Date 416 419 3 12.0 83.2 1.0X +Collect dates 1928 2759 1180 2.6 385.6 0.2X +From java.sql.Timestamp 383 397 12 13.0 76.7 1.1X +Collect longs 1324 1411 91 3.8 264.9 0.3X +Collect timestamps 1906 2040 185 2.6 381.2 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 5fa5b9b06a60b..0bb87b19b7a69 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 @@ -137,6 +137,11 @@ object DateTimeBenchmark extends SqlBasedBenchmark { .map(millis => new java.sql.Date(millis)) .noop() } + benchmark.addCase("Collect dates", numIters) { _ => + spark.range(0, rowsNum, 1, 1) + .map(millis => new java.sql.Date(millis)) + .collect() + } benchmark.addCase("From java.sql.Timestamp", numIters) { _ => spark.range(rowsNum) .map(millis => new Timestamp(millis))