-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug/12065 refac glob matching #12225
Bug/12065 refac glob matching #12225
Conversation
Signed-off-by: Robin Friedmann <[email protected]>
❌ Gradle check result for fa59c6c: 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? |
Compatibility status:Checks if related components are compatible with change 5b6ee3f Incompatible componentsSkipped componentsCompatible componentsCompatible components: [https://github.com/opensearch-project/custom-codecs.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/flow-framework.git, https://github.com/opensearch-project/security-analytics.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/reporting.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/sql.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/performance-analyzer.git] |
Build still failing please check and resubmit. |
Signed-off-by: Robin Friedmann <[email protected]> Refactored Glob.globMatch by using iterative approach; added unit tests (opensearch-project#12065) Signed-off-by: Robin Friedmann <[email protected]>
fa59c6c
to
79117b6
Compare
❌ Gradle check result for 79117b6: 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? |
Signed-off-by: Robin Friedmann <[email protected]>
❌ Gradle check result for 5b6ee3f: 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? |
patternIndex++; | ||
wildcardStringIndex = stringIndex; | ||
} else if (wildcardIndex != -1) { | ||
// last pattern pointer was a wildcard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you a comment on what this block does? My understanding is that there was not a match, so you reset pointers from last wildcard and restart the search
public void testGlobMatchMultipleWildcardsWithMultipleCharacters() { | ||
assertTrue(Glob.globMatch("a*b*c", "abc")); | ||
assertTrue(Glob.globMatch("a*b*c", "axxxbxbc")); | ||
assertTrue(Glob.globMatch("a*b*c", "aabc")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test for match("best*test", "bestbuy")
} else if (wildcardIndex != -1) { | ||
// last pattern pointer was a wildcard | ||
patternIndex = wildcardIndex + 1; | ||
wildcardStringIndex++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should wildCardIndex be set to -1 here? After one match, we can forever fall this if block right?
This PR is stalled because it has been open for 30 days with no activity. |
} | ||
partIndex = str.indexOf(part, partIndex + 1); | ||
|
||
int stringIndex = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this logic any different then Regex.simpleMatchWithNormalizedStrings
. If they are identical then can they be written and tested in a common place?
This PR is stalled because it has been open for 30 days with no activity. |
@kkhatua Yes, this can be closed. |
Description
Refactored Glob.globMatch by using iterative approach
Related Issues
Resolves #12065
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.