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 2020/06/22 07:18:25 UTC

[GitHub] [spark] MaxGekk commented on a change in pull request #28886: [SPARK-32043][SQL] Replace Decimal by Int op in `make_interval` and `make_timestamp`

MaxGekk commented on a change in pull request #28886:
URL: https://github.com/apache/spark/pull/28886#discussion_r443360334



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala
##########
@@ -1994,13 +1994,17 @@ case class MakeTimestamp(
       day: Int,
       hour: Int,
       min: Int,
-      secAndNanos: Decimal,
+      secAndMicros: Decimal,
       zoneId: ZoneId): Any = {
     try {
-      val secFloor = secAndNanos.floor
-      val nanosPerSec = Decimal(NANOS_PER_SECOND, 10, 0)
-      val nanos = ((secAndNanos - secFloor) * nanosPerSec).toInt
-      val seconds = secFloor.toInt
+      assert(secAndMicros.scale == 6,

Review comment:
       > I am assuming that it changes the Decimal's scale to 6
   
   This assert doesn't change the scale, it just reads it.
   
   > And is the added tail just a bunch of zeros? For instance does 3.14 become 3.140000?
   
   It shifts the decimal point. For example, if you have 3.14 with precision 6 and scale 3 that means 003.140. If you set
   - scale to 0, it becomes 3140
   - scale to 4 -> 0.314




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



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