liujiayi771 commented on code in PR #4952:
URL: https://github.com/apache/incubator-gluten/pull/4952#discussion_r1531484022


##########
backends-velox/src/main/scala/io/glutenproject/backendsapi/velox/SparkPlanExecApiImpl.scala:
##########
@@ -659,4 +662,81 @@ class SparkPlanExecApiImpl extends SparkPlanExecApi {
   ): GenerateExecTransformerBase = {
     GenerateExecTransformer(generator, requiredChildOutput, outer, 
generatorOutput, child)
   }
+
+  override def genPreProjectForGenerate(generate: GenerateExec): SparkPlan = {
+    if (supportsGenerate(generate)) {
+      val newGeneratorChild = 
generate.generator.asInstanceOf[UnaryExpression].child match {
+        case attr: Attribute => attr
+        case expr @ (Literal(_, _) | CreateMap(_, _) | CreateArray(_, _)) =>
+          Alias(expr, generatePreAliasName)()
+        case other =>
+          throw new UnsupportedOperationException(

Review Comment:
   @marin-ma Do you mean to say that if `Generator.child` is a 
`BoundReference`, it also needs to be wrapped with an Alias? 
   The `BoundReference` within `replaceExpressionWithAttribute` is a special 
optimization case that was initially placed within the `case other`. I think if 
that's the only reason, we could add a parameter to 
`replaceExpressionWithAttribute` named `replaceBoundReference: Boolean`, with 
the default value of false. The `Generator` could set this to true. Then it 
could be changed to case `e: BoundReference if !replaceBoundReference => e`.



-- 
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: commits-unsubscr...@gluten.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@gluten.apache.org
For additional commands, e-mail: commits-h...@gluten.apache.org

Reply via email to