Skip to content

test(verify): run a Python operator the way the engine runs it - #8357

Merged
aglinxinyuan merged 23 commits into
apache:mainfrom
kz930:feat/verify-run-operator-python
Nov 17, 2026
Merged

aglinxinyuan merged 23 commits into
apache:mainfrom
kz930:feat/verify-run-operator-python

Conversation

@kz930

@kz930 kz930 commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

A Python operator is not called; it is handed to an interpreter that imports
the generated module and drives it through the same open, process and close
the engine uses. PyOpExecHarness writes that module, starts the driver, and
reads back what the operator emitted.

The driver is the engine's side of the contract written out plainly: it is
what makes the answer this side produces the engine's answer rather than an
approximation of it.

A timestamp reaches the operator the way the engine hands one to a Python worker: a naive datetime at microsecond resolution. It is read without pandas, so a year past 2262 arrives intact. That is the zoneless microsecond Arrow type #8704 makes the engine send.

A port that carried no rows reaches the operator with its declared columns, as #8766 makes the engine hand them. The driver declares each input port's schema right before that port finishes, where the worker does.

Eight lines of build.sbt are unrelated to the export and fixed while this change is in the file: File Service's test grouping read its fork options inside the lambda, which sbt hoists anyway, so the warning it printed on every build said the code meant something it did not.

Any related issues, documentation, discussions?

Part of #8325, 4 of 27; that issue lists the set in order.

Closes #8409, the task this change is the whole of.

How was this PR tested?

The tests in this change cover it. PyOpExecHarnessSpec also checks that a row the output schema does not describe is refused. It also checks that 2500-01-01 00:00:00.123456789 reaches the operator as 2500-01-01 00:00:00.123456. It also checks that a port that carried no rows hands the operator its declared columns. Without the driver's change the operator sees a table with no columns. The whole set is exercised together once the last piece lands: every operator run through the engine and through its generated script, and the two answers compared.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 5, Claude Opus 5.5)

A Python operator is not called; it is handed to an interpreter that imports
the generated module and drives it through the same open, process and close
the engine uses. `PyOpExecHarness` writes that module, starts the driver, and
reads back what the operator emitted.

The driver is the engine's side of the contract written out plainly: it is
what makes the answer this side produces the engine's answer rather than an
approximation of it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@github-actions github-actions Bot added feature dependencies Pull requests that update a dependency file common platform Non-amber Scala service paths labels Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @Xiao-zhen-Liu
    You can notify them by mentioning @Xiao-zhen-Liu in a comment.

@codecov-commenter

codecov-commenter commented Sep 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.79%. Comparing base (2f0089f) to head (3ea81b5).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8357      +/-   ##
============================================
- Coverage     91.79%   91.79%   -0.01%     
  Complexity     5020     5020              
============================================
  Files          1274     1274              
  Lines         56301    56301              
  Branches       7352     7352              
============================================
- Hits          51682    51681       -1     
  Misses         2766     2766              
- Partials       1853     1854       +1     
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø)
agent-service 99.53% <ø> (ø) Carriedforward from 379f9a7
amber 85.75% <ø> (ø)
computing-unit-managing-service 64.05% <ø> (ø)
config-service 87.61% <ø> (ø)
file-service 82.29% <ø> (ø)
frontend 96.53% <ø> (-0.01%) ⬇️ Carriedforward from 379f9a7
notebook-migration-service 83.77% <ø> (ø)
pyamber 98.46% <ø> (ø) Carriedforward from 379f9a7
workflow-compiling-service 77.95% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

🟢 2 better · 🔴 5 worse · ⚪ 8 noise (<±5%) · 0 without baseline

Compared against main 7d05326 benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
🔴 bs=10 sw=10 sl=64 428 0.261 22,240/30,358/30,358 us 🔴 +11.9% / 🔴 +114.0%
🟢 bs=100 sw=10 sl=64 955 0.583 103,175/122,306/122,306 us 🟢 -19.1% / 🔴 +26.9%
🔴 bs=1000 sw=10 sl=64 1,100 0.671 896,174/1,093,499/1,093,499 us 🔴 +19.6% / 🔴 +19.1%
Baseline details

Latest main 7d05326 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 428 tuples/sec 484 tuples/sec 880.16 tuples/sec -11.6% -51.4%
bs=10 sw=10 sl=64 MB/s 0.261 MB/s 0.295 MB/s 0.537 MB/s -11.5% -51.4%
bs=10 sw=10 sl=64 p50 22,240 us 19,883 us 11,544 us +11.9% +92.7%
bs=10 sw=10 sl=64 p95 30,358 us 29,355 us 14,186 us +3.4% +114.0%
bs=10 sw=10 sl=64 p99 30,358 us 29,355 us 17,122 us +3.4% +77.3%
bs=100 sw=10 sl=64 throughput 955 tuples/sec 975 tuples/sec 1,151 tuples/sec -2.1% -17.0%
bs=100 sw=10 sl=64 MB/s 0.583 MB/s 0.595 MB/s 0.703 MB/s -2.0% -17.0%
bs=100 sw=10 sl=64 p50 103,175 us 98,817 us 89,900 us +4.4% +14.8%
bs=100 sw=10 sl=64 p95 122,306 us 151,130 us 96,346 us -19.1% +26.9%
bs=100 sw=10 sl=64 p99 122,306 us 151,130 us 110,344 us -19.1% +10.8%
bs=1000 sw=10 sl=64 throughput 1,100 tuples/sec 1,122 tuples/sec 1,189 tuples/sec -2.0% -7.5%
bs=1000 sw=10 sl=64 MB/s 0.671 MB/s 0.685 MB/s 0.726 MB/s -2.0% -7.6%
bs=1000 sw=10 sl=64 p50 896,174 us 892,395 us 873,675 us +0.4% +2.6%
bs=1000 sw=10 sl=64 p95 1,093,499 us 914,670 us 918,440 us +19.6% +19.1%
bs=1000 sw=10 sl=64 p99 1,093,499 us 914,670 us 953,075 us +19.6% +14.7%
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,467.25,200,128000,428,0.261,22239.82,30358.10,30358.10
1,100,10,64,20,2094.44,2000,1280000,955,0.583,103174.84,122305.50,122305.50
2,1000,10,64,20,18186.94,20000,12800000,1100,0.671,896173.84,1093499.27,1093499.27

Eight lines this change is already in the file for. sbt lifts a `.value`
written inside a lambda to the top of the task, so the options were read once
rather than per suite either way; written where they were, they said the other
thing, and sbt warned on it in every build.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
kz930 added a commit to Nicoleee1108/texera_workflow_to_py that referenced this pull request Sep 3, 2026
Matches apache#8357, which carries this upstream. sbt lifts a `.value` written
inside a lambda to the top of the task, so the options were read once either
way; written where they were, they said the other thing.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
kz930 and others added 2 commits September 3, 2026 15:11
The two helpers here were a second copy of OpExecHarness's, carrying a note that
they were kept inline so each harness read on its own and would be consolidated
if a third arrived. Two copies of the same twenty lines is already the cost that
note was deferring: they have to be changed together, and nothing says so at
either site.

Preparing the plan does not vary with the executor, so it happens once now. What
differs between the harnesses stays here: how the prepared op is run.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Three kinds of comment came out. A drawing of the string the code below
assembles. A restatement of a branch the reader can see. And the word MVP,
which dated the scope to a moment rather than stating it.

What replaces them says the same thing shorter, or says what the code cannot:
which cases the harness does not drive and why none of them has an operator
asking for it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

@carloea2 carloea2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Python operator harness looks good.

@kz930
kz930 marked this pull request as draft September 4, 2026 17:44
`PhysicalPlan` is named only by `getPhysicalPlan` and by a comment, so scalafix
reports the import and the check fails before any test runs.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

@carloea2 carloea2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unused import was removed. Looks good.

