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


##########
common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/aggregate/AggregationOperationSpec.scala:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.aggregate
+
+import org.apache.texera.amber.core.tuple.AttributeType
+import org.scalatest.flatspec.AnyFlatSpec
+
+class AggregationOperationSpec extends AnyFlatSpec {
+
+  private def operation(fn: AggregationFunction): AggregationOperation = {
+    val op = new AggregationOperation()
+    op.aggFunction = fn
+    op.attribute = "src"
+    op.resultAttribute = "out"
+    op
+  }
+
+  "AggregationOperation.getAggregationAttribute" should "preserve the input 
type for SUM" in {
+    val attr = 
operation(AggregationFunction.SUM).getAggregationAttribute(AttributeType.LONG)
+    assert(attr.getName == "out")
+    assert(attr.getType == AttributeType.LONG)
+  }
+
+  it should "always produce INTEGER for COUNT regardless of input type" in {
+    val attr = 
operation(AggregationFunction.COUNT).getAggregationAttribute(AttributeType.STRING)
+    assert(attr.getType == AttributeType.INTEGER)
+  }

Review Comment:
   These SUM/COUNT/CONCAT result-type assertions duplicate existing 
`getAggregationAttribute` tests in `AggregateOpSpec` (e.g., 
`AggregateOpSpec.scala:48-70`). To reduce duplicated coverage (and future 
maintenance if the mapping changes), consider either extending 
`AggregateOpSpec` with the missing cases (AVERAGE/MIN/MAX/null) or trimming 
this spec to only cover the currently-uncovered cases.



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