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: impl Display for Statement #3744

Merged
merged 22 commits into from
Apr 24, 2024

Conversation

irenjj
Copy link
Collaborator

@irenjj irenjj commented Apr 19, 2024

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

close #3646

What's changed and what's your intention?

Implement Display for Statement.

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 Apr 19, 2024
@irenjj
Copy link
Collaborator Author

irenjj commented Apr 19, 2024

hi @tisonkun , I've finished the main logic. Could you please help check if there are any issues? Afterwards, I will add tests based on this.

Copy link
Collaborator

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

Thank you! This patch goes in the good direction. Comments inline.

Copy link
Collaborator

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

Rest LGTM. You can start to write test. Thank you!

@irenjj irenjj marked this pull request as ready for review April 22, 2024 14:06
@irenjj irenjj requested a review from a team as a code owner April 22, 2024 14:06
Copy link

codecov bot commented Apr 22, 2024

Codecov Report

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

Project coverage is 85.24%. Comparing base (42e7403) to head (a7592a7).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3744      +/-   ##
==========================================
- Coverage   85.59%   85.24%   -0.36%     
==========================================
  Files         947      947              
  Lines      160612   161309     +697     
==========================================
+ Hits       137482   137510      +28     
- Misses      23130    23799     +669     

Copy link
Collaborator

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

I'll give this patch another round tomorrow, and I suggest you revise it once more with this comment b24d334#r1576504197 in consideration.

Signed-off-by: tison <[email protected]>
@tisonkun
Copy link
Collaborator

I push a commit to resolve most of the comments above. Now the remaining part is:

  • create.rs
  • copy.rs

I'll give another round tomorrow.

Signed-off-by: tison <[email protected]>
@tisonkun
Copy link
Collaborator

tisonkun commented Apr 24, 2024

cc @killme2008 @MichaelScofield in the follow-up we'd change the SQL logging logics with these Display implementations:

                        Err(e) => {
                            let redacted = sql::util::redact_sql_secrets(query.as_ref());
                            if e.status_code().should_log_error() {
                                error!(e; "Failed to execute query: {redacted}");
                            } else {
                                debug!("Failed to execute query: {redacted}, {e}");
                            }

                            results.push(Err(e));
                            break;
                        }

to

                        Err(e) => {
                            if e.status_code().should_log_error() {
                                error!(e; "Failed to execute query: {stmt}");
                            } else {
                                debug!("Failed to execute query: {stmt}, {e}");
                            }

                            results.push(Err(e));
                            break;

see #3646 for more details.

@tisonkun tisonkun force-pushed the display_for_statement branch from e28d7d4 to c21ee4c Compare April 24, 2024 01:52
Signed-off-by: tison <[email protected]>
@tisonkun tisonkun force-pushed the display_for_statement branch from c21ee4c to 320cffd Compare April 24, 2024 01:54
Signed-off-by: tison <[email protected]>
Copy link
Contributor

@killme2008 killme2008 left a comment

Choose a reason for hiding this comment

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

Fantastic effort and dedication! Many thanks! I've included some suggestions for your consideration. Please review them. @irenjj

src/sql/src/statements.rs Show resolved Hide resolved
src/sql/src/statements.rs Outdated Show resolved Hide resolved
src/sql/src/statements.rs Outdated Show resolved Hide resolved
src/sql/src/statements.rs Outdated Show resolved Hide resolved
src/sql/src/statements/describe.rs Show resolved Hide resolved
src/sql/src/statements/tql.rs Outdated Show resolved Hide resolved
src/sql/src/statements.rs Outdated Show resolved Hide resolved
src/sql/src/statements/copy.rs Show resolved Hide resolved
Signed-off-by: tison <[email protected]>
@tisonkun tisonkun force-pushed the display_for_statement branch from b755880 to 3e36273 Compare April 24, 2024 06:18
Copy link
Contributor

@killme2008 killme2008 left a comment

Choose a reason for hiding this comment

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

LGTM

@tisonkun tisonkun added this pull request to the merge queue Apr 24, 2024
Merged via the queue into GreptimeTeam:main with commit 62037ee Apr 24, 2024
18 checks passed
@irenjj irenjj deleted the display_for_statement branch May 17, 2024 13:22
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.

impl Display for Statement
4 participants