Repository navigation
feat(notebook-migration): add r prompts and build rudf operators for r sources - #8911
Conversation
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8911 +/- ##
=========================================
Coverage 91.79% 91.80%
Complexity 5020 5020
=========================================
Files 1274 1275 +1
Lines 56298 56324 +26
Branches 7352 7357 +5
=========================================
+ Hits 51677 51706 +29
+ Misses 2766 2764 -2
+ Partials 1855 1854 -1
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
| config | throughput | MB/s | latency | max Δ latest / 7d | |
|---|---|---|---|---|---|
| 🔴 | bs=10 sw=10 sl=64 | 461 | 0.282 | 21,296/33,895/33,895 us | 🔴 +12.6% / 🔴 +145.4% |
| 🔴 | bs=100 sw=10 sl=64 | 953 | 0.582 | 101,248/144,998/144,998 us | 🔴 +16.1% / 🔴 +52.1% |
| ⚪ | bs=1000 sw=10 sl=64 | 1,147 | 0.7 | 852,888/994,711/994,711 us | ⚪ within ±5% / 🔴 +7.6% |
Baseline details
Latest main 7b1033b from same runner
| config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
|---|---|---|---|---|---|---|
| bs=10 sw=10 sl=64 | throughput | 461 tuples/sec | 491 tuples/sec | 886.32 tuples/sec | -6.1% | -48.0% |
| bs=10 sw=10 sl=64 | MB/s | 0.282 MB/s | 0.3 MB/s | 0.541 MB/s | -6.0% | -47.9% |
| bs=10 sw=10 sl=64 | p50 | 21,296 us | 19,898 us | 11,452 us | +7.0% | +86.0% |
| bs=10 sw=10 sl=64 | p95 | 33,895 us | 30,092 us | 13,814 us | +12.6% | +145.4% |
| bs=10 sw=10 sl=64 | p99 | 33,895 us | 30,092 us | 16,981 us | +12.6% | +99.6% |
| bs=100 sw=10 sl=64 | throughput | 953 tuples/sec | 1,006 tuples/sec | 1,152 tuples/sec | -5.3% | -17.2% |
| bs=100 sw=10 sl=64 | MB/s | 0.582 MB/s | 0.614 MB/s | 0.703 MB/s | -5.2% | -17.2% |
| bs=100 sw=10 sl=64 | p50 | 101,248 us | 95,588 us | 89,907 us | +5.9% | +12.6% |
| bs=100 sw=10 sl=64 | p95 | 144,998 us | 124,905 us | 95,307 us | +16.1% | +52.1% |
| bs=100 sw=10 sl=64 | p99 | 144,998 us | 124,905 us | 108,041 us | +16.1% | +34.2% |
| bs=1000 sw=10 sl=64 | throughput | 1,147 tuples/sec | 1,146 tuples/sec | 1,186 tuples/sec | +0.1% | -3.3% |
| bs=1000 sw=10 sl=64 | MB/s | 0.7 MB/s | 0.699 MB/s | 0.724 MB/s | +0.1% | -3.3% |
| bs=1000 sw=10 sl=64 | p50 | 852,888 us | 872,798 us | 877,148 us | -2.3% | -2.8% |
| bs=1000 sw=10 sl=64 | p95 | 994,711 us | 970,350 us | 924,448 us | +2.5% | +7.6% |
| bs=1000 sw=10 sl=64 | p99 | 994,711 us | 970,350 us | 956,928 us | +2.5% | +3.9% |
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,433.61,200,128000,461,0.282,21296.03,33895.14,33895.14
1,100,10,64,20,2097.73,2000,1280000,953,0.582,101248.32,144997.55,144997.55
2,1000,10,64,20,17438.34,20000,12800000,1147,0.700,852888.38,994711.25,994711.25960adc5 to
9e21203
Compare
|
/request-review @mengw15 |
There was a problem hiding this comment.
🟡 Changes recommended
The disabled-R guard runs after model connection verification, and both R migration examples fail to expose printed statistics as readable outputs.
2 open issues
What changed in this PR
Adds the conversion layer for migrating R notebooks and scripts into Texera workflows, behind a disabled-by-default flag. Import-modal support remains in follow-up PRs.
Changes:
- Adds R prompts and worked examples for data passing, visualization, and source mappings.
- Passes source language through conversion, selecting Table API
RUDFoperators and R notebook metadata. - Exposes the opt-in configuration flag and adds conversion, prompt, and configuration tests.
| File | Description |
|---|---|
frontend/src/app/workspace/service/notebook-migration/notebook-migration.service.ts |
Passes source language to notebook and script conversions. |
frontend/src/app/workspace/service/notebook-migration/notebook-migration.service.spec.ts |
Tests language forwarding and Python defaults. |
frontend/src/app/workspace/service/notebook-migration/migration-prompts-r.ts |
Adds R instructions, examples, and mapping prompts. |
frontend/src/app/workspace/service/notebook-migration/migration-prompts-r.spec.ts |
Validates example structure, connections, and mappings. |
frontend/src/app/workspace/service/notebook-migration/migration-llm.ts |
Selects R prompts, operator properties, and notebook metadata. |
frontend/src/app/workspace/service/notebook-migration/migration-llm.spec.ts |
Tests R conversion wiring, flag checks, and Python compatibility. |
frontend/src/app/common/type/gui-config.ts |
Adds the frontend R migration flag type. |
frontend/src/app/common/service/gui-config.service.mock.ts |
Defaults the mocked R migration flag to false. |
config-service/src/main/scala/org/apache/texera/service/resource/ConfigResource.scala |
Exposes the R migration flag to the frontend. |
common/config/src/test/scala/org/apache/texera/common/config/GuiConfigSpec.scala |
Checks that R migration defaults to disabled. |
common/config/src/main/scala/org/apache/texera/common/config/GuiConfig.scala |
Reads the R migration configuration setting. |
common/config/src/main/resources/gui.conf |
Defines the default and environment override. |
Review effort: Max
…s as readable columns
There was a problem hiding this comment.
🟡 Changes recommended
The R migration prompt recommends unsupported NULL returns that cause generated Table API UDFs to fail; it should require a zero-row data frame with the declared output columns instead.
1 open issue
2 resolved since last review
Review effort: Max
…#8912) ### What changes were proposed in this PR? This PR lets users convert R Jupyter notebooks, using the R conversion from apache#8911. It is the first of the UI PRs for R support (apache#8009). R files follow in apache#8963 and R folders in a later PR, each as a new tab beside the Python ones. **Import modal.** The Jupyter Notebook tab gets a "Python Notebook | R Notebook" switch, centered above the diagram. It defaults to Python. The diagram, the description and the upload label follow it, and changing it clears the staged file. The switch is a `FormControl`, so it keeps its value when the tab re-renders. `requestImport` now receives a `language`. **Disabled, not hidden.** When `rNotebookMigrationEnabled` is off, the R Notebook option stays visible but disabled, with the tooltip "R is not enabled on this deployment." Users can see that R exists without being able to pick it on a deployment that cannot run it. The guard from apache#8911 still refuses R in that case, before any model call. **Tab descriptors.** A small `IMPORT_TABS` list replaces the index checks that decided the folder tab and the language. The R file and folder tabs each add one entry. **Dispatch.** The dashboard passes the language to the notebook conversion. For R, only `.ipynb` is accepted in this PR. A notebook uploaded as R whose `kernelspec.language` is set and is not R is rejected before any model call: "This notebook uses a python kernel, not R. Switch the notebook type to Python Notebook." A notebook without a kernelspec is accepted. Other language mismatches are tracked in apache#8929. **Assets.** A new R notebook diagram, at the same size and border as the others. `frontend/LICENSE-binary` adds it to the Project Jupyter logo and Material Symbols entries. #### Demo video (wait time cut out) https://github.com/user-attachments/assets/9769bdd8-5e2d-4994-8a5a-be216908b09f #### R disabled on a deployment without R <img width="420" height="159" alt="Screenshot 2026-10-12 at 1 51 42 PM" src="https://github.com/user-attachments/assets/2c45ea97-9fe2-4b3c-a8ec-4fc2a8875d22" /> ### Any related issues, documentation, discussions? Closes apache#9384 Part of apache#8009 Parent-issue apache#4301 The plan is in apache#8866. R notebooks open in the Jupyter panel without a kernel, since the Jupyter image has no R kernel. apache#8909 removed the "Kernel not found" dialog that otherwise appears and keeps the cells read only. ### How was this PR tested? * `notebook-import-modal.component.spec.ts`, seven new tests: Python is the default; the R option is disabled with its tooltip while the R flag is off and enabled without one while it is on; switching to R changes the diagram and label and drops the staged notebook; R stays selected across a re-render; the file and folder tabs keep their own language; and submit passes `"r"`. Existing assertions now expect `"python"`. * `user-workflow.component.spec.ts`, five new tests: a Python notebook converts as Python by default, an R notebook converts as R with or without a kernelspec, a Python kernel notebook is rejected as R, and a non notebook file is rejected as R. The full frontend suite passes. Checked by hand against a local stack. With the R flag on, the switch changes the diagram, description and label, clears a staged file, and survives leaving and returning to the tab. With it off, the R option is disabled and shows its tooltip. The tab fits the modal without scrolling in every state. An R notebook converted end to end with a live model. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5.5)
### What changes were proposed in this PR? This PR lets users convert R files, using the R script conversion from apache#8911. It is the second UI PR for R support (apache#8009), after R notebooks in apache#8912. R folders follow in apache#9386. **Import modal.** An "R File" tab after Python Folder, laid out like the Python File tab: its own diagram, a description, and an upload row that accepts `.R` and `.r`. It is one more entry in the `IMPORT_TABS` list from apache#8912, which is all the language and tab logic it needs. **Disabled, not hidden.** As with the R Notebook option in apache#8912, the tab is always shown. When `rNotebookMigrationEnabled` is off it is greyed out, cannot be selected, and its title shows the tooltip "R is not enabled on this deployment." **Dispatch.** A small per language table now holds each language's script extension and messages. For R, the dashboard accepts `.ipynb` or `.R` / `.r`, and anything else gets "Please upload an R Jupyter Notebook (.ipynb) or an R (.R) file." R files go through the R script conversion, and a file that cannot be read gets R wording. Python's messages are unchanged. **Assets.** A new R file diagram, at the same size and border as the others. `frontend/LICENSE-binary` adds it to the Material Symbols entry. #### Demo video (waiting time cut out) https://github.com/user-attachments/assets/fc1dc88a-452b-41ca-a972-22e4e9617e53 #### R File disabled on a deployment without R <img width="308" height="88" alt="image" src="https://github.com/user-attachments/assets/261f86ac-77a0-4a7f-99ff-6a15da1310f5" /> ### Any related issues, documentation, discussions? Closes apache#9385 Part of apache#8009 Parent-issue apache#4301 The plan is in apache#8866. Language mismatches between the upload and the selected tab are tracked in apache#8929. ### How was this PR tested? * `notebook-import-modal.component.spec.ts`, four new tests: the tab is disabled with its tooltip while the R flag is off and a click does not select it; while the flag is on it shows its diagram, accepts `.R,.r` and reports the R language; and submit passes `"r"`. The tab count assertion now expects four tabs, and the tooltip lookup finds each tooltip by the element it is attached to, since the modal now has two. * `user-workflow.component.spec.ts`, three new tests: `.R` and `.r` convert as R scripts, and an unreadable R file gets R wording. The R test from apache#8912 now rejects a `.py`, since `.R` is accepted here, and the Python script assertion now expects `"python"`. The full frontend suite passes. Checked by hand against a local stack. With the R flag off, the R File tab is disabled, ignores clicks and shows its tooltip. With it on, the tab shows its diagram, description and `.R,.r` upload row, a staged file clears on changing tabs, and no tab scrolls. An R file converted end to end with a live model. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5.5)

