aglinxinyuan commented on code in PR #4206: URL: https://github.com/apache/texera/pull/4206#discussion_r3346336493
########## common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/loop/LoopStartOpDesc.scala: ########## @@ -0,0 +1,80 @@ +/* + * 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.loop + +import com.fasterxml.jackson.annotation.JsonProperty +import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle +import org.apache.texera.amber.core.executor.OpExecWithCode +import org.apache.texera.amber.core.virtualidentity.{ExecutionIdentity, WorkflowIdentity} +import org.apache.texera.amber.core.workflow.{InputPort, OutputPort, PhysicalOp} +import org.apache.texera.amber.operator.LogicalOp +import org.apache.texera.amber.operator.metadata.{OperatorGroupConstants, OperatorInfo} + +class LoopStartOpDesc extends LogicalOp { + @JsonProperty(required = true, defaultValue = "i = 0") + @JsonSchemaTitle("Initialization") + var initialization: String = _ + + @JsonProperty(required = true, defaultValue = "table.iloc[i]") + @JsonSchemaTitle("Output") + var output: String = _ Review Comment: Addressed across 411d92f67 (plus the earlier loop_counter / LoopStartId / LoopStartStateURI moves). The reserved names no longer share the user exec namespace: - `loop_counter`, `LoopStartId`, `LoopStartStateURI` are now entirely off `State` -- they ride the `StateFrame` envelope as their own materialized columns, owned by the runtime, so they never appear in `self.state` and user code cannot touch them. - `table` and `output`: each user expression (`initialization` / `output` / `update` / `condition`) now runs in a throwaway namespace seeded with the user loop variables plus the input `table`; `output` is read back out of it, and only the user variables are persisted into `self.state`. So `table` stays readable, but neither reserved name can persist in -- or be silently clobbered out of -- the loop state. A user writing `loop_counter = 0`, `table = ...`, etc. in their loop code can therefore no longer overwrite loop machinery. The exec logic lives in tested LoopStart/LoopEnd base helpers (`eval_output` / `run_update` / `eval_condition`); the generated operators just delegate. -- 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]
