vinodkc commented on code in PR #50558: URL: https://github.com/apache/spark/pull/50558#discussion_r2051098040
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/timeExpressions.scala: ########## @@ -297,6 +312,36 @@ object HourExpressionBuilder extends ExpressionBuilder { } } +case class SecondsOfTimeWithFraction(child: Expression) + extends RuntimeReplaceable + with ExpectsInputTypes { Review Comment: Done ########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/timeExpressions.scala: ########## @@ -297,6 +312,36 @@ object HourExpressionBuilder extends ExpressionBuilder { } } +case class SecondsOfTimeWithFraction(child: Expression) + extends RuntimeReplaceable + with ExpectsInputTypes { + + override def replacement: Expression = { + + StaticInvoke( + classOf[DateTimeUtils.type], + DecimalType(8, 6), + "getSecondsOfTimeWithFraction", + Seq(child, Literal(precision)), + Seq(child.dataType, IntegerType)) + } + private val precision: Int = child.dataType match { + case t: TimeType => t.precision + case _ => TimeType.MAX_PRECISION + } + override def inputTypes: Seq[AbstractDataType] = + Seq(TimeType(precision)) + + override def children: Seq[Expression] = Seq(child) + + override def prettyName: String = "secondoftime_with_fraction" Review Comment: Done -- 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