philo-he commented on code in PR #13626:
URL: https://github.com/apache/gluten/pull/13626#discussion_r4780689501


##########
backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:
##########
@@ -278,8 +284,7 @@ object ColumnarPartialProjectExec {
   val dummyPrefix = "_dummy"
 
   def validateExpression(expr: Expression): Boolean = {
-    expr.deterministic && !expr.isInstanceOf[LambdaFunction] && expr.children
-      .forall(validateExpression)
+    expr.deterministic

Review Comment:
   Nit: this is now just `expr.deterministic`, which already checks children. 
It could be inlined at the call sites.



##########
backends-velox/src/main/scala/org/apache/gluten/execution/ColumnarPartialProjectExec.scala:
##########
@@ -167,12 +167,19 @@ case class ColumnarPartialProjectExec(projectList: 
Seq[Expression], child: Spark
     val a2c = longMetric("arrow_to_velox_time")
     child.executeColumnar().mapPartitions {
       batches =>
-        val res: Iterator[Iterator[ColumnarBatch]] = new 
Iterator[Iterator[ColumnarBatch]] {
-          // select part of child output and child data
-          val projection: MutableProjection =
-            MutableProjection.create(replacedAlias, projectAttributes.toSeq)
+        val projectRow: InternalRow => InternalRow = {
+          val inputAttributes = projectAttributes.toSeq
+          val projection = MutableProjection.create(replacedAlias, 
inputAttributes)
           projection.initialize(TaskContext.getPartitionId())
-
+          if (replacedAlias.exists(_.exists(_.isInstanceOf[LambdaFunction]))) {
+            // Lambda evaluation needs null-aware array access, which 
ColumnarArray.get lacks.
+            // TODO: Remove this conversion once all supported Spark versions 
handle null elements
+            // correctly in ColumnarArray.get.

Review Comment:
   This TODO suggests a future Spark fix, but `ColumnarArray.get` passes 
`handleNull = false` in every version up to Spark master, and vanilla Spark 
never evaluates lambdas on `ColumnarArray`. Could you describe the conversion 
as required and drop the TODO?



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