@carloea2 carloea2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed alongside the related export and verification PRs. These findings are based on code inspection and focused Python checks, not a full Scala suite run.

The driver projected the operator's output onto the schema's attribute
names and coerced each value with int/float/str. That is looser than the
engine, which hands every yielded value to all_output_to_tuple and
finalizes the result: an operator putting 1.5 in an INTEGER field, or a
row with a field the schema does not have, or one missing a field, all
raise there and none of the three raised here. A reference path that
accepts output the engine rejects cannot say what the engine would do,
so call the engine's own two functions instead of re-deriving them.

finalize pickles a BINARY field's object itself and tags it, where the
standalone side pickles the same object untagged, so drop the tag on the
way out and both sides carry the same payload.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

@carloea2 carloea2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Further review with local regression tests and connected execution checks.

kz930 and others added 2 commits September 10, 2026 13:02
The driver collected everything the operator yielded and converted the
list afterwards. `DataProcessor` reads a yield where it happens, turning
it into tuples and finalizing them on the spot, so a UDF that yields one
dict twice and changes it in between is recorded as the two values it
produced. The driver recorded the last one twice.

The operator now takes a callback and hands each value over at the
yield, before the generator is advanced.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
DataProcessor writes each input port's schema into the executor before
calling on_finish, so a TableOperator handed no rows can still say what
its columns were. The driver stands in for DataProcessor here, so it has
to do the same or the reference path answers on a frame of no columns
where the engine answers on the declared ones.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@kz930
kz930 requested a review from carloea2 October 13, 2026 05:42
…iter does

json.dumps writes a bare Infinity, which is not JSON; the engine's writer spells
it as text. A NaN still leaves as null, as the worker casts it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kz930

kz930 commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

@carloea2 Two commits since your review: the executor gets each finished port's declared schema, and a Python operator writes infinities as the engine does. Could you take another look?

@carloea2 carloea2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retested the updated input-schema and infinity handling on fresh upstream main. All 8 PyOpExecHarnessSpec tests and scalafmtCheckAll pass with the declared SDK, executor-schema and Arrow-type APIs supplied locally. No new harness finding. Code looks good; the prerequisite PRs and CI still need clearing. Keeping the draft unchanged.

@kz930
kz930 marked this pull request as ready for review November 9, 2026 07:13

@carloea2 carloea2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This conflicts with current main in build.sbt. Please keep both the DAO test-fixture dependency and the WorkflowOperator test-class dependency when rebasing.

@kz930

kz930 commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

Merged main and kept both the DAO and WorkflowOperator test dependencies.

@carloea2 carloea2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rebase keeps both test dependencies. All 8 PyOpExecHarnessSpec tests and scalafmtCheckAll pass locally. CI is green.

@aglinxinyuan

Copy link
Copy Markdown
Contributor

Can you explain in high level why do we need this PR? What's the limitation of the original design that scala runs the python code?

@kz930

kz930 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

A Python operator only runs inside a Python worker, and starting the engine's full worker stack for every operator in a test is too heavy. This PR runs the generated Python in a small driver that mimics the worker, so the visualization and ML operators can be verified too.

@aglinxinyuan aglinxinyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Nov 17, 2026
Merged via the queue into apache:main with commit bf930b7 Nov 17, 2026
34 checks passed
@kz930
kz930 deleted the feat/verify-run-operator-python branch November 17, 2026 18:08
renovate-bot pushed a commit to renovate-bot/apache-_-texera that referenced this pull request Nov 18, 2026
### What changes were proposed in this PR?

The other side of the comparison. `StandaloneRunner` writes the script
the
operator's generator emits, binds its inputs to the files the fixture
wrote,
runs it, and reads the frames it leaves behind.

The script is kept where it ran, so an operator whose two answers differ
can
be opened as generated rather than described second-hand.

