-
Notifications
You must be signed in to change notification settings - Fork 141
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
Well format the raw response when query parameter "pretty" enabled #2727
Well format the raw response when query parameter "pretty" enabled #2727
Conversation
Signed-off-by: Lantao Jin <[email protected]>
be9dd71
to
1de2a5d
Compare
Signed-off-by: Lantao Jin <[email protected]>
private List<String> headers; | ||
private List<List<String>> data; | ||
private int[] maxWidths; |
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.
Could you refactor this class a little? I think this class was focus on sanitize only. After this, the class becomes more and more complex...
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.
Although this is existing code, I don't think having inner static classes inside is a good pattern. While refactoring can we separte it out and have individual classes for Sanitizer and Prettifier if possible[Up to you how you refactor].
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.
I've refactored for separating. Please take a look and provide feedbacks.
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.
Could you add Javadoc for new class? In future, I think we can refactor base, sanitizer, prettier by decorator as needed, e.g. sanitize and then pretty.
Signed-off-by: Lantao Jin <[email protected]>
Signed-off-by: Lantao Jin <[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.
Thanks for the changes!
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/sql/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/sql/backport-2.x
# Create a new branch
git switch --create backport/backport-2727-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 aec482577143a327a6dc94e073a0a6cec709a7ed
# Push it to GitHub
git push --set-upstream origin backport/backport-2727-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/sql/backport-2.x Then, create a pull request where the |
…pensearch-project#2727) Signed-off-by: Lantao Jin <[email protected]> (cherry picked from commit aec4825)
…2727) (#2829) Signed-off-by: Lantao Jin <[email protected]> (cherry picked from commit aec4825)
…pensearch-project#2727) Signed-off-by: Lantao Jin <[email protected]>
…pensearch-project#2727) Signed-off-by: Lantao Jin <[email protected]>
Description
Well format the
raw
response when query parameterpretty
enabled (/_plugins/_sql?format=raw&pretty=true
or/_plugins/_sql?format=raw&pretty
)Example:
$>curl -k -H 'Content-Type: application/json' -XPOST 'http://localhost:9200/_plugins/_sql?format=raw' -d '{"query": "SELECT type, manufacturer, customer_last_name, day_of_week, total_quantity, currency, taxless_total_price FROM opensearch_dashboards_sample_data_ecommerce LIMIT 5"}'
returns
$>curl -k -H 'Content-Type: application/json' -XPOST 'http://localhost:9200/_plugins/_sql?format=raw&pretty=true' -d '{"query": "SELECT type, manufacturer, customer_last_name, day_of_week, total_quantity, currency, taxless_total_price FROM opensearch_dashboards_sample_data_ecommerce LIMIT 5"}'
returns
Issues Resolved
#2718
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.