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

   ### What changes were proposed in this PR?
   
   Remove unused bindings, parameters and test fixtures from the Scala code of 
the Amber engine and web server, `workflow-core` and `workflow-operator`, and 
copy each part that `S3StorageClient` uploads once instead of twice (**+83/-96 
lines**). Production behavior does not change. Two CSV tests that are named for 
multi-line data now read the multi-line file.
   
   - **Unused bindings:** pattern, `catch` and callback bindings that nothing 
reads become `_` in `ClusterListener`, `DeadLetterMonitorActor`, `Utils`, 
`SequentialRecordStorage`, the argument parsers of `ComputingUnitMaster` and 
`ComputingUnitWorker`, `WebsocketInput`, `WorkflowWebsocketResource`, 
`AiAssistantManager`, `ExecFactory`, `VirtualIdentityUtils`, `URLFetchUtil` and 
`HtmlVizOpDesc`.
   - **`S3StorageClient.uploadObject`:**
     - `readChunk` uses a plain `while` loop instead of assigning inside the 
loop condition.
     - The parts upload in a `while` loop that adds each `CompletedPart` to the 
Java list the SDK takes. Before, an `Iterator` of `(partNumber, size)` tuples 
became a Scala `List` and then went back through `.asJava`.
     - Each part is copied out of the reused buffer once and streamed from that 
copy. `buffer.take` and `RequestBody.fromBytes`, which calls `Arrays.copyOf` 
itself, copied it twice. The content provider gives each SDK attempt a fresh 
stream over the same bytes.
     - Part numbers, upload order, part sizes, the `application/octet-stream` 
content type and the read of the next chunk after each upload are unchanged.
   - **`SQLSourceOpExec.fetchBatchByBoundary`:** returns the result of the type 
`match` as a `val` instead of overwriting a `var` that starts as `null`.
   - **Test helpers:**
     - `DPThreadSpec.awaitCond` drops its unused default budget, and the spec's 
callbacks name their unused argument `_`.
     - `ExternalAuthProvisionerSpec`'s `seedUser` and `seedUserWithEmail` drop 
the `avatar` parameter that no test passes.
     - `DictionaryMatcherOpExecSpec.withExecutor`, `HashJoinOpSpec.tuple` and 
the tuple builders of `IntervalOpExecSpec` drop defaults that every caller 
overrides.
     - `PythonWorkerPool` starts its stdout and stderr reader threads without 
keeping the references it never reads.
   - **Test fixtures:**
     - `TestOperators` drops `asterixDBSourceOpDesc`, a descriptor for the 
AsterixDB server at `ipubmed4.ics.uci.edu` that only its own 
`TestOperatorsSpec` case still built. It also drops the `multiLine` parameter 
that `getCsvScanOpDesc` never read.
     - `headerlessSmallMultiLineDataCsvScanOpDesc` reads 
`country_sales_headerless_small_multi_line.csv` again, so 
`DataProcessingSpec`'s headerless multi-line case runs on multi-line data.
     - The matching `CSVScanSourceOpDescSpec` case now reads that file too, and 
checks the scanned rows: 100 rows of 14 fields, a quoted value with commas, and 
two values with line breaks.
   
   | Event | PR / Commit |
   | --- | --- |
   | Introduced by | Amber engine and web server: #945 (2021-01-05), #1101 
(2021-05-03), #1387 (2022-02-10), #1381 (2022-05-13), #1671 (2022-11-07), #1677 
(2022-11-07), #2060 (2023-07-14), #2529 (2024-03-29), #2808 (2024-09-02); 
`workflow-core`: #2271 (2024-01-18), #3183 (2024-12-31), #4067 (2025-11-25); 
`workflow-operator`: #1013 (2021-02-11), #1866 (2023-03-23), #3186 
(2024-12-31); tests: #1044 (2021-02-25), #1083 (2021-04-25), #1227 
(2021-07-25), #2254 (2023-12-13), #2302 (2024-02-05), #3425 (2025-05-26), #6077 
(2026-07-03), #7055 (2026-08-10), #7207 (2026-08-14), #7870 (2026-08-23), #9534 
(2026-11-19), #9518 (2026-11-21) |
   | Usage removed by | AsterixDB fixture: #1118 (2021-05-11, `Disable 
