Skip to content
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

Closed

Conversation

robinf95
Copy link
Contributor

@robinf95 robinf95 commented Feb 7, 2024

Description

Refactored Glob.globMatch by using iterative approach

Related Issues

Resolves #12065

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Failing checks are inspected and point to the corresponding known issue(s) (See: Troubleshooting Failing Builds)
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)
  • Public documentation issue/PR created

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.

@github-actions github-actions bot added good first issue Good for newcomers Search Search query, autocomplete ...etc labels Feb 7, 2024
Copy link
Contributor

github-actions bot commented Feb 7, 2024

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

Copy link
Contributor

github-actions bot commented Feb 7, 2024

Compatibility status:

Checks if related components are compatible with change 5b6ee3f

Incompatible components

Skipped components

Compatible components

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

@deshsidd
Copy link
Contributor

deshsidd commented Feb 7, 2024

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]>
@robinf95 robinf95 force-pushed the bug/12065-refac-glob-matching branch from fa59c6c to 79117b6 Compare February 9, 2024 07:29
Copy link
Contributor

github-actions bot commented Feb 9, 2024

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

Copy link
Contributor

github-actions bot commented Feb 9, 2024

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

@robinf95 robinf95 requested a review from deshsidd February 10, 2024 07:20
patternIndex++;
wildcardStringIndex = stringIndex;
} else if (wildcardIndex != -1) {
// last pattern pointer was a wildcard
Copy link
Contributor

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"));
Copy link
Contributor

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++;
Copy link
Contributor

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?

@opensearch-trigger-bot
Copy link
Contributor

This PR is stalled because it has been open for 30 days with no activity.

@opensearch-trigger-bot opensearch-trigger-bot bot added the stalled Issues that have stalled label Mar 14, 2024
}
partIndex = str.indexOf(part, partIndex + 1);

int stringIndex = 0;
Copy link
Member

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?

@opensearch-trigger-bot opensearch-trigger-bot bot removed the stalled Issues that have stalled label Mar 26, 2024
@opensearch-trigger-bot
Copy link
Contributor

This PR is stalled because it has been open for 30 days with no activity.

@opensearch-trigger-bot opensearch-trigger-bot bot added the stalled Issues that have stalled label Apr 25, 2024
@kkhatua
Copy link
Member

kkhatua commented Jul 30, 2024

@cwperks
The original issue #12065 seems to be resolved by #13104 .
Can we close this PR as it is not needed?

@cwperks
Copy link
Member

cwperks commented Jul 30, 2024

@kkhatua Yes, this can be closed.

@kkhatua kkhatua closed this Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers Search Search query, autocomplete ...etc stalled Issues that have stalled
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Refactor] Replace recursive Glob.globMatch with iterative approach
5 participants