DanielLeens opened a new pull request, #13437:
URL: https://github.com/apache/seatunnel/pull/13437

   ### Purpose of this pull request
   
   Yes, I am contributing this fix to Apache SeaTunnel. This adapts 
WhaleOps/whaletunnel#3323 to the current Apache `dev` branch and follows up on 
the SQL UDF lifecycle introduced in #10460 and #10760.
   
   A Zeta SQL transform currently opens every SPI-discovered UDF when its first 
row arrives. An unrelated UDF can therefore fail a query that never references 
it. This change identifies referenced functions in the parsed SQL and opens 
those UDFs at task startup, once for each SQL transform instance. This includes 
empty-input jobs and condition branches that are not evaluated. It leaves 
unreferenced providers unopened, while SPI class discovery and instantiation 
remain unchanged.
   
   Add a backward-compatible `open(ZetaUDFContext)` overload which delegates to 
existing `open()` implementations by default. The context provides an isolated 
input `CatalogTable` snapshot; row values and row-level table identifiers are 
not bound during initialization. SQL multi-table wrappers forward lifecycle 
callbacks, including composed rules. Fatal SQL initialization failures 
propagate through the task startup path and opened resources are cleaned up. 
Existing SQL engines are closed when input schema changes invalidate them.
   
   The related #13403 proposes initialization at first evaluation, with 
different empty-input and conditional-branch semantics. This PR adopts startup 
initialization. #13175 and #13180 address broader transform lifecycle problems 
and are not replaced by this SQL-specific change.
   
   ### Does this PR introduce any user-facing change?
   
   Yes. Referenced UDFs initialize at task startup rather than on the first 
row; unused UDFs are not opened. Existing UDFs overriding only `open()` remain 
supported. Errors during SQL UDF initialization fail the task instead of being 
ignored.
   
   ### How was this patch tested?
   
   Added coverage for per-table startup context, nested and WHERE references, 
unused UDFs, initialization errors and cleanup, plus a UDF end-to-end failure 
scenario. These tests have not been run for this upstream head. The requested 
verification will be performed separately.
   
   - Scoped `spotless:apply` passed for the API, transforms, engine-server and 
UDF E2E modules; `git diff --check` passed.
   - Compilation, unit tests, E2E and distributed runtime validation are 
pending GitHub CI or independent verification. No local tests were run.
   - No POM or dependency changes.
   


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