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

   ### What changes were proposed in this PR?
   
   `ResultExportService` sits at ~6% line coverage: the existing spec only 
covers `parseOperators` and `validateExportRequest`, leaving the whole 
export-encoding layer untested. The `streamDocumentAs*` writers look 
storage-bound but are not — each takes a `VirtualDocument[Tuple]` parameter, so 
a small in-spec fake document makes them testable against a 
`ByteArrayOutputStream`, with no Iceberg, MinIO or DB.
   
   This extends `ResultExportServiceSpec` with 19 tests that reach the private 
writers through `PrivateMethodTester`: `streamDocumentAsCSV` (both early 
returns, inferred vs supplied headers, and a document larger than 
`Constants.CHUNK_SIZE` to exercise the buffered chunk loop), `streamCellData` 
(rowIndex/columnIndex validation messages, an unretrievable row, and the 
happy-path bytes), `convertFieldToBytes` (all three branches), 
`streamDocumentAsHTML`, `streamDocumentAsParquetZip` (verbatim copy plus 
source-stream close, and error propagation), `streamDocumentAsArrow` 
(round-trips the tuples back through `ArrowFileReader`), and 
`NonClosingOutputStream`.
   
   Two existing behaviors are pinned as-is rather than changed: with supplied 
headers the first row is not consumed by header inference, so it still appears 
in the body (the asymmetry against the `None` branch), and 
`streamDocumentAsHTML` throws `NoSuchElementException` on an empty document 
because `.head` is unguarded. `getOperatorDocument`, `saveToDatasets`, 
`saveStreamToDataset` and `generateFileName` stay uncovered — they need 
`DocumentFactory.openDocument`, a live file-service endpoint, or embed 
`LocalDateTime.now()`.
   
   ### Any related issues, documentation, discussions?
   
   Closes #6898. Extends the spec added by #6705.
   
   ### How was this PR tested?
   
   `sbt "WorkflowExecutionService/testOnly *ResultExportServiceSpec"` passes 
with 24 tests (5 existing, 19 new); `Test/scalafmtCheck` and `Test/scalafix 
--check` are clean. Verified the failure path by inverting the supplied-headers 
assertion and confirming the suite went red and exited non-zero. Every test 
runs in-process against an in-spec fake document, so no external service is 
involved.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Fable 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