A DOUBLE column holds four values a float64 frame cannot tell apart:
NaN, both infinities and -0.0, beside a null. The script writes each the
way the engine's writer does, where `to_json` wrote the first three as
null and -0.0 as 0.0. An input column holding a real NaN reaches the
script as `Float64`, which is what a source reading one hands over, and
any other DOUBLE column as `float64`, as before. A Python operator's
inputs go through the same adapter the translator applies, so the run
checks the script a real export writes.

A TIMESTAMP column with a year outside pandas' nanosecond window is read
cell by cell, then made `datetime64[us]` when no value carries a digit
past the microsecond, as an exported upstream hands it on. A column with
nanoseconds stays of object dtype.

`HarnessSpec` covers all three pieces on one operator whose answer is
short
enough to state in full.

It can also run the whole script the export writes for a plan, and write
each leaf the same way, so a workflow-level comparison reads the
script's answer with the same comparator.

### Any related issues, documentation, discussions?

Part of apache#8325, 5 of 27; that issue lists the set in order.

It does not compile until apache#8357 lands: that entry's build.sbt change
puts workflow-operator's test sources on this module's test classpath,
and `StandaloneRunner` reuses the `PythonWorkerPool` that lives there.
It also needs apache#8341, whose source-naming API the runner calls to bind
each source's file. It also needs apache#8597, whose `standaloneInputAdapter`
the runner applies to a Python operator's inputs.

Closes apache#8410, the task this change is the whole of.

### How was this PR tested?

The tests in this change cover it. The whole set is exercised together
once the last piece lands: every operator run through the engine and
through its generated script, and the two answers compared.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 5)

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
renovate-bot pushed a commit to renovate-bot/apache-_-texera that referenced this pull request Nov 18, 2026
…pache#8363)

### What changes were proposed in this PR?

Some operators need an input a schema alone cannot produce. A join needs
two
tables that share a key. A dictionary matcher needs a dictionary whose
entries
appear in the column it reads. File Scan needs a table whose cells name
the
files it reads. Deriving those from annotations would mean teaching the
generator what each operator means.

These are written by hand instead, one entry per operator, and the entry
says
why the generator could not do it.

An entry can also carry extra scenarios, each an input and configuration
its primary one does not reach. For example: an outer join over a long
past 2^53, a model scored on the one row a drop left, a prediction with
ground truth named beside a missing feature, and a cast to text of a
double Java writes in E notation. Each scenario is named for the
question it asks.

### Any related issues, documentation, discussions?

Part of apache#8325, 9 of 27; that issue lists the set in order.
It does not compile until apache#8357 lands, which adds the `PyOpExecHarness`
it calls to find the Python interpreter.

Closes apache#8413, the task this change is the whole of.

### How was this PR tested?

The tests in this change cover it. The whole set is exercised together
once the last piece lands: every operator run through the engine and
through its generated script, and the two answers compared.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 5)

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
renovate-bot pushed a commit to renovate-bot/apache-_-texera that referenced this pull request Nov 19, 2026
### What changes were proposed in this PR?

Two frames agree when they hold the same rows in the same order with the
same
values, and the comparison says which of those failed rather than that
they
differ. A float is compared within a tolerance, since the two paths
reach the
same number by different arithmetic. A model column is compared by what
it
predicts on a probe set rather than by its bytes. A BINARY column that
holds no
model, such as the file File Scan read, is compared byte for byte with
the rest
of the frame.

A visualization has no frame to compare at all. The two comparators that
read
what one draws are in apache#8509.

### Any related issues, documentation, discussions?

Part of apache#8325, 6 of 27; that issue lists the set in order.

It does not compile until apache#8357 lands: that entry's build.sbt change
puts workflow-operator's test sources on this module's test classpath,
and the comparison reuses the `PythonWorkerPool` that lives there.

Closes apache#8411, the task this change is the whole of.

### How was this PR tested?

The tests in this change cover it. The whole set is exercised together
once the last piece lands: every operator run through the engine and
through its generated script, and the two answers compared.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 5)

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Ma77Ball pushed a commit to Ma77Ball/texera that referenced this pull request Nov 21, 2026
…e#8357)

### What changes were proposed in this PR?

