jackylee-ch commented on code in PR #7476:
URL: https://github.com/apache/incubator-gluten/pull/7476#discussion_r1812008029


##########
backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:
##########
@@ -730,20 +730,28 @@ class VeloxSparkPlanExecApi extends SparkPlanExecApi {
       case FloatType | DoubleType | _: DecimalType =>
         c.child.dataType match {
           case StringType =>

Review Comment:
   ```suggestion
             case StringType if GlutenConfig.getConf.castFromVarcharAddTrimNode 
=>
                 val trimNode = StringTrim(c.child, Some(Literal(trimSpaceStr)))
                 c.withNewChildren(Seq(trimNode)).asInstanceOf[Cast]
   ```



##########
backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxSparkPlanExecApi.scala:
##########
@@ -730,20 +730,28 @@ class VeloxSparkPlanExecApi extends SparkPlanExecApi {
       case FloatType | DoubleType | _: DecimalType =>
         c.child.dataType match {
           case StringType =>
-            val trimNode = StringTrim(c.child, Some(Literal(trimSpaceStr)))
-            c.withNewChildren(Seq(trimNode)).asInstanceOf[Cast]
+            if (GlutenConfig.getConf.castFromVarcharAddTrimNode) {
+              val trimNode = StringTrim(c.child, Some(Literal(trimSpaceStr)))
+              c.withNewChildren(Seq(trimNode)).asInstanceOf[Cast]
+            } else {
+              c
+            }
           case _ =>
             c
         }
       case _ =>
         c.child.dataType match {
           case StringType =>

Review Comment:
   ```suggestion
             case StringType if GlutenConfig.getConf.castFromVarcharAddTrimNode 
=>
                 val trimNode = StringTrim(
                   c.child,
                   Some(
                     Literal(trimWhitespaceStr +
                       trimSpaceSepStr + trimLineSepStr + trimParaSepStr)))
                 c.withNewChildren(Seq(trimNode)).asInstanceOf[Cast]
   ```



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