-
Notifications
You must be signed in to change notification settings - Fork 33
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
Percent-encode invalid flint index characters #215
Percent-encode invalid flint index characters #215
Conversation
Signed-off-by: Sean Kao <[email protected]>
Signed-off-by: Sean Kao <[email protected]>
flint-spark-integration/src/main/scala/org/opensearch/flint/spark/FlintSparkIndex.scala
Outdated
Show resolved
Hide resolved
flint-spark-integration/src/main/scala/org/opensearch/flint/spark/FlintSparkIndex.scala
Outdated
Show resolved
Hide resolved
Signed-off-by: Sean Kao <[email protected]>
StringBuilder builder = new StringBuilder(indexName.length()); | ||
for (char ch : indexName.toCharArray()) { | ||
if (charsToEncode.contains(ch)) { | ||
builder.append("%").append(String.format("%02X", (int) ch)); |
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.
slightly prefer this over builder.append(String.format("%%%02X", (int) ch))
. suggestions are welcome
edit: did a bit more reading and changed my mind
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.
Thanks for the changes!
flint-core/src/main/scala/org/opensearch/flint/core/storage/FlintOpenSearchClient.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Sean Kao <[email protected]>
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.
Lgtm
FYI, the |
Signed-off-by: Sean Kao <[email protected]>
@dai-chen I couldn't merge nor add label 😞 |
No worries. Let me do it. :) |
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/opensearch-spark/backport-0.1 0.1
# Navigate to the new working tree
pushd ../.worktrees/opensearch-spark/backport-0.1
# Create a new branch
git switch --create backport/backport-215-to-0.1
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 3528b6660f7f1ddb2fbb9d0af8a0748e545424e3
# Push it to GitHub
git push --set-upstream origin backport/backport-215-to-0.1
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/opensearch-spark/backport-0.1 Then, create a pull request where the |
@seankao-az Auto backport failed. Could you check if any conflict and publish backport PR manually? |
* percent-encode invalid flint index characters Signed-off-by: Sean Kao <[email protected]> * formatting Signed-off-by: Sean Kao <[email protected]> * move encoding logic to FlintOpenSearchClient Signed-off-by: Sean Kao <[email protected]> * minor arg fix and string format fix Signed-off-by: Sean Kao <[email protected]> * fix import order Signed-off-by: Sean Kao <[email protected]> --------- Signed-off-by: Sean Kao <[email protected]> (cherry picked from commit 3528b66)
* percent-encode invalid flint index characters Signed-off-by: Sean Kao <[email protected]> * formatting Signed-off-by: Sean Kao <[email protected]> * move encoding logic to FlintOpenSearchClient Signed-off-by: Sean Kao <[email protected]> * minor arg fix and string format fix Signed-off-by: Sean Kao <[email protected]> * fix import order Signed-off-by: Sean Kao <[email protected]> --------- Signed-off-by: Sean Kao <[email protected]> (cherry picked from commit 3528b66)
Description
Handle special characters when generating Flint index name by percent-encoding the invalid OpenSearch index name characters.
Issues Resolved
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.