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


##########
amber/src/test/scala/org/apache/texera/amber/engine/architecture/worker/promisehandlers/EndChannelHandlerSpec.scala:
##########
@@ -0,0 +1,446 @@
+/*
+ * 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.engine.architecture.worker.promisehandlers
+
+import com.twitter.util.{Await, Duration, Future}
+import org.apache.texera.amber.core.executor.OperatorExecutor
+import org.apache.texera.amber.core.state.State
+import org.apache.texera.amber.core.tuple.{
+  AttributeType,
+  FinalizeExecutor,
+  FinalizePort,
+  Schema,
+  Tuple,
+  TupleLike
+}
+import org.apache.texera.amber.core.virtualidentity.{
+  ActorVirtualIdentity,
+  ChannelIdentity,
+  OperatorIdentity,
+  PhysicalOpIdentity
+}
+import org.apache.texera.amber.core.workflow.{PhysicalLink, PortIdentity}
+import org.apache.texera.amber.engine.architecture.rpc.controlcommands.{
+  AsyncRPCContext,
+  ConsoleMessageTriggeredRequest,
+  ControlInvocation,
+  EmptyRequest
+}
+import 
org.apache.texera.amber.engine.architecture.rpc.controlreturns.EmptyReturn
+import 
org.apache.texera.amber.engine.architecture.sendsemantics.partitionings.OneToOnePartitioning
+import org.apache.texera.amber.engine.architecture.worker.WorkflowWorker.{
+  DPInputQueueElement,
+  MainThreadDelegateMessage
+}
+import org.apache.texera.amber.engine.architecture.worker.{
+  DataProcessor,
+  DataProcessorRPCHandlerInitializer,
+  OperatorLogicPause,
+  UserPause
+}
+import org.apache.texera.amber.engine.common.ambermessage.{StateFrame, 
WorkflowFIFOMessage}
+import org.apache.texera.amber.engine.common.virtualidentity.util.COORDINATOR
+import org.scalatest.flatspec.AnyFlatSpec
+
+import java.util.concurrent.LinkedBlockingQueue
+import scala.collection.mutable.ArrayBuffer
+import scala.util.control.ControlThrowable
+
+/**
+  * `endChannel` runs on a worker when the END_CHANNEL embedded control 
message reaches it, i.e.
+  * when one input channel has delivered everything it will ever deliver. It 
is the mirror of
+  * [[StartChannelHandlerSpec]]'s handler and does four things:
+  *

Review Comment:
   Scaladoc says the handler "does four things" but the list enumerates five 
steps (1–5). This is internally inconsistent and can confuse readers.



##########
amber/src/test/scala/org/apache/texera/amber/engine/architecture/messaginglayer/RangeBasedShuffleSpec.scala:
##########
@@ -126,7 +136,74 @@ class RangeBasedShuffleSpec extends AnyFlatSpec with 
MockFactory {
     val longSchema: Schema = Schema().add(longAttr)
     tuple = Tuple.builder(longSchema).add(longAttr, -90L).build()
     idx = partitioner3.getBucketIndex(tuple)
-    assert(idx.next() == 1)
+    assert(idx.toList == List(1))
+  }
+
+  "RangeBasedShuffleSpec" should "refuse a range attribute it cannot widen to 
a Long" in {
+    // Only LONG / INTEGER / DOUBLE reach the bucket arithmetic. Anything else 
has to fail loudly:
+    // `fieldVal` starts at -1, so a silently skipped type would route every 
tuple of that column
+    // to bucket 0 (below rangeMin) instead of spreading it, and the sort a 
RangePartition exists
+    // to enable would be wrong rather than absent.
+    val stringAttr: Attribute = new Attribute("Attr4", AttributeType.STRING)
+    // Two range attributes, the unsupported one FIRST. Only 
`rangeAttributeNames.head` is
+    // consulted, so a partitioner that reached for any other name would find 
the INTEGER column
+    // and bucket the tuple instead of refusing it -- which for the one 
production declarer
+    // (SortPartitionsOpDesc) means routing by an unintended column rather 
than failing.
+    val stringSchema: Schema = Schema().add(stringAttr).add(attr)
+    val partitioning4: RangeBasedShufflePartitioning =
+      RangeBasedShufflePartitioning(
+        400,
+        List(
+          ChannelIdentity(identifier, fakeID1, isControl = false),
+          ChannelIdentity(identifier, fakeID2, isControl = false)
+        ),
+        Seq("Attr4", "Attr1"),
+        -400,
+        600
+      )
+    val partitioner4: RangeBasedShufflePartitioner = 
RangeBasedShufflePartitioner(partitioning4)
+    val tuple = Tuple.builder(stringSchema).add(stringAttr, "100").add(attr, 
5).build()
+
+    val failure = 
intercept[RuntimeException](partitioner4.getBucketIndex(tuple))
+
+    // The message names the offending *type*, not the attribute: "Attr4" 
would not tell the user
+    // what about the column is unsupported.
+    assert(failure.getMessage == "unsupported attribute type: string")
+  }
+
+  "RangeBasedShuffleSpec" should "collapse a receiver its channels name twice" 
in {

Review Comment:
   Test name has a grammatical error ("collapse a receiver its channels name 
twice"), which makes failure output harder to read.



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