uros-b commented on code in PR #56932:
URL: https://github.com/apache/spark/pull/56932#discussion_r3587884918
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/timeExpressions.scala:
##########
@@ -623,6 +623,57 @@ case class MakeTime(
copy(hours = newChildren(0), minutes = newChildren(1), secsAndMicros =
newChildren(2))
}
+// scalastyle:off line.size.limit
+@ExpressionDescription(
+ usage = "_FUNC_(hour, minute, second) - Try to create time from hour, minute
and second fields. The function returns NULL on invalid inputs.",
+ arguments = """
+ Arguments:
+ * hour - the hour to represent, from 0 to 23
+ * minute - the minute to represent, from 0 to 59
+ * second - the second to represent, from 0 to 59.999999
+ """,
+ examples = """
+ Examples:
+ > SELECT _FUNC_(6, 30, 45.887);
+ 06:30:45.887
+ > SELECT _FUNC_(NULL, 30, 0);
+ NULL
+ > SELECT _FUNC_(25, 30, 0);
+ NULL
+ """,
+ group = "datetime_funcs",
+ since = "4.3.0")
+// scalastyle:on line.size.limit
+object TryMakeTimeExpressionBuilder extends ExpressionBuilder {
+ override def build(funcName: String, expressions: Seq[Expression]):
Expression = {
+ val numArgs = expressions.length
+ if (numArgs == 3) {
+ new TryMakeTime(expressions(0), expressions(1), expressions(2))
+ } else {
+ throw QueryCompilationErrors.wrongNumArgsError(funcName, Seq(3), numArgs)
Review Comment:
Do we have tests for this?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]