mbutrovich commented on code in PR #4535:
URL: https://github.com/apache/datafusion-comet/pull/4535#discussion_r3414867882


##########
spark/src/test/scala/org/apache/spark/sql/comet/PlanDataInjectorSuite.scala:
##########
@@ -0,0 +1,53 @@
+/*
+ * 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.spark.sql.comet
+
+import org.scalatest.funsuite.AnyFunSuite
+
+import org.apache.comet.serde.OperatorOuterClass.Operator
+
+class PlanDataInjectorSuite extends AnyFunSuite {
+
+  test("injectPlanData leaves a non-scan operator tree unchanged") {
+    // An operator with no injectable scan (here, an empty op_struct, but the 
same holds for
+    // Filter/Projection/etc.) must pass through untouched. This exercises the 
O(1)
+    // injectorsByKind miss path (`case _ =>`) that replaced the per-injector 
canInject walk.
+    val child = Operator.newBuilder().setPlanId(2).build()
+    val root = Operator.newBuilder().setPlanId(1).addChildren(child).build()
+
+    val result = PlanDataInjector.injectPlanData(root, Map.empty, Map.empty)
+
+    assert(result == root, "non-scan operator tree should be returned 
unchanged")

Review Comment:
   The `injectPlanData leaves a non-scan operator tree unchanged` test asserts 
`result == root`, which is a good pass-through check. Worth being clear that 
the result still goes through `op.toBuilder` and `build()`, so this verifies 
protobuf equality after a rebuild rather than asserting the rebuild was 
skipped. Fine as a behavior test, just not an allocation-avoidance assertion.



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