MaxGekk commented on code in PR #50296:
URL: https://github.com/apache/spark/pull/50296#discussion_r2005019421


##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/LiteralGenerator.scala:
##########
@@ -123,6 +124,18 @@ object LiteralGenerator {
       yield Literal.create(new Date(day * MILLIS_PER_DAY), DateType)
   }
 
+  private def timeMicrosGen: Gen[Long] = {
+    // Generate a random time represented as microseconds since midnight.
+    val minMicros = localTime()  // 00:00:00.000000
+    val maxMicros = localTime(23, 59, 59, 999999)  // 23:59:59.999999 in 
microseconds
+    Gen.choose(minMicros, maxMicros)
+  }
+
+  lazy val timeTypeLiteralGen: Gen[Literal] = {
+    for { micros <- timeMicrosGen }
+      yield Literal.create(micros, TimeType(6))  // Use microsecond precision
+  }

Review Comment:
   There is a separate task for this: 
https://issues.apache.org/jira/browse/SPARK-51455. How about to implement it in 
a separate PR, and test the existing expression: `ToTime`?



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