fix(bigquery-jdbc): Add escape character support for pattern matching#13259
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the compileSqlLikePattern method in BigQueryDatabaseMetaData to correctly handle escaped SQL wildcards and regex metacharacters, ensuring that backslashes are treated as escape characters. It also includes new unit tests to verify the behavior of escaped underscores and percent signs. Review feedback suggests simplifying the pattern compilation logic to reduce code duplication and refactoring the isRegexMetacharacter helper method to be static and more concise.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the compileSqlLikePattern method in BigQueryDatabaseMetaData to support escaped SQL LIKE wildcards using a state-based parsing approach. It also introduces a helper method to identify regex metacharacters and adds unit tests for escaped underscores and percent signs. Feedback suggests addressing a bug where trailing backslashes are ignored and recommends adding more comprehensive test cases for escaped backslashes and trailing escape characters.
Various metadata methods (
getColumns,getTables) rely on pattern matching. This PR adds a support for the escape character in these pattern matches.Example of issue:
test\_tableis not matchingtest_table.