uros-db commented on code in PR #46041: URL: https://github.com/apache/spark/pull/46041#discussion_r1573842165
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CollationTypeCasts.scala: ########## @@ -52,6 +52,12 @@ object CollationTypeCasts extends TypeCoercionRule { overlay.withNewChildren(collateToSingleType(Seq(overlay.input, overlay.replace)) ++ Seq(overlay.pos, overlay.len)) + case stringPadExpr@(_: StringLPad | _: StringRPad) => + val newChildren = collateToSingleType( + Seq(stringPadExpr.children.head, stringPadExpr.children(2))) + stringPadExpr.withNewChildren( + Seq(newChildren.head, stringPadExpr.children(1), newChildren(1))) Review Comment: ```suggestion val Seq(str, len, pad) = stringPadExpr.children val Seq(newStr, newPad) = collateToSingleType(Seq(str, pad)) stringPadExpr.withNewChildren(Seq(newStr, len, newPad)) ``` note: the previous approach will require having 2 separate cases ``` case stringLPad: StringLPad => case stringRPad: StringRPad => ``` but if you do want to preserve the single case, try something like the second approach -- 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