Skip to content

When dolt diff -r sql encounters a schema change, it should either print the full diff or return an error#11002

Merged
nicktobey merged 11 commits into
mainfrom
nicktobey/sqldiff
May 8, 2026
Merged

When dolt diff -r sql encounters a schema change, it should either print the full diff or return an error#11002
nicktobey merged 11 commits into
mainfrom
nicktobey/sqldiff

Conversation

@nicktobey
Copy link
Copy Markdown
Contributor

Previously, whenever a table had a schema change, dolt diff -r sql would skip printing the data diff for that table. It would print a message to stderr, but still return a 0 error code. This is misleading, especially if the diff command is called by an automated process.

This PR improves the situations where we successfully render the data diff. In situations where we can't, we return a nonzero error code.

nicktobey added 2 commits May 5, 2026 18:17
…s changed, in limited cases.

In cases where we can't, we should return a nonzero status code in addition to the error, to make it clear that the returned SQL script is not a full diff.
@nicktobey nicktobey changed the title When dolt diff -r sql encounters, a schema change, it should either print the full diff or return an error When dolt diff -r sql encounters a schema change, it should either print the full diff or return an error May 6, 2026
@coffeegoddd
Copy link
Copy Markdown
Contributor

coffeegoddd commented May 6, 2026

@nicktobey DOLT

read_tests from_latency to_latency percent_change
covering_index_scan 0.54 0.54 0.0
groupby_scan 9.73 9.91 1.85
index_join 1.76 1.82 3.41
index_join_scan 1.32 1.32 0.0
index_scan 22.28 22.28 0.0
oltp_point_select 0.26 0.25 -3.85
oltp_read_only 5.0 5.0 0.0
select_random_points 0.5 0.5 0.0
select_random_ranges 0.56 0.56 0.0
table_scan 22.28 22.28 0.0
types_table_scan 47.47 47.47 0.0
write_tests from_latency to_latency percent_change
oltp_delete_insert 6.32 6.32 0.0
oltp_insert 3.07 3.07 0.0
oltp_read_write 11.04 11.04 0.0
oltp_update_index 3.19 3.19 0.0
oltp_update_non_index 3.02 3.02 0.0
oltp_write_only 5.99 5.99 0.0
types_delete_insert 6.67 6.67 0.0

@coffeegoddd
Copy link
Copy Markdown
Contributor

@nicktobey DOLT

comparing_percentages
100.000000 to 100.000000
version result total
af40a9c ok 5937471
version total_tests
af40a9c 5937471
correctness_percentage
100.0

@coffeegoddd
Copy link
Copy Markdown
Contributor

coffeegoddd commented May 6, 2026

@nicktobey DOLT

test_name from_latency_p95 to_latency_p95 percent_change
tpcc-scale-factor-1 53.85 54.83 1.82
test_name from_server_name from_server_version from_tps to_server_name to_server_version to_tps percent_change
tpcc-scale-factor-1 dolt 577c666 45.61 dolt 617f67c 45.24 -0.81

@coffeegoddd
Copy link
Copy Markdown
Contributor

@nicktobey DOLT

comparing_percentages
100.000000 to 100.000000
version result total
04222a0 ok 5937471
version total_tests
04222a0 5937471
correctness_percentage
100.0

@coffeegoddd
Copy link
Copy Markdown
Contributor

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
9a12ee9 ok 5937471
version total_tests
9a12ee9 5937471
correctness_percentage
100.0

…or columns that will actually exist when the SQL is run.
@coffeegoddd
Copy link
Copy Markdown
Contributor

@nicktobey DOLT

comparing_percentages
100.000000 to 100.000000
version result total
6c6cbc0 ok 5937471
version total_tests
6c6cbc0 5937471
correctness_percentage
100.0

@coffeegoddd
Copy link
Copy Markdown
Contributor

@nicktobey DOLT

comparing_percentages
100.000000 to 100.000000
version result total
f2a5dfe ok 5937471
version total_tests
f2a5dfe 5937471
correctness_percentage
100.0

@coffeegoddd
Copy link
Copy Markdown
Contributor

@nicktobey DOLT

comparing_percentages
100.000000 to 100.000000
version result total
a969770 ok 5937471
version total_tests
a969770 5937471
correctness_percentage
100.0

Copy link
Copy Markdown
Contributor

@elianddb elianddb left a comment

Choose a reason for hiding this comment

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

lgtm! one comment on the error printing

verr := diffUserTable(queryist, sqlCtx, delta, dArgs, dw)
if verr != nil {
return verr
cli.PrintErrln(verr.Verbose())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is generating duplicate errors on the CLI.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The idea was to show the error both inline in the output, and summarized again at the end. But it ends up looking repetitive when there's only one skipped table.

I changed it to not repeat the error messages at the end.

@coffeegoddd
Copy link
Copy Markdown
Contributor

@nicktobey DOLT

comparing_percentages
100.000000 to 100.000000
version result total
617f67c ok 5937471
version total_tests
617f67c 5937471
correctness_percentage
100.0

@nicktobey nicktobey merged commit 090798e into main May 8, 2026
33 of 36 checks passed
@nicktobey nicktobey deleted the nicktobey/sqldiff branch May 8, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants