Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b22f243
Generate benchmark results for JDK 8
MaxGekk Oct 24, 2019
c33710f
Generate benchmark results for JDK 11
MaxGekk Oct 24, 2019
ffa1bee
Initial implementation
MaxGekk Oct 25, 2019
a4c16a1
Add tests to IntervalUtilsSuite
MaxGekk Oct 25, 2019
f249f49
Optimize unit name matching
MaxGekk Oct 25, 2019
d077c87
Catch ArithmeticException
MaxGekk Oct 25, 2019
80f5a06
Generate benchmark results for JDK 8
MaxGekk Oct 25, 2019
479d5bd
Generate benchmark results for JDK 11
MaxGekk Oct 25, 2019
d68f41e
Merge remote-tracking branch 'remotes/origin/master' into string-to-i…
MaxGekk Oct 29, 2019
8e8e539
Merge remote-tracking branch 'remotes/origin/master' into string-to-i…
MaxGekk Nov 2, 2019
9dfb45d
Rebase on interval with days
MaxGekk Nov 2, 2019
8c3fb28
Merge remote-tracking branch 'remotes/origin/master' into string-to-i…
MaxGekk Nov 6, 2019
bc006a2
Refactor IntervalUtilsSuite to check fromString and stringToInterval
MaxGekk Nov 6, 2019
7515981
Bug fix: expect space after interval
MaxGekk Nov 6, 2019
78a2e8e
Use checkFromInvalidString
MaxGekk Nov 6, 2019
f61e6f8
Improve the multiple units test
MaxGekk Nov 6, 2019
dd8f2d1
Add a few units to the test
MaxGekk Nov 6, 2019
1204656
Return CalendarInterval from stringToInterval()
MaxGekk Nov 6, 2019
a2d91c3
Support fraction of seconds
MaxGekk Nov 6, 2019
94bd39b
Fix for negative values
MaxGekk Nov 6, 2019
98dd44f
Checks only second can have fractions
MaxGekk Nov 6, 2019
0cd7e88
Regen benchmark results for JDK 8
MaxGekk Nov 6, 2019
107d16c
Regen benchmark results for JDK 11
MaxGekk Nov 6, 2019
8dd9518
Address Wenchen's comments + change behavior for fractions
MaxGekk Nov 6, 2019
464eacc
Improve comments
MaxGekk Nov 6, 2019
dbad971
Unify structure
MaxGekk Nov 6, 2019
527b00e
Remove exact functions in fraction parsing
MaxGekk Nov 6, 2019
5e96a0e
Replace magic numbers
MaxGekk Nov 6, 2019
2222f13
Replace 100000000 by NANOS_PER_SECOND / 10
MaxGekk Nov 6, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove exact functions in fraction parsing
  • Loading branch information
MaxGekk committed Nov 6, 2019
commit 527b00e8b9f9af334a981544b903a3840805f83f
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ object IntervalUtils {
case FRACTIONAL_PART =>
b match {
case _ if '0' <= b && b <= '9' && fractionScale > 0 =>
fraction = Math.addExact(fraction, Math.multiplyExact(fractionScale, (b - '0')))
fraction += (b - '0') * fractionScale
fractionScale /= 10
case ' ' =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about 1. hour and 1. second?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spark-sql> select cast('1. seconds' as interval);
interval 1 seconds
spark-sql> select cast('1. days' as interval);
interval 1 days

fraction /= DateTimeUtils.NANOS_PER_MICROS.toInt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class IntervalUtilsSuite extends SparkFunSuite {
checkFromString("1 minute 1.001001 seconds", new CalendarInterval(0, 0, 61001001))
checkFromString("-1.5 seconds", new CalendarInterval(0, 0, -1500000))
// truncate nanoseconds to microseconds
checkFromString("0.123456789 seconds", new CalendarInterval(0, 0, 123456))
checkFromString("0.999999999 seconds", new CalendarInterval(0, 0, 999999))
checkFromInvalidString("0.123456789123 seconds", "Error parsing interval string")
}

Expand Down