File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed 
main/scala/org/apache/spark/sql/catalyst/util 
test/scala/org/apache/spark/sql/catalyst/util Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -851,7 +851,7 @@ object DateTimeUtils {
851851  }
852852
853853  /**  
854-    * Lookup the offset for given millis seconds since 1970-01-01 00:00:00 in a  timezone. 
854+    * Lookup the offset for given millis seconds since 1970-01-01 00:00:00 in given  timezone. 
855855   */  
856856  private  def  getOffsetFromLocalMillis (millisLocal : Long , tz : TimeZone ):  Long  =  {
857857    var  guess  =  tz.getRawOffset
Original file line number Diff line number Diff line change @@ -524,10 +524,22 @@ class DateTimeUtilsSuite extends SparkFunSuite {
524524  }
525525
526526  test(" daysToMillis and millisToDays" 
527-      for  (tz <-  DateTimeTestUtils .ALL_TIMEZONES ) {
527+     //  There are some days are skipped entirely in some timezone, skip them here.
528+     val  skipped_days  =  Map [String , Int ](
529+       " Kwajalein" ->  8632 ,
530+       " Pacific/Apia" ->  15338 ,
531+       " Pacific/Enderbury" ->  9131 ,
532+       " Pacific/Fakaofo" ->  15338 ,
533+       " Pacific/Kiritimati" ->  9131 ,
534+       " Pacific/Kwajalein" ->  8632 ,
535+       " MIT" ->  15338 )
536+     for  (tz <-  DateTimeTestUtils .ALL_TIMEZONES ) {
528537      DateTimeTestUtils .withDefaultTimeZone(tz) {
529-         (- 2000  to 2000 ).foreach { d => 
530-           assert(millisToDays(daysToMillis(d)) ===  d)
538+         val  skipped  =  skipped_days.getOrElse(tz.getID, Int .MinValue )
539+         (- 20000  to 20000 ).foreach { d => 
540+           if  (d !=  skipped) {
541+             assert(millisToDays(daysToMillis(d)) ===  d)
542+           }
531543        }
532544      }
533545    }
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments