Repository navigation
A control-variable port on every operator: design and prototype #8915
Replies: 4 comments 6 replies
|
How do you decide which operator properties can resolve at runtime, especially when properties like CSV file paths affect compile time schema inference? And how are the bound values checked against the property’s expected type? |
|
Can you give more examples on what are control-variables ? |
|
I like this. Having one optional port on every operator is a lot cleaner than adding a "from input" version of each operator that needs a run-time value, and the folder example makes the use case easy to see. Since the port is optional, existing workflows and anyone who doesn't need control variables won't notice a difference. One suggestion I have is about the limit where only the first tuple reaching the port is converted and the rest are dropped. If someone accidentally connects a multi-row table, they'd silently get results from the first row. Could we show a warning when more than one tuple arrives on the port? |
|
I support this design. It's based on many offline discussions with @aglinxinyuan and @Xiao-zhen-Liu in the context of adding "control block" to the system. |

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Every operator gets one more input port, the control-variable port, drawn in purple. Whatever arrives on it becomes the operator's control variables, and a property that holds
$nametakes the value of the variablename. An existing operator can then run once per loop iteration on a value computed upstream. Today File Scan needs a second "from input" operator for this.A prototype that runs end to end is on
aglinxinyuan/texera:control-variable-port, with draft PR #8917.Example: read every file of a folder
File Scan is a source. Its only change is that it resolves the file name at run time, once
$fileis bound. In each iteration, Loop Start's Output setsfileto that iteration's path and Loop Start sends{i, file}into File Scan's port. File Scan binds$file, opens that file, and its rows flow on to Loop End.Design
table.iloc[[i]]works as before.Prototype
PortIdentity(-1). The compiler adds it only when a link targets it.D. Output runs once per iteration, before Loop Start sends its variables, so the body and the port see what it assigns.PASTA's search needs no change. The prototype adds the port link to
getBlockingAndDependeeLinks, so the sender's region runs before the receiver's. The receiver's own data edge can still be pipelined.End-to-end test.
ControlVariablePortIntegrationSpecruns the example over three files that hold the numbers 1 to 2, 3 to 5 and 6, one per line: once withfileset in Output as above, and once with it set in Initialization and Update. Loop End receives1through6both times, in CI on Linux and macOS. The workflow also runs in a local deployment.Limits
$filethere is no file yet.All reactions