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


##########
backends-clickhouse/src/main/scala/io/glutenproject/backendsapi/clickhouse/CHSparkPlanExecApi.scala:
##########
@@ -750,4 +750,8 @@ class CHSparkPlanExecApi extends SparkPlanExecApi {
   ): GenerateExecTransformerBase = {
     CHGenerateExecTransformer(generator, requiredChildOutput, outer, 
generatorOutput, child)
   }
+
+  override def genPreProjectForGenerate(generate: GenerateExec): SparkPlan = 
generate

Review Comment:
   At least for pre-project, CH and Velox are consistent; they can only execute 
expressions within the project operator. I think that the logic of pre-project 
can also be applied to CH at present, it's just that CH has not yet started to 
adapt `GeneratorExec` that include expressions. I think you can put 
`GeneratorExec` into `needsPreProject` for validation, and only apply the 
pull-out logic when the child is not an `Attribute`. This should not affect the 
current CH, and later, if CH wants to adapt GeneratorExec` with expressions, it 
can be directly reused.



##########
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:
   I think for non-`Attribute` cases, you can simply hand them over to the 
`replaceExpressionWithAttribute` method to handle, without the need to match 
the current cases only encountered in UTs. If other cases arise in the future, 
they can also be supported. If the new case is not yet supported by Gluten, it 
will only cause pre-project to fallback.



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