Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
800f6e5
Strict fromDayTimeString
MaxGekk Nov 11, 2019
8cf38db
Add tests
MaxGekk Nov 11, 2019
3a1a710
Update tests in IntervalUtilsSuite
MaxGekk Nov 11, 2019
4e051d6
Fix ExpressionParserSuite
MaxGekk Nov 11, 2019
a1ef591
Add tests for invalid input into literals.sql
MaxGekk Nov 11, 2019
e88c8e0
Regen interval.sql.out
MaxGekk Nov 11, 2019
c87cf8c
Add the config spark.sql.legacy.fromDayTimeString.enabled
MaxGekk Nov 12, 2019
3f66881
Restore previous version of fromDayTimeString
MaxGekk Nov 12, 2019
da9b801
Restore old tests in IntervalUtilsSuite
MaxGekk Nov 12, 2019
c8afd33
Enable legacy behavior for postgresql tests
MaxGekk Nov 12, 2019
988d532
Regen interval.sql.out
MaxGekk Nov 12, 2019
ce28745
Set LEGACY_FROM_DAYTIME_STRING to true in ThriftServerQueryTestSuite
MaxGekk Nov 12, 2019
58ba7b4
Address Wenchen's review comment about a test
MaxGekk Nov 12, 2019
60fe0c1
Add comments for parseDayTimeLegacy
MaxGekk Nov 12, 2019
e95068e
Avoid unnecessary catching of exceptions
MaxGekk Nov 12, 2019
880e7ed
Add comments for parseDayTime()
MaxGekk Nov 12, 2019
d00c95d
Merge remote-tracking branch 'remotes/origin/master' into strict-from…
MaxGekk Nov 12, 2019
a37bad4
Regen literals.sql.out
MaxGekk Nov 12, 2019
8e733c1
Remove exact ops
MaxGekk Nov 12, 2019
6b5b7ef
Update the SQL migration guide
MaxGekk Nov 12, 2019
a2ce9ae
Merge remote-tracking branch 'remotes/origin/master' into strict-from…
MaxGekk Nov 13, 2019
fc77452
Merge remote-tracking branch 'remotes/origin/master' into strict-from…
MaxGekk Nov 15, 2019
6be5f4e
truncation -> truncated
MaxGekk Nov 15, 2019
d253094
Make the config internal
MaxGekk Nov 15, 2019
dfd0dce
Use the legacy method in the PostgreSQL dialect
MaxGekk Nov 15, 2019
d1145cd
Update the SQL migration guide
MaxGekk Nov 15, 2019
c94f1df
Reorganize tests in interval.sql
MaxGekk Nov 15, 2019
833c7b0
Regen interval.sql.out
MaxGekk Nov 15, 2019
5b26335
Check in the PostgreSQL dialect as well
MaxGekk Nov 17, 2019
f401bd2
Black list interval.sql in ThriftServerQueryTestSuite
MaxGekk Nov 17, 2019
ca46f44
Set settings explicitly in tests
MaxGekk Nov 19, 2019
eadaa92
Merge remote-tracking branch 'remotes/origin/master' into strict-from…
MaxGekk Nov 19, 2019
8f10259
Regen interval.sql.out
MaxGekk Nov 19, 2019
d3d730a
Merge remote-tracking branch 'remotes/origin/master' into strict-from…
MaxGekk Nov 20, 2019
32b4d2f
Regen interval.sql.out
MaxGekk Nov 20, 2019
e39ca52
Merge remote-tracking branch 'remotes/origin/master' into strict-from…
MaxGekk Nov 22, 2019
e012f8b
Remove explicit set
MaxGekk Nov 22, 2019
73ef32f
Regen interval.sql.out
MaxGekk Nov 22, 2019
d27d434
Merge remote-tracking branch 'remotes/origin/master' into strict-from…
MaxGekk Nov 22, 2019
9d8394e
Merge remote-tracking branch 'remotes/origin/master' into strict-from…
MaxGekk Dec 10, 2019
ef2cbe1
Remove usage of usePostgreSQLDialect
MaxGekk Dec 10, 2019
f9510e3
Regen interval.sql.out
MaxGekk Dec 10, 2019
c16f2a7
Replace 999999999 by 123456789 in seconds fractions in tests
MaxGekk Dec 11, 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
Add comments for parseDayTimeLegacy
  • Loading branch information
MaxGekk committed Nov 12, 2019
commit 60fe0c134c5e84132be309c1d3717110bef534bc
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,28 @@ object IntervalUtils {
*/
def fromDayTimeString(input: String, from: IntervalUnit, to: IntervalUnit): CalendarInterval = {
if (SQLConf.get.getConf(SQLConf.LEGACY_FROM_DAYTIME_STRING)) {
fromDayTimeLegacy(input, from, to)
parseDayTimeLegacy(input, from, to)
} else {
fromDayTime(input, from, to)
parseDayTime(input, from, to)
}
}

private val dayTimePatternLegacy =
"^([+|-])?((\\d+) )?((\\d+):)?(\\d+):(\\d+)(\\.(\\d+))?$".r

private def fromDayTimeLegacy(
/**
* Legacy method of parsing a string in a day-time format. It ignores the `from` bound,
* and takes into account only the `to` bound by truncating the result. For example,
* if the input string is "2 12:30:15", `from` is "hour" and `to` is "second", the result
* is "2 days 12 hours 30 minutes".
*
* @param input The day-time string
* @param from The interval units from which the input strings begins
* @param to The interval units at which the input string ends
* @return an instance of `CalendarInterval` if parsing completes successfully otherwise
* the exception `IllegalArgumentException` is raised.
*/
private def parseDayTimeLegacy(
input: String,
from: IntervalUnit,
to: IntervalUnit): CalendarInterval = {
Expand Down Expand Up @@ -281,7 +293,7 @@ object IntervalUtils {
(start.id to end.id).map(IntervalUnit(_))
}

private def fromDayTime(
private def parseDayTime(
input: String,
from: IntervalUnit,
to: IntervalUnit): CalendarInterval = {
Expand Down