andygrove commented on code in PR #2270:
URL: https://github.com/apache/datafusion-comet/pull/2270#discussion_r2319134255


##########
spark/src/main/scala/org/apache/comet/serde/conditional.scala:
##########
@@ -91,3 +91,48 @@ object CometCaseWhen extends CometExpressionSerde[CaseWhen] {
     }
   }
 }
+
+object CometCoalesce extends CometExpressionSerde[Coalesce] {
+  override def convert(
+      expr: Coalesce,
+      inputs: Seq[Attribute],
+      binding: Boolean): Option[ExprOuterClass.Expr] = {
+    val branches = expr.children.dropRight(1).map { child =>
+      (IsNotNull(child), child)
+    }
+    val elseValue = Some(expr.children.last)
+    var allBranches: Seq[Expression] = Seq()

Review Comment:
   `allBranches` seems to be redundant. It ends up being populated with the 
same contents as `branches`, but in a different order. It is then only used in 
a `withInfo` call when falling back to Spark, so the order there shouldn't 
matter. I think we could just use `branches` there instead.



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