dependent tests with AsterixDB`) commented out its only test use, which #3294 
(2025-03-04) deleted; multi-line fixture: #3111 (2024-11-26, `Update amber to 
depend on sub projects`) pointed `headerlessSmallMultiLineDataCsvScanOpDesc` at 
the single-line file; `awaitCond`'s default budget: #9534 (2026-11-19, 
`test(amber): share engine and service test fixtures`) routed its last callers 
through a helper that always passes one; everything else: unused since 
introduction |
   
   As of 2026-11-24, the AsterixDB fixture has had no test use for over 5 
years, and the headerless multi-line CSV fixture has read single-line data for 
about 12 months.
   
   ### Any related issues, documentation, discussions?
   
   Closes #9680.
   
   ### How was this PR tested?
   
   Ran on this branch and on `main` at `de3f021dec` (Windows 11, JDK 17, 
`UDF_PYTHON_PATH` set to Python 3.12, and Docker for the RustFS container that 
`S3StorageClientSpec` starts). The e2e case uses the Hadoop Iceberg catalog 
because no REST catalog runs on this machine:
   
   ```bash
   WUNUSED='set ThisBuild / scalacOptions += "-Wunused:patvars,params,privates"'
   sbt "$WUNUSED" "WorkflowCore/testOnly 
org.apache.texera.amber.core.executor.CoreExecutorReflectionSpec 
org.apache.texera.amber.util.VirtualIdentityUtilsSpec 
org.apache.texera.service.util.S3StorageClientSpec"
   sbt "$WUNUSED" "WorkflowOperator/testOnly 
org.apache.texera.amber.operator.TestOperatorsSpec 
org.apache.texera.amber.operator.dictionary.DictionaryMatcherOpExecSpec 
org.apache.texera.amber.operator.hashJoin.HashJoinOpSpec 
org.apache.texera.amber.operator.intervalJoin.IntervalOpExecSpec 
org.apache.texera.amber.operator.source.fetcher.URLFetchUtilSpec 
org.apache.texera.amber.operator.source.fetcher.URLFetcherOpExecSpec 
org.apache.texera.amber.operator.source.scan.csv.CSVScanSourceOpDescSpec 
org.apache.texera.amber.operator.source.scan.csv.CSVScanSourceOpExecSpec 
org.apache.texera.amber.operator.source.sql.* 
org.apache.texera.amber.operator.visualization.htmlviz.HtmlVizOpDescSpec 
org.apache.texera.amber.util.python.PythonWorkerPoolSpec"
   sbt "$WUNUSED" "WorkflowExecutionService/testOnly 
org.apache.texera.amber.clustering.ClusterListenerSpec 
org.apache.texera.amber.engine.architecture.messaginglayer.DeadLetterMonitorActorSpec
 org.apache.texera.amber.engine.architecture.worker.DPThreadSpec 
org.apache.texera.amber.engine.common.UtilsSpec 
org.apache.texera.amber.engine.common.storage.SequentialRecordStorageSpec 
org.apache.texera.web.ComputingUnitMasterSpec 
org.apache.texera.web.ComputingUnitWorkerSpec 
org.apache.texera.web.WebsocketInputSpec 
org.apache.texera.web.resource.WorkflowWebsocketResourceSpec 
org.apache.texera.web.resource.aiassistant.AiAssistantManagerSpec 
org.apache.texera.web.resource.auth.ExternalAuthProvisionerSpec"
   STORAGE_ICEBERG_CATALOG_TYPE=hadoop sbt "$WUNUSED" 
"WorkflowExecutionService/testOnly 
org.apache.texera.amber.engine.e2e.DataProcessingSpec -- -z 
headerlessMultiLineDataCsv"
   sbt WorkflowCore/scalafmtCheckAll WorkflowOperator/scalafmtCheckAll 
WorkflowExecutionService/scalafmtCheckAll "WorkflowCore/scalafixAll --check" 
"WorkflowOperator/scalafixAll --check" "WorkflowExecutionService/scalafixAll 
--check"
   ```
   
   - JUnit XML, compared per test:
     - These 36 suites load every changed file, and `SQLSourceOpExecSpec` calls 
`fetchBatchByBoundary` for each numeric type through a mocked JDBC result.
     - All 554 tests pass on `main` and all 553 on this branch. Each test has 
the same outcome as on `main`; the missing one is the removed 
`asterixDBSourceOpDesc` case.
   - `S3StorageClientSpec` runs its 34 cases against RustFS 1.0.0 in 
Testcontainers on both sides. They include a 6 MiB upload (a 5 MiB part and a 1 
MiB tail) that downloads back byte for byte, an empty upload, and the abort 
when the input stream fails after the first part.
   - With the fixture pointed back at `country_sales_headerless_small.csv`, the 
strengthened `CSVScanSourceOpDescSpec` case fails: row 8 reads `Republic of the 
Congo` instead of `Republic,of,the,Congo`. The `DataProcessingSpec` case runs 
the multi-line file through the engine and gets the same 100 rows that the 
single-line file gives on `main`.
   - scalafmt and scalafix pass on all three modules.
   - With `-Wunused:patvars,params,privates`, the compiler reports 26 unused 
names in these files on `main`. This PR removes 24 of them. The other two are 
`config` and `cr`, which the `@OnOpen` and `@OnClose` methods of 
`WorkflowWebsocketResource` need for the WebSocket API's signatures; they are 
reported on both.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude Opus 5.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