cloud-fan commented on a change in pull request #29731:
URL: https://github.com/apache/spark/pull/29731#discussion_r487709672



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
##########
@@ -658,6 +658,41 @@ abstract class CastBase extends UnaryExpression with 
TimeZoneAwareExpression wit
     }
   }
 
+  private[this] def stringToDecimal(str: UTF8String, decimalType: 
DecimalType): Decimal = {
+    val bigDecimal = try {
+      // According the benchmark test,  `s.toString.trim` is much faster than 
`s.trim.toString`.

Review comment:
       it sounds like `UTF8String.trim` is not implemented well. We may need to 
look at how `java.lang.String.trim` is implemented.




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

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