MaxGekk commented on code in PR #50269: URL: https://github.com/apache/spark/pull/50269#discussion_r2039329478
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/timeExpressions.scala: ########## @@ -349,3 +349,49 @@ object SecondExpressionBuilder extends ExpressionBuilder { } } + Review Comment: nit: unnecessary blank line. Please, remove it. ########## sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala: ########## @@ -291,14 +291,22 @@ private[sql] object QueryExecutionErrors extends QueryErrorsBase with ExecutionE def ansiDateTimeArgumentOutOfRange(e: Exception): SparkDateTimeException = { new SparkDateTimeException( - errorClass = "DATETIME_FIELD_OUT_OF_BOUNDS", + errorClass = "DATETIME_FIELD_OUT_OF_BOUNDS.WITH_SUGGESTION", messageParameters = Map( "rangeMessage" -> e.getMessage, "ansiConfig" -> toSQLConf(SQLConf.ANSI_ENABLED.key)), context = Array.empty, summary = "") } + def ansiDateTimeArgumentOutOfRangeWithoutSuggestion(e: Throwable): SparkDateTimeException = { + new SparkDateTimeException( Review Comment: Please, set `e` to `cause` in `SparkDateTimeException`. It might be helpful in debugging at user's side. ########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/timeExpressions.scala: ########## @@ -349,3 +349,49 @@ object SecondExpressionBuilder extends ExpressionBuilder { } } + +// scalastyle:off line.size.limit +@ExpressionDescription( + usage = "_FUNC_(hour, minute, second) - Create time from hour, minute and second fields. For invalid inputs it will throw an error.", + 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 + """, + group = "datetime_funcs", + since = "4.1.0") +// scalastyle:on line.size.limit +case class MakeTime( + hours: Expression, + minutes: Expression, + secsAndMicros: Expression) + extends RuntimeReplaceable + with ImplicitCastInputTypes + with ExpectsInputTypes { + + // Accept `sec` as DecimalType to avoid loosing precision of microseconds while converting Review Comment: Thank you for the comment. -- 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