kz930 opened a new pull request, #8326:
URL: https://github.com/apache/texera/pull/8326

   ### What changes were proposed in this PR?
   
   A workflow can be read in the editor but not taken away, and this adds the 
seam for taking one away plus the first few operators through it.
   
   An operator says how it reads outside the engine by implementing 
`StandaloneCodeGenerator`, returning a block of pandas that names its inputs 
and outputs as `in1df` / `out1df`. The translator walks the plan in topological 
order, gives every output port a variable, substitutes those placeholders for 
whatever its upstreams were given, and prints the leaves. `inAlldf` stands for 
the whole list of upstreams: a variadic port takes as many links as the user 
draws, and any fixed count the operator wrote would be wrong for some workflow. 
An operator with no generator yet leaves a commented placeholder rather than a 
line that looks like it works, so the export is useful before the whole 
operator set implements it.
   
   `GET /workflow-to-python` on the compiling service returns the script for a 
plan it is given.
   
   Five operators implement it here, chosen to cover the shapes the translator 
has to handle rather than because they came first: Distinct is a plain 
single-input map, Limit reads a config value, Projection renames and reorders 
columns, Filter builds a predicate from a table of them, and Union is the 
variadic port. The rest of the operator set follows in later changes.
   
   `pyStringLiteral` renders a value as a Python literal with the escaping that 
keeps a quote or a newline in a column name from ending the literal early and 
changing the emitted program. These generators cannot use the runtime's decode 
expression, which needs an operator instance to decode through.
   
   ### Any related issues, documentation, discussions?
   
   Closes #8325
   
   ### How was this PR tested?
   
   `WorkflowToPythonTranslatorSpec` covers the substitution, which is where the 
operator's text meets the variables the script binds: a variadic port given 
one, two and three upstreams; the numbered placeholders resolving against a 
chain of ordinary operators; and the placeholder-free comment an operator 
without a generator leaves.
   
   Each of the five operators asserts the line it emits in its own spec, and 
`pyStringLiteral` has its own cases for every character that can close a 
literal, plus the null a column name can arrive as.
   
   `PyBuilder` and `WorkflowOperator` pass in full, 186 and 2528 tests.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 5)
   


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