A Python operator is not called; it is handed to an interpreter that
imports
the generated module and drives it through the same open, process and
close
the engine uses. `PyOpExecHarness` writes that module, starts the
driver, and
reads back what the operator emitted.

The driver is the engine's side of the contract written out plainly: it
is
what makes the answer this side produces the engine's answer rather than
an
approximation of it.

A timestamp reaches the operator the way the engine hands one to a
Python worker: a naive datetime at microsecond resolution. It is read
without pandas, so a year past 2262 arrives intact. That is the zoneless
microsecond Arrow type apache#8704 makes the engine send.

A port that carried no rows reaches the operator with its declared
columns, as apache#8766 makes the engine hand them. The driver declares each
input port's schema right before that port finishes, where the worker
does.

Eight lines of `build.sbt` are unrelated to the export and fixed while
this change is in the file: File Service's test grouping read its fork
options inside the lambda, which sbt hoists anyway, so the warning it
printed on every build said the code meant something it did not.

### Any related issues, documentation, discussions?

Part of apache#8325, 4 of 27; that issue lists the set in order.

Closes apache#8409, the task this change is the whole of.

### How was this PR tested?

The tests in this change cover it. `PyOpExecHarnessSpec` also checks
that a row the output schema does not describe is refused. It also
checks that `2500-01-01 00:00:00.123456789` reaches the operator as
`2500-01-01 00:00:00.123456`. It also checks that a port that carried no
rows hands the operator its declared columns. Without the driver's
change the operator sees a table with no columns. The whole set is
exercised together once the last piece lands: every operator run through
the engine and through its generated script, and the two answers
compared.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 5, Claude Opus 5.5)

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Ma77Ball pushed a commit to Ma77Ball/texera that referenced this pull request Nov 21, 2026
### What changes were proposed in this PR?

The other side of the comparison. `StandaloneRunner` writes the script
the
operator's generator emits, binds its inputs to the files the fixture
wrote,
runs it, and reads the frames it leaves behind.

The script is kept where it ran, so an operator whose two answers differ
can
be opened as generated rather than described second-hand.

A DOUBLE column holds four values a float64 frame cannot tell apart:
NaN, both infinities and -0.0, beside a null. The script writes each the
way the engine's writer does, where `to_json` wrote the first three as
null and -0.0 as 0.0. An input column holding a real NaN reaches the
script as `Float64`, which is what a source reading one hands over, and
any other DOUBLE column as `float64`, as before. A Python operator's
inputs go through the same adapter the translator applies, so the run
checks the script a real export writes.

A TIMESTAMP column with a year outside pandas' nanosecond window is read
cell by cell, then made `datetime64[us]` when no value carries a digit
past the microsecond, as an exported upstream hands it on. A column with
nanoseconds stays of object dtype.

`HarnessSpec` covers all three pieces on one operator whose answer is
short
enough to state in full.

It can also run the whole script the export writes for a plan, and write
each leaf the same way, so a workflow-level comparison reads the
script's answer with the same comparator.

### Any related issues, documentation, discussions?

Part of apache#8325, 5 of 27; that issue lists the set in order.

It does not compile until apache#8357 lands: that entry's build.sbt change
puts workflow-operator's test sources on this module's test classpath,
and `StandaloneRunner` reuses the `PythonWorkerPool` that lives there.
It also needs apache#8341, whose source-naming API the runner calls to bind
each source's file. It also needs apache#8597, whose `standaloneInputAdapter`
the runner applies to a Python operator's inputs.

Closes apache#8410, the task this change is the whole of.

### How was this PR tested?

The tests in this change cover it. The whole set is exercised together
once the last piece lands: every operator run through the engine and
through its generated script, and the two answers compared.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 5)

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Ma77Ball pushed a commit to Ma77Ball/texera that referenced this pull request Nov 21, 2026
…pache#8363)

### What changes were proposed in this PR?

Some operators need an input a schema alone cannot produce. A join needs
two
tables that share a key. A dictionary matcher needs a dictionary whose
entries
appear in the column it reads. File Scan needs a table whose cells name
the
files it reads. Deriving those from annotations would mean teaching the
generator what each operator means.

These are written by hand instead, one entry per operator, and the entry
says
why the generator could not do it.

An entry can also carry extra scenarios, each an input and configuration
its primary one does not reach. For example: an outer join over a long
past 2^53, a model scored on the one row a drop left, a prediction with
ground truth named beside a missing feature, and a cast to text of a
double Java writes in E notation. Each scenario is named for the
question it asks.

### Any related issues, documentation, discussions?

Part of apache#8325, 9 of 27; that issue lists the set in order.
It does not compile until apache#8357 lands, which adds the `PyOpExecHarness`
it calls to find the Python interpreter.

Closes apache#8413, the task this change is the whole of.

### How was this PR tested?

The tests in this change cover it. The whole set is exercised together
once the last piece lands: every operator run through the engine and
through its generated script, and the two answers compared.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 5)

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Ma77Ball pushed a commit to Ma77Ball/texera that referenced this pull request Nov 21, 2026
### What changes were proposed in this PR?

Two frames agree when they hold the same rows in the same order with the
same
values, and the comparison says which of those failed rather than that
they
differ. A float is compared within a tolerance, since the two paths
reach the
same number by different arithmetic. A model column is compared by what
it
predicts on a probe set rather than by its bytes. A BINARY column that
holds no
model, such as the file File Scan read, is compared byte for byte with
the rest
of the frame.

A visualization has no frame to compare at all. The two comparators that
read
what one draws are in apache#8509.

### Any related issues, documentation, discussions?

Part of apache#8325, 6 of 27; that issue lists the set in order.

It does not compile until apache#8357 lands: that entry's build.sbt change
puts workflow-operator's test sources on this module's test classpath,
and the comparison reuses the `PythonWorkerPool` that lives there.

Closes apache#8411, the task this change is the whole of.

### How was this PR tested?

The tests in this change cover it. The whole set is exercised together
once the last piece lands: every operator run through the engine and
through its generated script, and the two answers compared.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 5)

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
renovate-bot pushed a commit to renovate-bot/apache-_-texera that referenced this pull request Nov 25, 2026
)

### What changes were proposed in this PR?

Remove unused imports, bindings, helpers and fields, and settings that
repeat a default or another entry, from the Amber Python runtime, the
Python test resources of the workflow compiler and operators, the `bin/`
licensing, local-dev and observability scripts, repository
configuration, and three GitHub workflows (**+102/-172 lines**). There
is no behavior change.

