cloud-fan commented on code in PR #58408:
URL: https://github.com/apache/spark/pull/58408#discussion_r3935947641


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala:
##########
@@ -2404,7 +2412,12 @@ case class FormatString(children: Expression*) extends 
Expression with ImplicitC
     val numArgLists = argListGen.length
     val argListCode = argListGen.zipWithIndex.map { case(v, index) =>
       val value =
-        if (CodeGenerator.boxedType(v._1) != CodeGenerator.javaType(v._1)) {
+        if (UserDefinedType.sqlType(v._1).isInstanceOf[DecimalType]) {

Review Comment:
   **Non-blocking (P2):** `FormatString` accepts `AnyDataType`, so an 
object-typed Spark `Decimal` can reach this branch, for example through 
`Literal.fromObject(Decimal("1.5"))`. The interpreted path converts that 
runtime value and formats `%f` successfully, but this declared-type check 
leaves generated code passing Spark `Decimal` to `Formatter`, which throws 
`IllegalFormatConversionException`. Please cover this admitted `ObjectType` 
case in generated conversion as well and add an interpreted/codegen regression 
with an object-typed decimal literal.



-- 
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]

Reply via email to