Fix for converting SQL wildcard to Lucene syntax#21739
Conversation
Adding convertSqlWildcardToLucene method that converts SQL wildcards (% → *, _ → ?) with escape handling. Signed-off-by: Suresh N S <nssuresh@amazon.com>
PR Reviewer Guide 🔍(Review updated until commit 221ef48)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 221ef48 Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 221ef48
Suggestions up to commit b8da55a
|
Signed-off-by: Suresh N S <nssuresh@amazon.com>
|
Persistent review updated to latest commit 221ef48 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #21739 +/- ##
============================================
+ Coverage 73.33% 73.34% +0.01%
+ Complexity 74996 74973 -23
============================================
Files 6012 6012
Lines 340934 340934
Branches 49076 49076
============================================
+ Hits 250021 250075 +54
+ Misses 71005 70969 -36
+ Partials 19908 19890 -18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Persistent review updated to latest commit 221ef48 |
|
❌ Gradle check result for 221ef48: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Fix: SQL wildcard characters not converted to Lucene wildcards in WildcardQuerySerializer
Problem:
The WildcardQuerySerializer was passing SQL wildcard patterns directly to Lucene's WildcardQueryBuilder without conversion. SQL uses % (match any sequence) and _ (match
single character), but Lucene expects * and ? respectively. This caused the following integration tests to fail:
Root Cause:
createQueryBuilder() passed the raw query pattern to WildcardQueryBuilder without translating SQL wildcard syntax to Lucene wildcard syntax.
Fix:
Added convertSqlWildcardToLucene() which translates the pattern before query construction:
Testing:
Added 5 unit tests covering basic conversion, escape handling, mixed escaped/unescaped patterns, and passthrough of native Lucene wildcards.
Related Issues
Resolves #21738
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.