zhangshenghang opened a new pull request, #12529: URL: https://github.com/apache/seatunnel/pull/12529
### Purpose of this pull request Close #12520. The JDBC sink parses named parameters (`:name`) in user SQL with a regular expression whose character class does not include whitespace. When a sink column name contains a space, the token is cut at the space (`:first name` becomes parameter `first` plus a stray ` name`), so the parsed SQL is broken and statement creation fails. This PR passes the sink field names to the parser and matches a field name containing characters outside the regex name class (for example a space) as a whole-name placeholder: - `parseNamedStatement(sql, paramMap, knownParameterNames)` first tries the longest known field name that starts right after `:` and contains at least one character outside the name class, and is not followed by another name-class character (so a longer different token is never split). - Names made up only of name-class characters keep going through the previous tokenizer, so existing behavior is unchanged for them. - The two-argument `parseNamedStatement` overload keeps the previous behavior. ### Does this PR introduce _any_ user-facing change? Yes: column names containing characters outside the tokenizer name class (most notably spaces) now work in named-parameter SQL, which previously failed. Existing SQL statements keep parsing exactly as before. ### How was this patch tested? - Added unit tests in `FieldNamedPreparedStatementTest` covering: names with spaces, repeated parameters with spaces, longest-match preference, unchanged default behavior without known names, and end-to-end `prepareStatement` parameter binding via a mocked connection. - The existing special-character test (`testParseNamedStatementWithSpecialCharacters`) continues to pass unchanged. - `mvn -pl seatunnel-connectors-v2/connector-jdbc test`: all tests passing. - No E2E added: the change is a pure parser fix and databases accepting spaces in column names are exotic; the mocked `prepareStatement` test covers the full parsing/binding path. -- 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]
