martin-g commented on code in PR #2791:
URL: https://github.com/apache/datafusion-comet/pull/2791#discussion_r2532926789


##########
spark/src/main/scala/org/apache/comet/serde/CometMakeDecimal.scala:
##########
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.comet.serde
+
+import org.apache.spark.sql.catalyst.expressions.{Attribute, MakeDecimal}
+import org.apache.spark.sql.types.DecimalType
+
+import org.apache.comet.serde.QueryPlanSerde.{exprToProtoInternal, 
optExprWithInfo, scalarFunctionExprToProtoWithReturnType}
+
+object CometMakeDecimal extends CometExpressionSerde[MakeDecimal] {
+  override def convert(
+      expr: MakeDecimal,
+      inputs: Seq[Attribute],
+      binding: Boolean): Option[ExprOuterClass.Expr] = {
+    val childExpr = exprToProtoInternal(expr.child, inputs, binding)
+    val optExpr = scalarFunctionExprToProtoWithReturnType(
+      "make_decimal",
+      DecimalType(expr.precision, expr.scale),
+      false,

Review Comment:
   ```suggestion
         !expr.nullOnOverflow,
   ```



##########
docs/source/user-guide/latest/configs.md:
##########
@@ -289,6 +291,7 @@ These settings can be used to determine which parts of the 
plan are accelerated
 | `spark.comet.expression.Remainder.enabled`                 | Enable Comet 
acceleration for `Remainder`                 | true          |
 | `spark.comet.expression.Reverse.enabled`                   | Enable Comet 
acceleration for `Reverse`                   | true          |
 | `spark.comet.expression.Round.enabled`                     | Enable Comet 
acceleration for `Round`                     | true          |
+| `spark.comet.expression.ScalarSubquery.enabled`            | Enable Comet 
acceleration for `ScalarSubquery`            | true          |
 | `spark.comet.expression.Second.enabled`                    | Enable Comet 
acceleration for `Second`                    | true          |
 | `spark.comet.expression.Sha1.enabled`                      | Enable Comet 
acceleration for `Sha1`                      | true          |
 | `spark.comet.expression.Sha2.enabled`                      | Enable Comet 
acceleration for `Sha2`                      | true          |

Review Comment:
   There is no new entry for UnscaledValue



##########
spark/src/main/scala/org/apache/comet/serde/CometBloomFilterMightContain.scala:
##########
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.comet.serde
+
+import org.apache.spark.sql.catalyst.expressions.{Attribute, 
BloomFilterMightContain}
+
+import org.apache.comet.CometSparkSessionExtensions.withInfo
+import org.apache.comet.serde.QueryPlanSerde.exprToProtoInternal
+
+object CometBloomFilterMightContain extends 
CometExpressionSerde[BloomFilterMightContain] {
+
+  override def convert(
+      expr: BloomFilterMightContain,
+      inputs: Seq[Attribute],
+      binding: Boolean): Option[ExprOuterClass.Expr] = {
+
+    val bloomFilter = expr.left
+    val value = expr.right
+    val bloomFilterExpr = exprToProtoInternal(bloomFilter, inputs, binding)
+    val valueExpr = exprToProtoInternal(value, inputs, binding)
+    if (bloomFilterExpr.isDefined && valueExpr.isDefined) {

Review Comment:
   nit: Pattern matching is a bit more idiomatic:
   
   ```suggestion
       (bloomFilterExpr, valueExpr) match {
         case (Some(bf), Some(v)) =>
   ```



##########
spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala:
##########
@@ -204,17 +203,16 @@ object QueryPlanSerde extends Logging with CometExprShim {
   private val miscExpressions: Map[Class[_ <: Expression], 
CometExpressionSerde[_]] = Map(
     // TODO PromotePrecision
     // TODO KnownFloatingPointNormalized
-    // TODO ScalarSubquery
     // TODO UnscaledValue

Review Comment:
   ```suggestion
       classOf[UnscaledValue] -> CometUnscaledValue
   ```



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