OpenSearch icon indicating copy to clipboard operation
OpenSearch copied to clipboard

[Refactor] Replace recursive FilterPath.parse with iterative approach

Open cwperks opened this issue 1 year ago • 1 comments

Describe the bug

This issue is related to a recent pull request: https://github.com/opensearch-project/OpenSearch/pull/11060

There is another instance of recursion used in the FilterPath.parse method which appears inefficient and unnecessary. It appears to be ignoring repeat . until the last is located and could more optimally skip until the last . in the sequence instead of recursing.

Additional Context

In https://github.com/opensearch-project/OpenSearch/pull/11060, there was a recursive method for evaluating core's own Regex class. The method simpleMatchWithNormalizedString was refactored from a recursive approach to an iterative approach for more predictable space and runtime complexity.

  • [ ] Refactor FilterPath.parse to use iterative method
  • [ ] Update FilterPathTests to cover more scenarios

Related component

Search

To Reproduce

Should maintain same behavior as now

Expected behavior

Should maintain same behavior as now

Additional Details

No response

cwperks avatar Jan 29 '24 16:01 cwperks

[Triage - attendees 1 2 3 4 5 6 7 8] @cwperks Thanks for filing, we'd gladly review a pull request.

peternied avatar Jan 31 '24 16:01 peternied

We discussed this in the Search community meeting today. @jainankitk is going to take a stab at it this week.

getsaurabh02 avatar May 22 '24 16:05 getsaurabh02

@niyatiagg - Can you help with this issue?

jainankitk avatar May 29 '24 16:05 jainankitk