Copilot commented on code in PR #5813:
URL: https://github.com/apache/texera/pull/5813#discussion_r3444978627


##########
common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/dictionary/DictionaryMatcherOpDescSpec.scala:
##########
@@ -0,0 +1,103 @@
+/*
+ * 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.texera.amber.operator.dictionary
+
+import org.apache.texera.amber.core.executor.OpExecWithClassName
+import org.apache.texera.amber.core.tuple.{Attribute, AttributeType, Schema}
+import org.apache.texera.amber.core.virtualidentity.{ExecutionIdentity, 
WorkflowIdentity}
+import org.apache.texera.amber.core.workflow.PortIdentity
+import org.apache.texera.amber.operator.LogicalOp
+import org.apache.texera.amber.operator.metadata.OperatorGroupConstants
+import org.apache.texera.amber.util.JSONUtils.objectMapper
+import org.scalatest.flatspec.AnyFlatSpec
+import org.scalatest.matchers.should.Matchers
+
+class DictionaryMatcherOpDescSpec extends AnyFlatSpec with Matchers {
+
+  private val workflowId = WorkflowIdentity(1L)
+  private val executionId = ExecutionIdentity(1L)
+
+  private def newDesc(
+      dict: String,
+      attr: String,
+      result: String,
+      mt: MatchingType
+  ): DictionaryMatcherOpDesc = {
+    val d = new DictionaryMatcherOpDesc
+    d.dictionary = dict
+    d.attribute = attr
+    d.resultAttribute = result
+    d.matchingType = mt
+    d
+  }
+
+  "DictionaryMatcherOpDesc.operatorInfo" should
+    "advertise the name, Search group, and reconfiguration support" in {
+    val info = (new DictionaryMatcherOpDesc).operatorInfo
+    info.userFriendlyName shouldBe "Dictionary matcher"
+    info.operatorGroupName shouldBe OperatorGroupConstants.SEARCH_GROUP
+    info.operatorDescription.toLowerCase should include("dictionary")
+    info.inputPorts should have length 1
+    info.outputPorts should have length 1
+    info.supportReconfiguration shouldBe true
+  }
+
+  "DictionaryMatcherOpDesc.getPhysicalOp" should "wire the 
DictionaryMatcherOpExec class name" in {
+    val physical =
+      newDesc("a,b,c", "word", "matched", MatchingType.SCANBASED)
+        .getPhysicalOp(workflowId, executionId)
+    physical.opExecInitInfo match {
+      case OpExecWithClassName(className, descString) =>
+        className shouldBe 
"org.apache.texera.amber.operator.dictionary.DictionaryMatcherOpExec"
+        descString should not be empty
+      case other => fail(s"expected OpExecWithClassName, got $other")
+    }
+  }

Review Comment:
   The PR description says the `getPhysicalOp` tests pin that the physical op 
carries forward ports from `operatorInfo`, but this test only checks 
`opExecInitInfo`. Adding assertions on the physical op’s input/output port 
identities would better match the stated contract and reduce drift risk.



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

Reply via email to