- **Amber Python runtime:** `StatisticsManager` uses `defaultdict`
instead of the deprecated `typing.DefaultDict`, and
`BroadcastPartitioner` builds its batch with `[]`.
`LargeBinaryOutputStream` raises and documents `OSError` (which
`IOError` aliases), wraps its best-effort cleanup delete in
`contextlib.suppress`, and drops the `pass` after `flush`'s docstring.
- **Operator verification test resources:** `py_op_driver.py` drops ten
`pytexera` imports and `RAW_TYPE_MAPPING` that it never reads. User code
runs in its own namespace seeded by `from pytexera import *`, so the
"used dynamically" note on those imports did not hold. `compare.py`
drops the uncalled `_string_columns` helper and two dict copies of
`double_kinds_a`/`double_kinds_e`, and `hf_parse_probe.py` drops unused
`io` and `re` imports. Quoted annotations, `open(..., "r")`,
`startswith` plus a slice, and a placeholder-free f-string take their
plain forms here and in `standalone_worker.py`, `py_compile_worker.py`
and `hf_binary_value_probe.py`.
- **`bin/` scripts:** the licensing tools use a tuple `startswith`, read
the one regex group they need instead of unpacking all four, print plain
strings where f-strings had no placeholders, return a `bool` expression
directly, drop annotation quotes under `from __future__ import
annotations`, use `removesuffix`, and name unused loop values `_`. Two
licensing tests drop `# noqa: E402` comments that suppress nothing under
Ruff, and `test_local_dev_tui.py` drops the never-passed `version`
parameter of `_seed_jvm_layout` together with the docstring sentence
about a jar it never wrote. `bin/observability/smoke_test.py` stops
returning an unread status from `_post`, builds the trace id from one
`uuid4().hex` (the first 32 hex digits of two concatenated ones were
always the first), and drops a `leaked = False` that both branches of
the following `try` overwrite.
- **Repository configuration:** `amber/pyproject.toml` drops
`line-length = 88` and `max-complexity = 10`, which are Ruff's defaults
(and `C901` is not selected). `.dockerignore` drops a root
`user-resources/` entry that its first rule, `**/user-resources/`,
already covers. `bin/fix-format.sh` drops the `""` case that
`TARGET="${1:-all}"` makes unreachable, and `bin/frontend-proto-gen.sh`
drops a `--proto_path` that repeats its `-I`.
`bin/k8s/templates/aws/.gitkeep` goes, since the folder holds
`s3-credentials-secret.yaml`. `bin/y-websocket-server/package.json`
drops npm-init's `main` and placeholder `test` script (the image runs
`npx y-websocket`), and a `bin/observability/docker-compose.yml` comment
stops pointing at a `start_app.sh` that the repository does not have.
- **GitHub workflows:** `comment-commands.yml` drops `github.event_name
== 'issue_comment' && github.event.action == 'created'` from three job
conditions, because the workflow only runs on `issue_comment:
[created]`. `pr-assignment.yml` drops a `|| ''` that follows a `typeof
... === 'string'` guard. `benchmarks-pr-comment.yml` stops storing
per-benchmark commit and date, a sample count and delta labels that
nothing reads, takes each row's status from the deltas it already
computed instead of a second `deltaInfo` pass, reuses each metric's
7-day delta, and builds the PR-only CSV table only when there is no
comparison to show.

