dongjoon-hyun commented on code in PR #40395:
URL: https://github.com/apache/spark/pull/40395#discussion_r1134938946


##########
connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/SQLImplicitsTestSuite.scala:
##########
@@ -130,9 +131,15 @@ class SQLImplicitsTestSuite extends ConnectFunSuite with 
BeforeAndAfterAll {
     testImplicit(BigDecimal(decimal))
     testImplicit(Date.valueOf(LocalDate.now()))
     testImplicit(LocalDate.now())
-    testImplicit(LocalDateTime.now())
-    testImplicit(Instant.now())
-    testImplicit(Timestamp.from(Instant.now()))
+    // SPARK-42770: Run `LocalDateTime.now()` and `Instant.now()` with Java 8 
& 11 always
+    // get microseconds on both Linux and MacOS, but there are some 
differences when
+    // using Java 17, it will get accurate nanoseconds on Linux, but still get 
the microseconds
+    // on MacOS. At present, Spark always converts them to microseconds, this 
will cause the
+    // test fail when using Java 17 on Linux, so add 
`truncatedTo(ChronoUnit.MICROS)` to
+    // there to ensure the accuracy of input data is microseconds.
+    testImplicit(LocalDateTime.now().truncatedTo(ChronoUnit.MICROS))
+    testImplicit(Instant.now().truncatedTo(ChronoUnit.MICROS))
+    testImplicit(Timestamp.from(Instant.now().truncatedTo(ChronoUnit.MICROS)))

Review Comment:
   Shall we apply this change for Java 17 only?



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