mattcasters opened a new pull request, #8034:
URL: https://github.com/apache/hop/pull/8034

   **Please** add a meaningful description for your change here
   
   ## Summary
   
   Table Input can now be designed without a live database, bind SQL by 
incoming field name, and take parameter rows from every incoming hop.
   
   ### Specify output fields (addresses #2722)
   
   Developers without database access can define the output schema on the 
**Fields** tab (`specify_fields`). Optional **Validate specified fields** 
compares query result names and types after execution. Missing specified fields 
still fail; extra result columns are ignored. When validation is off, type 
differences are converted.
   
   ### Named SQL parameters
   
   `{fieldName}` in SQL is bound as a JDBC prepared-statement parameter by 
incoming field name (case-insensitive, repeatable). Hop variables `${variable}` 
are left alone. Named parameters cannot be mixed with positional `?` in the 
same statement. New transforms default `use_named_parameters` to true; existing 
metadata stays false so curly braces already in SQL are unchanged.
   
   Enabling **Use named parameters** in the dialog also turns on **Execute for 
each row** when hops exist and, when there is a single incoming hop, fills 
**Insert data from transform**.
   
   ### Optional lookup / all incoming hops
   
   Parameter rows are read with `getRow()` from every incoming hop, not only 
the named info stream. **Insert data from transform** is optional: when set, 
that hop is still informational for backward compatibility. **Execute for each 
row** is the usual case (one query per incoming row from any hop). With it off, 
all incoming rows are concatenated into one parameter list — the legacy `WHERE 
bar IN (?,?,?)` path from several one-field rows. `execute_each_row` stays 
default false in metadata so static SQL with no hops still runs. Mixed-layout 
hops still produce the existing row-layout warning.
   
   Incoming parameter fields are not copied to the output.
   
   ## Compatibility
   
   - `lookup` remains in metadata and still marks the named hop as 
informational.
   - Existing XML with `<lookup>parameters</lookup>` and `execute_each_row=Y` 
still load/saves (`transform.xml`).
   - Existing XML with empty lookup, named parameters, and `execute_each_row=N` 
round-trips (`transform-named-no-lookup.xml`).
   - Assemble-all with a lookup name and no parameter rows still fails.
   - Positional `?` and variable substitution are unchanged.
   - `check()` validates named parameters against incoming hops without 
requiring a lookup; lookup-not-found is an error only when there are no hops.
   
   ## Test plan
   
   - [x] `TableInputMetaTest` load/save with lookup set (existing 
`transform.xml`, specify-fields included)
   - [x] `TableInputMetaTest` load/save with empty lookup and named parameters
   - [x] `TableInputMetaTest`: `execute_each_row` defaults to false; 
`getFields()` does not keep incoming parameter fields
   - [x] `TableInputMetaTest.check()`: named parameters OK with hops and empty 
lookup; error with no incoming hops; missing field; lookup name optional when 
other hops exist; positional `IN (?,?,?)` field count
   - [x] `TableInputSqlTest`: parse/bind named parameters, variables, 
quotes/comments, mixed placeholders, positional `?`
   - [x] `TableInputParametersTest`: concatenate three one-field rows for `IN 
(?,?,?)`; merge same-layout rows from two sources
   - [x] `mvn 
-Dtest=TableInputMetaTest,TableInputSqlTest,TableInputParametersTest test` in 
`plugins/transforms/tableinput`
   - [x] Integration tests added to `main-0008-table-input.hwf`: named 
parameter, execute-each-row, multi-parameter, named+variable, specify-fields
   - [x] Manual pipelines: extra hop is no longer ignored; mixed-layout warning 
still appears; optional lookup executes once per input row
   - [ ] CI: `mvn clean install apache-rat:check` on the PR
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us 
incorporate your contribution quickly and easily:
   - [x] Run `mvn clean install apache-rat:check` to make sure basic checks 
pass. A more thorough check will be performed on your pull request 
automatically.
   - [x] If you have a group of commits related to the same change, please 
squash your commits into one and force push your branch using `git rebase -i`.
   - [x] Mention the appropriate issue in your description (for example: 
`addresses #123`), if applicable.
   
   To make clear that you license your contribution under the [Apache License 
Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
   - [x] I hereby declare this contribution to be licensed under the [Apache 
License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   - [ ] In any other case, please file an [Apache Individual Contributor 
License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   Addresses #2722


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