-
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
[rule based autotagging] add attribute value store #17342
base: main
Are you sure you want to change the base?
[rule based autotagging] add attribute value store #17342
Conversation
Signed-off-by: Kaushal Kumar <[email protected]>
Signed-off-by: Kaushal Kumar <[email protected]>
❌ Gradle check result for f575fbd: 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? |
...oad-management/src/main/java/org/opensearch/plugin/wlm/rule/storage/AttributeValueStore.java
Outdated
Show resolved
Hide resolved
...oad-management/src/main/java/org/opensearch/plugin/wlm/rule/storage/AttributeValueStore.java
Outdated
Show resolved
Hide resolved
...workload-management/src/main/java/org/opensearch/plugin/wlm/rule/storage/TrieBasedStore.java
Outdated
Show resolved
Hide resolved
...workload-management/src/main/java/org/opensearch/plugin/wlm/rule/storage/TrieBasedStore.java
Outdated
Show resolved
Hide resolved
...workload-management/src/main/java/org/opensearch/plugin/wlm/rule/storage/TrieBasedStore.java
Outdated
Show resolved
Hide resolved
...oad-management/src/main/java/org/opensearch/plugin/wlm/rule/storage/AttributeValueStore.java
Outdated
Show resolved
Hide resolved
...oad-management/src/main/java/org/opensearch/plugin/wlm/rule/storage/AttributeValueStore.java
Outdated
Show resolved
Hide resolved
...workload-management/src/main/java/org/opensearch/plugin/wlm/rule/storage/TrieBasedStore.java
Outdated
Show resolved
Hide resolved
...workload-management/src/main/java/org/opensearch/plugin/wlm/rule/storage/TrieBasedStore.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Kaushal Kumar <[email protected]>
Signed-off-by: Kaushal Kumar <[email protected]>
❌ Gradle check result for 24c4ea6: 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: Kaushal Kumar <[email protected]>
❌ Gradle check result for acdb27c: 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? |
❌ Gradle check result for acdb27c: 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? |
/** | ||
* Adds the value to the data structure | ||
* @param key to be added | ||
* @param value to be added | ||
*/ | ||
void add(K key, V value); |
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.
Did we not agree to make this put
?
* It is important to find the largest matching prefix key in the trie efficiently | ||
* Hence we can do binary search | ||
*/ | ||
String longestMatchingPrefix = findLongestMatchingPrefix(key); |
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.
nit: can be final?
int high = key.length() - 1; | ||
|
||
while (low < high) { | ||
int mid = low + (high - low + 1) / 2; |
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.
shouldn't this just be be (low + high) / 2 + 1? or (low+high+1)/2?
|
||
while (low < high) { | ||
int mid = low + (high - low + 1) / 2; | ||
String possibleMatchingPrefix = key.substring(0, mid); |
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.
nit: can be done inline
|
||
/** | ||
* Returns the value associated with the key | ||
* @param key in the data structure |
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.
nit: key in the attribute value store
Optional<V> get(K key); | ||
|
||
/** | ||
* Clears all the keys and their associated values from the structure |
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.
nit: values from the attribute value store
|
||
/** | ||
* It returns the number of values stored | ||
* @return count of key,val pairs in the store |
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.
nit: attribute value store is more appropriate
Description
This change will allow us to store prefix based string values in-memory structures. This will be fundamental to process Rules or any prefix based structure in memory.
Changes in this PR
Related Issues
#16797 (comment)
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.