| Event | PR / Commit |
| --- | --- |
| Introduced by | Amber Python runtime: apache#1891 (2023-05-01), apache#3262
(2025-02-18), apache#4100 (2025-12-15), apache#4707 (2026-05-03), apache#5249
(2026-06-06), apache#8260 (2026-11-18); test resources: apache#7207 (2026-08-14),
apache#8617 (2026-10-15), apache#9306 (2026-11-10), apache#8357 (2026-11-17), apache#8358
(2026-11-18), apache#8359 (2026-11-19); `bin/` scripts: apache#4387 (2026-04-29),
apache#4668 (2026-05-02), apache#4693 (2026-05-02), apache#4711 (2026-05-03), apache#5057
(2026-05-15), apache#5417 (2026-06-10), apache#5961 (2026-06-28), apache#5377
(2026-10-28); configuration: apache#3019 (2024-11-20), apache#3335 (2025-03-23),
apache#3441 (2025-05-19), apache#3890 (2025-10-14), apache#4005 (2025-10-29), apache#4105
(2025-12-05), apache#5757 (2026-06-24); workflows: apache#4885 (2026-05-03), apache#4986
(2026-05-08), apache#5148 (2026-05-22), apache#5557 (2026-06-11), apache#5639 (2026-06-12)
|
| Usage removed by | `issue_comment` checks: apache#4899 (2026-05-04, `ci:
drop the triage label, use is:open no:assignee filter`) moved `/take`
out of `issue-triage.yml`, which also ran on `issues` events, into a
workflow that only runs on created comments, and apache#4986 and apache#5148 copied
the checks into two new jobs; `aws/.gitkeep`: apache#5932 (2026-07-01,
`feat(k8s): make app-tier object storage configurable via storage.s3`)
added the folder's first template; PR-only CSV table: apache#5639 (2026-06-12,
`ci: compare benchmark PRs with main`) shows it only when there is no
comparison; everything else: unused or redundant since introduction |

As of 2026-11-23, the unread test-resource code is under a week old, the
`.gitkeep` placeholder and the unread benchmark fields have been
redundant for about 5 months, the `issue_comment` checks for over 6
months, and the duplicate `.dockerignore` entry and `--proto_path` for
20 and 24 months.

### Any related issues, documentation, discussions?

Closes apache#9676.

### How was this PR tested?

Ran on `525f8ce3fb` and on `main` at `89a492f97e` (Windows 11, Python
3.12 with CI's pinned `ruff` 0.14.7, `pytest` 9.0.3 and `textual` 8.2.8,
JDK 17):

```bash
cd amber
ruff check src/main/python src/test/python
ruff format --check src/main/python src/test/python
pytest -m "not integration"
cd ..
ruff check $(git diff --name-only origin/main -- '*.py' ':!amber/')
python -m pytest bin/ -v --tb=short
sbt "WorkflowCompilingService/testOnly org.apache.texera.amber.translator.verify.ComparatorSpec org.apache.texera.amber.translator.verify.HarnessSpec org.apache.texera.amber.translator.verify.PyOpExecHarnessSpec org.apache.texera.amber.translator.verify.VisualizationJsonComparatorSpec"
sbt "WorkflowOperator/testOnly org.apache.texera.amber.operator.huggingFace.codegen.HuggingFaceBinaryValueBehaviorSpec org.apache.texera.amber.operator.huggingFace.codegen.HuggingFaceParseBehaviorSpec org.apache.texera.amber.util.PythonCodeRawInvalidTextSpec"
```

- Ruff: passed on `amber/` (218 files already formatted) and on the 14
changed Python files outside `amber/`.
- `pytest -m "not integration"` in `amber/` (JUnit XML): each of the
1,524 tests has the same outcome as on `main`: 1,496 passed, 10 skipped,
and the same 18 platform-dependent tests (Iceberg catalog on PostgreSQL
and `s3fs`, time zones, object reprs) fail on this Windows machine on
both.
- `python -m pytest bin/` (JUnit XML): each of the 196 tests has the
same outcome as on `main`: 186 passed, and nine `bin/mounter` tests plus
`test_stamp_dir_for_matches_shell_sha1`, which assume POSIX paths and
shells, fail on Windows on both.
- sbt (JUnit XML, `UDF_PYTHON_PATH` set to Python 3.12 because Windows
has no `python3`): these seven suites load the edited test resources.
`WorkflowCompilingService` passed 52 of 52 in 4 suites and
`WorkflowOperator` 11 of 11 in 3 suites, with 0 canceled, the same as on
`main`.
- Licensing scripts: `concat_license_binary.py` writes byte-identical
combined licenses for the Python and frontend images, and
`check_binary_deps.py jar` prints byte-identical reports and exit codes
for a synthetic lib folder with missing, extra and version-mismatched
jars, with and without `--ignore-transitive-version`.
- Workflows: the three edited workflows run only from the default branch
(`issue_comment`, `pull_request_target` and `workflow_run`), so this
PR's CI cannot run them. Each edited `github-script` body ran before and
after under Node with recording stubs for `github`, `core`, `fs` and
`fetch`, over 496 fixtures (missing or malformed CSV and baseline data,
failed API calls, body edits with and without closing references). Every
API call, comment body and log line is identical, and a one-line change
to each script does show up in its traces. The `comment-commands.yml`
conditions differ from `main` only by the two removed checks.
- `bash -n` passes on `bin/fix-format.sh` and
`bin/frontend-proto-gen.sh`, and the edited YAML, TOML and JSON files
parse.
- After review, `f84888ca6c` changes only three docstrings in
`large_binary_output_stream.py` and inlines one local in
`py_op_driver.py`. On it, Ruff passes as above, each of the 1,524
`amber` tests again has the same outcome as on `main`, the four
`WorkflowCompilingService` suites pass 52 of 52, and `_jsonify` returns
the same strings as on `525f8ce3fb` for seven `BINARY` inputs, with and
without the pickle marker.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 5.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common dependencies Pull requests that update a dependency file feature platform Non-amber Scala service paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run a Python operator the way the engine runs it

4 participants