File tree Expand file tree Collapse file tree
catalyst/src/main/scala/org/apache/spark/sql/catalyst/util
core/src/test/scala/org/apache/spark/sql/execution/command Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -427,6 +427,12 @@ object IntervalUtils {
427427 state = TRIM_BEFORE_SIGN
428428 case TRIM_BEFORE_SIGN => trimToNextState(b, SIGN )
429429 case SIGN =>
430+ currentValue = 0
431+ fraction = 0
432+ // Sets the scale to an invalid value to track fraction presence
433+ // in the BEGIN_UNIT_NAME state
434+ fractionScale = - 1
435+ state = TRIM_BEFORE_VALUE
430436 b match {
431437 case '-' =>
432438 isNegative = true
@@ -436,14 +442,13 @@ object IntervalUtils {
436442 i += 1
437443 case _ if '0' <= b && b <= '9' =>
438444 isNegative = false
445+ case '.' =>
446+ isNegative = false
447+ i += 1
448+ fractionScale = (NANOS_PER_SECOND / 10 ).toInt
449+ state = VALUE_FRACTIONAL_PART
439450 case _ => exceptionWithState( s " Unrecognized sign ' $nextWord' " )
440451 }
441- currentValue = 0
442- fraction = 0
443- // Sets the scale to an invalid value to track fraction presence
444- // in the BEGIN_UNIT_NAME state
445- fractionScale = - 1
446- state = TRIM_BEFORE_VALUE
447452 case TRIM_BEFORE_VALUE => trimToNextState(b, VALUE )
448453 case VALUE =>
449454 b match {
Original file line number Diff line number Diff line change @@ -789,7 +789,7 @@ class DDLParserSuite extends AnalysisTest with SharedSparkSession {
789789 assertError(" select interval '23:61:15' hour to second" ,
790790 " minute 61 outside range [0, 59]" )
791791 assertError(" select interval '.1111111111' second" ,
792- " Invalid interval string " )
792+ " invalid value fractional part '1111111111' " )
793793 }
794794
795795 test(" use native json_tuple instead of hive's UDTF in LATERAL VIEW" ) {
You can’t perform that action at this time.
0 commit comments