oscerd opened a new pull request, #26007:
URL: https://github.com/apache/camel/pull/26007

   The `google-bigquery-sql` endpoint accepts two placeholder forms that behave 
differently:
   
   - `@name` is collected by `GoogleBigQuerySQLProducer.extractParameters` and 
bound through `QueryParameterValue` as a **named query parameter**. It travels 
to BigQuery separately from the query text.
   - `${name}` is replaced by `SqlHelper.translateQuery` with the literal 
`String` value of the matching header or exchange property, and **spliced into 
the query text** before the job is built.
   
   Both forms are needed: BigQuery named parameters can bind values but cannot 
bind identifiers, so a dataset or table name can only be supplied through 
`${name}`. That is what the published example shows (`delete * from 
${datasetId}.${tableId} where id=@myId`) and what `SqlHelperTest` asserts 
(`${report}`/`${import}` for dataset names, `@date`/`@id` for values).
   
   The documentation did not convey this split. It said only:
   
   > parameters in form `${name}` are extracted from message headers and formed 
the translated query
   
   That is accurate but incomplete — it does not state that the substitution is 
literal text rather than parameter binding, does not mention the identifier 
intent, and gives no guidance that values belong in `@name`. A reader can 
reasonably conclude `${name}` is a binding mechanism and use it for values.
   
   ## Changes
   
   **Documentation** — new `Query Placeholders` section in 
`google-bigquery-sql-component.adoc` that contrasts the two forms in a table, 
explains why identifiers cannot be parameter-bound, and directs values to 
`@name`.
   
   **Runtime** — `SqlHelper.translateQuery` now reports at WARN level when a 
`${name}` substitution does not have the shape of a BigQuery identifier. Only 
the placeholder name is logged, **never the substituted value**, which may be 
sensitive.
   
   This is not a behaviour change: the substitution itself is unchanged, so no 
upgrade-guide entry is needed. 
`SqlHelperTest.testTranslateQueryKeepsSubstitutingNonIdentifierValues` pins 
that.
   
   ## Tests
   
   - `SqlHelperIdentifierTest` (new) — identifier shapes accepted 
(`report_data`, `_private`, `test.table`, `project-17248459.dataset.table`) and 
rejected (empty, leading digit, embedded spaces, `;`, quote).
   - `SqlHelperTest.testTranslateQueryKeepsSubstitutingNonIdentifierValues` — 
the guard warns but does not alter the produced query text.
   
   Module build green (9 unit tests, 0 failures). Full reactor build passes; 
the regenerated catalog copy of the doc is included in the commit.
   
   _Claude Code on behalf of oscerd_


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