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

Fix row count for the 'sql' command #745

Merged
merged 1 commit into from
Jan 23, 2024
Merged

Fix row count for the 'sql' command #745

merged 1 commit into from
Jan 23, 2024

Conversation

mamcx
Copy link
Contributor

@mamcx mamcx commented Jan 23, 2024

Description of Changes

The tabled library add the header as part of the number of rows...

API and ABI breaking changes

If this is an API or ABI breaking change, please apply the
corresponding GitHub label.

Expected complexity level and risk

1

@mamcx mamcx requested a review from jdetter January 23, 2024 17:32
@mamcx mamcx self-assigned this Jan 23, 2024
@@ -112,7 +112,8 @@ pub(crate) async fn run_sql(builder: RequestBuilder, sql: &str, with_stats: bool
.map(|stmt_result| {
let mut table = stmt_result_to_table(stmt_result)?;
if with_stats {
let row_count = print_row_count(table.count_rows());
// The `tabled::count_rows` add the header as a row, so subtract it.
let row_count = print_row_count(table.count_rows().wrapping_sub(1));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you able to update count_rows instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, that is from a external crate tabled

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree that this is super jank but if this is how the external crate determines this value then I think this is the best we can do 🤷‍♂️

Copy link
Collaborator

@jdetter jdetter left a comment

Choose a reason for hiding this comment

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

Looks fine 👍

@mamcx mamcx added this pull request to the merge queue Jan 23, 2024
Merged via the queue into master with commit be60691 Jan 23, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants