You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/02/24 10:53:17 UTC

[GitHub] MaxGekk commented on a change in pull request #23878: [SPARK-26978][CORE] Avoid magic time constants

MaxGekk commented on a change in pull request #23878: [SPARK-26978][CORE] Avoid magic time constants
URL: https://github.com/apache/spark/pull/23878#discussion_r259614470
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/GroupStateImpl.scala
 ##########
 @@ -178,7 +179,7 @@ private[sql] class GroupStateImpl[S] private(
       throw new IllegalArgumentException(s"Provided duration ($duration) is not positive")
     }
 
-    val millisPerMonth = CalendarInterval.MICROS_PER_DAY / 1000 * 31
+    val millisPerMonth = TimeUnit.MICROSECONDS.toMillis(CalendarInterval.MICROS_PER_DAY) * 31
 
 Review comment:
   Unfortunately, there is no `MONTHS.toMillis`. 
   
   > or just make the conversion in the next line directly?
   
   It seems there is no way to perform the conversion directly because conversion of milliseconds to "estimated" chrono units (starting from days) is not supported in `java.time`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org