This is an automated email from the ASF dual-hosted git repository.

srowen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new f9f9309  [SPARK-31579][SQL] replaced floorDiv to Div
f9f9309 is described below

commit f9f9309bec4bac33a182046ccedabef4234e8f77
Author: Sudharshann D <sudhar...@gmail.com>
AuthorDate: Sat Jul 18 13:04:58 2020 -0500

    [SPARK-31579][SQL] replaced floorDiv to Div
    
    ### What changes were proposed in this pull request?
    
    Replaced  floorDiv to just / in `localRebaseGregorianToJulianDays()` in 
`spark/sql/catalyst/util/RebaseDateTime.scala`
    
    ### Why are the changes needed?
    
    Easier to understand the logic/code and a little more efficiency.
    
    ### Does this PR introduce _any_ user-facing change?
    
    NO
    
    ### How was this patch tested?
    
    Proof of concept [here](https://github.com/apache/spark/pull/28573/files). 
The operation `utcCal.getTimeInMillis / MILLIS_PER_DAY` results in an interger 
value already.
    
    Closes #29008 from Sudhar287/SPARK-31579.
    
    Authored-by: Sudharshann D <sudhar...@gmail.com>
    Signed-off-by: Sean Owen <sro...@gmail.com>
---
 .../main/scala/org/apache/spark/sql/catalyst/util/RebaseDateTime.scala | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/RebaseDateTime.scala
 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/RebaseDateTime.scala
index 24fe9fa..1a78422 100644
--- 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/RebaseDateTime.scala
+++ 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/RebaseDateTime.scala
@@ -186,7 +186,8 @@ object RebaseDateTime {
       .setTimeZone(TimeZoneUTC)
       .setDate(localDate.getYear, localDate.getMonthValue - 1, 
localDate.getDayOfMonth)
       .build()
-    Math.toIntExact(Math.floorDiv(utcCal.getTimeInMillis, MILLIS_PER_DAY))
+    assert(utcCal.getTimeInMillis % MILLIS_PER_DAY == 0)
+    Math.toIntExact(utcCal.getTimeInMillis / MILLIS_PER_DAY)
   }
 
   /**


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to