mengw15 opened a new pull request, #5090: URL: https://github.com/apache/texera/pull/5090
### What changes were proposed in this PR? Fixes a `NullPointerException` in `WorkflowCompilationResource.compileWorkflow` when the compiler emits `Some(null)` for a port whose output schema cannot be derived (e.g. a CSV scan source whose `fileName` cannot be resolved on disk). Previously, the resource checked `schemaOption.isEmpty` and then called `schemaOption.get.attributes` in the `else` branch. Because `Some(null).isEmpty` is `false`, the `else` branch ran and dereferenced a `null` `Schema`, raising an NPE that the JAX-RS layer surfaced as HTTP 500. After this change, both `None` and `Some(null)` are normalized to `None` via `schemaOption.flatMap(Option(_)).map(_.attributes)`, so the response building always succeeds and the underlying compilation error reaches the client as a structured `WorkflowCompilationFailure`. ### Any related issues, documentation, discussions? Closes #5021. ### How was this PR tested? Added a new unit test in `WorkflowCompilationResourceSpec` that reproduces the issue: it POSTs a `LogicalPlanPojo` containing a single CSV scan with a non-existent file path and asserts the response is HTTP 200 with `type=failure` (rather than HTTP 500). The existing happy-path compilation test still passes, confirming no regression on the success branch. Run locally: ``` sbt "WorkflowCompilingService/testOnly org.apache.texera.service.resource.WorkflowCompilationResourceSpec" ``` Result: `Tests: succeeded 2, failed 0`. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (claude-opus-4-7) --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
