michaelmitchell-bit commented on code in PR #56999:
URL: https://github.com/apache/spark/pull/56999#discussion_r3562722456
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala:
##########
@@ -2631,15 +2631,37 @@ case class ParseToDate(
override def children: Seq[Expression] = left +: format.toSeq
+ private def inputTypeForDate: AbstractDataType = {
+ TypeCollection(
+ StringTypeWithCollation(supportsTrimCollation = true),
+ DateType,
+ TimestampType,
+ TimestampNTZType)
+ }
+
override def inputTypes: Seq[AbstractDataType] = {
// Note: ideally this function should only take string input, but we allow
more types here to
// be backward compatible.
- TypeCollection(
- StringTypeWithCollation(supportsTrimCollation = true),
- DateType,
- TimestampType,
- TimestampNTZType) +:
- format.map(_ => StringTypeWithCollation(supportsTrimCollation =
true)).toSeq
+ inputTypeForDate +: format.map(_ =>
+ StringTypeWithCollation(supportsTrimCollation = true)).toSeq
+ }
+
+ override def checkInputDataTypes(): TypeCheckResult = {
+ def timeInput(expression: Expression): Option[Expression] = expression
match {
+ case Cast(child, _, _, _) if child.dataType.isInstanceOf[TimeType] =>
Some(child)
Review Comment:
Thanks, updated 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]