gene-db commented on code in PR #50270:
URL: https://github.com/apache/spark/pull/50270#discussion_r1999683793


##########
sql/api/src/main/scala/org/apache/spark/sql/catalyst/util/SparkDateTimeUtils.scala:
##########
@@ -116,6 +116,16 @@ trait SparkDateTimeUtils {
     Instant.ofEpochSecond(secs, mos * NANOS_PER_MICROS)
   }
 
+  /**
+   * Obtains an instance of `java.time.Instant` using nanoseconds from the 
epoch of 1970-01-01
+   * 00:00:00Z.
+   */
+  def nanosToInstant(nanos: Long): Instant = {

Review Comment:
   How is this different from the other one in `Variant`, that uses:
   ```
   Instant.EPOCH.plus(timestamp, ChronoUnit.NANOS)
   ```



##########
common/variant/src/main/java/org/apache/spark/types/variant/Variant.java:
##########
@@ -325,6 +330,14 @@ static void toJsonImpl(byte[] value, byte[] metadata, int 
pos, StringBuilder sb,
       case DATE:
         appendQuoted(sb, LocalDate.ofEpochDay((int) VariantUtil.getLong(value, 
pos)).toString());
         break;
+      case TIMESTAMP_NANOS:
+        appendQuoted(sb, TIMESTAMP_FORMATTER.format(

Review Comment:
   Does the existing formatter handle the nanos?



-- 
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.

To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to