mihailom-db commented on code in PR #49340: URL: https://github.com/apache/spark/pull/49340#discussion_r1901859685
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ToStringBase.scala: ########## @@ -52,6 +52,19 @@ trait ToStringBase { self: UnaryExpression with TimeZoneAwareExpression => @inline private def acceptAny[T](func: T => UTF8String): Any => UTF8String = i => func(i.asInstanceOf[T]) + protected final def castToChar(from: DataType, length: Int): Any => UTF8String = from match { + case _: StringType => acceptAny(o => CharVarcharCodegenUtils.charTypeWriteSideCheck(o, length)) + case _ => o => CharVarcharCodegenUtils.charTypeWriteSideCheck( Review Comment: Won't CastCoercion eliminate the need for this case? Shouldn't we fail in this case? -- 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