Yicong-Huang opened a new issue, #5021:
URL: https://github.com/apache/texera/issues/5021

   ### Bug Summary
   
   When `WorkflowCompilationResource.compileWorkflow` receives a logical plan 
whose CSV scan source has a fileName that `FileResolver` cannot resolve (e.g. a 
path that does not exist on disk), the lenient compiler correctly accumulates 
the error and returns a `WorkflowCompilationResult` — but the resource then 
NPEs while building the response, surfacing as HTTP 500 instead of 
`WorkflowCompilationFailure`.
   
   ### Reproduction
   
   ```scala
   val brokenCsv = new CSVScanSourceOpDesc()
   brokenCsv.fileName = Some("/does/not/exist/missing.csv")
   brokenCsv.customDelimiter = Some(",")
   brokenCsv.hasHeader = true
   
   // POST /compile with LogicalPlanPojo(List(brokenCsv), Nil, Nil, Nil)
   // → HTTP 500, body: {"code":500,"message":"There was an error processing 
your request..."}
   ```
   
   Server-side stack trace:
   
   ```
   java.lang.NullPointerException: Cannot invoke
     "org.apache.texera.amber.core.tuple.Schema.attributes()"
     because the return value of "scala.Option.get()" is null
     at 
WorkflowCompilationResource.compileWorkflow$2(WorkflowCompilationResource.scala:84)
     at 
WorkflowCompilationResource.compileWorkflow$1(WorkflowCompilationResource.scala:77)
     at 
WorkflowCompilationResource.compileWorkflow(WorkflowCompilationResource.scala:74)
   ```
   
   ### Root cause
   
   
`workflow-compiling-service/src/main/scala/org/apache/texera/service/resource/WorkflowCompilationResource.scala:79-86`:
   
   ```scala
   if (schemaOption.isEmpty) {
     (PortIdentityKeySerializer.portIdToString(portId), None)
   } else {
     (PortIdentityKeySerializer.portIdToString(portId), 
Some(schemaOption.get.attributes))
   }
   ```
   
   The upstream `collectOutputSchemaFromPhysicalPlan` produces `Some(null)` for 
a port whose schema could not be derived. `isEmpty` returns false for 
`Some(null)`, so the `else` branch runs and calls `.attributes` on a null 
`Schema`.
   
   ### Impact
   
   User-visible: any compile request from the editing UI with an unresolvable 
scan source returns 500 instead of a structured failure. The frontend cannot 
render the underlying "file not found" error in the operator panel.
   
   Version: 1.1.0-incubating.


-- 
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