marin-ma commented on code in PR #4952:
URL: https://github.com/apache/incubator-gluten/pull/4952#discussion_r1531479331
##########
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:
Here's the implementation in the initial commit. Could you help to check if
that matches your expectation?
https://github.com/apache/incubator-gluten/pull/4952/commits/c3529b8a050fd40db18624c09f8c20e514934e03#diff-c49dd56d8ac0d29278ad2e6a33cc0cb97d86a4c74d3e5c011bad4733ba1203feR186-R195
The reason of giving up using `replaceExpressionWithAttribute` is that this
function also matches `BouldReference`, which is not the case used by
`Generator.child`, and the output cannot be directly used as the input to
pre-project. The new child should be either the original `Attribute`, or an
`Alias` to other expressions.
I would think removing the type list `@ (Literal(_, _) | CreateMap(_, _) |
CreateArray(_, _))` here is a better way.
--
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]