Uh oh!
There was an error while loading. Please reload this page.
[SPARK-29371][SQL] Support interval field values with fractional parts - #26314
[SPARK-29371][SQL] Support interval field values with fractional parts#26314yaooqinn wants to merge 3 commits into
Conversation
yaooqinn
commented
Oct 30, 2019
| DateTimeUtils.MILLIS_PER_MINUTE * DateTimeUtils.MICROS_PER_MILLIS | ||
| final val DAYS_PER_MONTH: Byte = 30 | ||
| final val MICROS_PER_MONTH: Long = DAYS_PER_MONTH * DateTimeUtils.SECONDS_PER_DAY | ||
| final val MICROS_PER_MONTH: Long = DAYS_PER_MONTH * DateTimeUtils.MICROS_PER_DAY |
There was a problem hiding this comment.
ah good catch! do we have a test case?
| DateTimeUtils.MILLIS_PER_MINUTE * DateTimeUtils.MICROS_PER_MILLIS | ||
| final val DAYS_PER_MONTH: Byte = 30 | ||
| final val MICROS_PER_MONTH: Long = DAYS_PER_MONTH * DateTimeUtils.SECONDS_PER_DAY | ||
| final val MICROS_PER_MONTH: Long = DAYS_PER_MONTH * DateTimeUtils.MICROS_PER_DAY |
Uh oh!
There was an error while loading. Please reload this page.
dongjoon-hyun
commented
Oct 30, 2019
This PR had better have the one-line fix on |
SparkQA
commented
Oct 30, 2019
Test build #112906 has finished for PR 26314 at commit
|
SparkQA
commented
Oct 30, 2019
Test build #112910 has finished for PR 26314 at commit
|
SparkQA
commented
Oct 30, 2019
Test build #112903 has finished for PR 26314 at commit
|
yaooqinn
commented
Oct 30, 2019
With this pr, outside nanosecond will be omitted in silence as pg postgres=# select interval '.1111111111' second
postgres-# ;
interval
-----------------00:00:00.111111
(1 row) |
SparkQA
commented
Oct 30, 2019
Test build #112921 has finished for PR 26314 at commit
|
SparkQA
commented
Oct 31, 2019
Test build #112982 has finished for PR 26314 at commit
|
yaooqinn
commented
Oct 31, 2019
@MaxGekk@cloud-fan@dongjoon-hyun rebased with master, please take a look again.thanks. |
yaooqinn
commented
Oct 31, 2019
@MaxGekk Yes, thanks, will do a benchmark comparison right now. |
yaooqinn
commented
Oct 31, 2019
Before[info] JavaHotSpot(TM) 64-BitServerVM1.8.0_65-b17 on MacOSX10.14.6
[info] Intel(R) Core(TM) i5-5287U CPU@2.90GHz
[info] cast strings to intervals: BestTime(ms) AvgTime(ms) Stdev(ms) Rate(M/s) PerRow(ns) Relative
[info] ------------------------------------------------------------------------------------------------------------------------
[info] prepare string w/ interval 493566772.0493.01.0X
[info] prepare string w/o interval 410437322.4410.01.2X
[info] 1 units w/ interval 523753401220.25236.60.1X
[info] 1 units w/o interval 506351361230.25062.60.1X
[info] 2 units w/ interval 69646993280.16964.00.1X
[info] 2 units w/o interval 66386665380.26637.60.1X
[info] 3 units w/ interval 83448444880.18343.90.1X
[info] 3 units w/o interval 787780341660.17876.80.1X
[info] 4 units w/ interval 930694201000.19305.70.1X
[info] 4 units w/o interval 836386352390.18363.00.1X
[info] 5 units w/ interval 10037103403010.110036.60.0X
[info] 5 units w/o interval 10071101361070.110071.50.0X
[info] 6 units w/ interval 10818115246120.110818.50.0X
[info] 6 units w/o interval 10726112894900.110725.80.0X
[info] 7 units w/ interval 11498115731040.111498.10.0X
[info] 7 units w/o interval 1129211311280.111292.10.0X
[info] 8 units w/ interval 12792129281890.112792.40.0X
[info] 8 units w/o interval 1238712399120.112386.60.0X
[info] 9 units w/ interval 14307145413940.114307.50.0X
[info] 9 units w/o interval 1398614015490.113985.50.0XAFTER[info] JavaHotSpot(TM) 64-BitServerVM1.8.0_65-b17 on MacOSX10.14.6
[info] Intel(R) Core(TM) i5-5287U CPU@2.90GHz
[info] cast strings to intervals: BestTime(ms) AvgTime(ms) Stdev(ms) Rate(M/s) PerRow(ns) Relative
[info] ------------------------------------------------------------------------------------------------------------------------
[info] prepare string w/ interval 6437261081.6643.01.0X
[info] prepare string w/o interval 468501352.1468.41.4X
[info] 1 units w/ interval 50458939NaN0.25044.80.1X
[info] 1 units w/o interval 559158193790.25590.60.1X
[info] 2 units w/ interval 646269387650.26461.90.1X
[info] 2 units w/o interval 602261491470.26021.70.1X
[info] 3 units w/ interval 72237319900.17223.20.1X
[info] 3 units w/o interval 697270811520.16972.30.1X
[info] 4 units w/ interval 818083332620.18179.80.1X
[info] 4 units w/o interval 78177877940.17817.50.1X
[info] 5 units w/ interval 91719201290.19170.60.1X
[info] 5 units w/o interval 911995676840.19118.70.1X
[info] 6 units w/ interval 10255105384880.110255.20.1X
[info] 6 units w/o interval 10122106045430.110121.90.1X
[info] 7 units w/ interval 12154123342220.112153.50.1X
[info] 7 units w/o interval 1135211359100.111352.10.1X
[info] 8 units w/ interval 127741277860.112774.20.1X
[info] 8 units w/o interval 12627128914080.112627.20.1X
[info] 9 units w/ interval 14087142091840.114087.50.0X
[info] 9 units w/o interval 13856140433100.113855.90.0X |
yaooqinn
commented
Oct 31, 2019
@MaxGekk the performances look the same |
MaxGekk
commented
Oct 31, 2019
I modified slightly the benchmark and append fractions: diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/IntervalBenchmark.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/IntervalBenchmark.scala
index d75cb1040f..ec32340b2b 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/IntervalBenchmark.scala+++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/benchmark/IntervalBenchmark.scala@@ -83,8 +83,8 @@ object IntervalBenchmark extends SqlBasedBenchmark {
override def runBenchmarkSuite(mainArgs: Array[String]): Unit = {
val N = 1000000
val timeUnits = Seq(
- "13 months", "100 weeks", "9 days", "12 hours",- "5 minutes", "45 seconds", "123 milliseconds", "567 microseconds")+ "13.123 months", "100.123 weeks", "9.123 days", "12.123 hours",+ "5.123 minutes", "45.123 seconds", "123.456 milliseconds", "567 microseconds")
val intervalToTest = ListBuffer[String]()and the results look not so nice: The throughput is roughly ~10 interval strings with 8-9 units per second. |
yaooqinn
commented
Oct 31, 2019
the worst-case gives the worst result. also, my benchmark test shows no performance regression to existing cases. Personally, I am ok with the result. |
SparkQA
commented
Oct 31, 2019
Test build #113007 has finished for PR 26314 at commit
|
yaooqinn
commented
Oct 31, 2019
retest this please |
SparkQA
commented
Oct 31, 2019
Test build #113032 has finished for PR 26314 at commit
|
yaooqinn
commented
Nov 1, 2019
@MaxGekk is this per ms not per second? |
yaooqinn
commented
Nov 1, 2019
retest this please |
SparkQA
commented
Nov 1, 2019
Test build #113068 has finished for PR 26314 at commit
|
What changes were proposed in this pull request?
Support fraction representation fro interval field values.
Why are the changes needed?
In PostgreSQL, interval field values can have fractional parts. See https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT
Does this PR introduce any user-facing change?
yes, add fraction input support for interval values.
How was this patch tested?
add uts