What changes were proposed in this PR?
This is the second of the PRs adding R support to the migration tool (#8009), building on the prompt sets from #8910. It adds the R side of the conversion. Nothing is user visible yet: the import modal options arrive in #8912 and #8963, and the new flag defaults to off.
Flag.
gui.workflow-workspace.r-notebook-migration-enabled, default false, overridable withGUI_WORKFLOW_WORKSPACE_R_NOTEBOOK_MIGRATION_ENABLEDand exposed to the frontend asrNotebookMigrationEnabled. R UDFs only run where the computing unit has the texera-rudf plugin installed (#4155), and no Texera image ships it, so R stays off unless a deployment opts in. It sits under the existing migration flag rather than replacing it.R prompts. A new
migration-prompts-r.tsholds an R version of each prompt, notebook and script, with the same JSON reply contract so parsing does not change. The design follows a spike against texera-rudf that ran chained R UDFs in a real workflow:function(table, port)that takes and returns a data.frame.RUDFneedsuseTupleAPIset explicitly, and teaching one API keeps generated code and the flag consistent.binarycolumns. R has no pickle, so a UDF whose output another UDF reads returns one row ofI(list(serialize(x, NULL)))columns, and the reader callsunserialize(table$x[[1]]). The spike passed data.frames and fittedlmmodels this way between real workers.buildWorkflowdeclares asstring, and does not cast it.ggplotly()into a page that loads Plotly from a CDN, returned ashtml-content.htmlwidgets::saveWidgetis ruled out because it needs pandoc.The worked examples are the diabetes pipeline in R. Their line numbers, mapping ranges and JSON escaping were generated rather than typed, and all six example UDFs were run through texera-rudf on
diabetes.csv, chained the waybuildWorkflowwires them. Unlike the Python examples, they are valid JSON.Wiring.
MigrationLanguagewidens to"python" | "r". The R prompt set buildsRUDFoperators withuseTupleAPI: falsethrough a newpropertiesoverlay (empty for Python, so Python operators are unchanged) and derives notebooks with theirkernelspec. ApromptsForguard refuses an R conversion while the R flag is off, before any model call.NotebookMigrationServicepasses the language through.Any related issues, documentation, discussions?
Part of #8009
Parent-issue #4301
The plan is in #8866. The import modal options follow in #8912 (R notebooks) and #8963 (R files), which are stacked on this PR.
How was this PR tested?
migration-llm.spec.ts, six new tests: the exact R prelude and prompts for notebooks and scripts, the fullRUDFproperty set with binary and string outputs, theirkernelspec on a derived notebook, the R flag blocking R without a model call, and Python still converting with the R flag off. The Python prompt tests from refactor(notebook-migration): select prompts and operator type by source language #8910 pass unchanged.migration-prompts-r.spec.ts, new, ten tests guarding the worked examples: both example blocks parse as JSON, edges only reference defined UDFs, every UDF is a numbered Table API function, only UDFs another UDF reads callserialize, no UDF has two inputs, and the mapping cells and line ranges point at real, non blank lines.notebook-migration.service.spec.ts, two new tests that the language reaches both conversions.GuiConfigSpecchecks the flag defaults to false.Coverage of
migration-llm.tsandnotebook-migration.service.tsstays at 100% of lines. The full frontend suite passes.End to end with a live model, through the modal from #8912 and #8963: an R script and an R notebook each converted to a workflow of Table API
RUDFoperators. Run on the source dataset, the script's workflow reported the same model accuracies as running the original script inRscript, and its plot rendered through an HTML Visualizer.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5.5)