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

feat: Able to pretty print sql query result in http output #3539

Merged
merged 5 commits into from
Mar 20, 2024
Merged

feat: Able to pretty print sql query result in http output #3539

merged 5 commits into from
Mar 20, 2024

Conversation

YCCDSZXH
Copy link
Contributor

@YCCDSZXH YCCDSZXH commented Mar 19, 2024

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

This closes #2877

What's changed and what's your intention?

src/servers/src/http.rs
src/servers/src/http/handler.rs
src/servers/src/http/table_result.rs

Able to pretty print sql query result in http output.
Like this:
alacritty_9Un1vayqBw

Please explain IN DETAIL what the changes are in this PR and why they are needed:

  • Summarize your change (mandatory)
    Format the output like Clikehouse's Pretty .
  • How does this PR work? Need a brief introduction for the changed logic (optional)
    Caculate each column's max width, and then print the result.
  • Describe clearly one logical change and avoid lazy messages (optional)
  • Describe any limitations of the current code (optional)
    It does'not work well in browser.
    alacritty_YCHhQXIjYr

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR does not require documentation updates.

@github-actions github-actions bot added the docs-not-required This change does not impact docs. label Mar 19, 2024
@tisonkun
Copy link
Contributor

Cool! I like the result. Let me take a closer look at the implementation.

@tisonkun tisonkun requested review from tisonkun, fengjiachun, shuiyisong and MichaelScofield and removed request for tisonkun March 19, 2024 04:02
Copy link

codecov bot commented Mar 19, 2024

Codecov Report

Attention: Patch coverage is 28.18182% with 79 lines in your changes are missing coverage. Please review.

Project coverage is 84.99%. Comparing base (9816d2a) to head (6bd2135).

❗ Current head 6bd2135 differs from pull request most recent head e84e7da. Consider uploading reports for the commit e84e7da to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3539      +/-   ##
==========================================
- Coverage   85.37%   84.99%   -0.38%     
==========================================
  Files         909      910       +1     
  Lines      151814   151922     +108     
==========================================
- Hits       129613   129128     -485     
- Misses      22201    22794     +593     

src/servers/src/http/table_result.rs Outdated Show resolved Hide resolved
@YCCDSZXH YCCDSZXH marked this pull request as draft March 19, 2024 15:12
@YCCDSZXH YCCDSZXH marked this pull request as ready for review March 19, 2024 15:46
Copy link
Contributor

@shuiyisong shuiyisong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, LGTM

@shuiyisong shuiyisong added this pull request to the merge queue Mar 20, 2024
Merged via the queue into GreptimeTeam:main with commit 6377982 Mar 20, 2024
32 checks passed

impl TableResponse {
pub async fn from_output(outputs: Vec<crate::error::Result<Output>>) -> HttpResponse {
match handler::from_output(ResponseFormat::Csv, outputs).await {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo csv.

But we don't need it at all.

I'm working on a patch to clean up all these unnecessary extra format param.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Able to pretty print sql query result in http output
4 participants