Xiao-zhen-Liu commented on code in PR #8640:
URL: https://github.com/apache/texera/pull/8640#discussion_r4286439116


##########
frontend/src/app/workspace/util/loop-block.util.ts:
##########
@@ -0,0 +1,144 @@
+/**
+ * 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.
+ */
+
+import { OperatorLink, OperatorPredicate } from 
"../types/workflow-common.interface";
+
+/** The operator types that open and close a loop block, as the backend names 
them. */
+export const LOOP_START_OP_TYPE = "LoopStart";
+export const LOOP_END_OP_TYPE = "LoopEnd";
+
+type BlockOperator = Pick<OperatorPredicate, "operatorID" | "operatorType">;
+type BlockLink = {
+  source: Pick<OperatorLink["source"], "operatorID">;
+  target: Pick<OperatorLink["target"], "operatorID">;
+};
+
+/**
+ * For each operator inside a loop block, the Loop Starts of the blocks it is 
inside, outermost first; an
+ * operator outside every block is absent. A port of the backend's 
LogicalPlan.enclosingLoopStarts: an
+ * operator is inside a block when it is on a path Loop Start -> ... -> 
operator -> ... -> Loop End whose
+ * two ends match, and the Loop Starts around it are those with a path to it 
on which no Loop End closes
+ * their block (a Loop End closes the innermost block the path opened). A Loop 
Start or Loop End is not
+ * inside its own block, but an inner block's are inside the outer one. The 
backend's LogicalPlanSpec and
+ * this port's spec run the same cases (loop-blocks.json), so the two agree.

Review Comment:
   Nit: this copy runs only the 22 cases in loop-blocks.json, while the 
backend's copy is also checked on 400 random graphs. Writing some of those 
random graphs and their answers into the shared file would check both copies on 
them.



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