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

Local results and perf comparisons for queries #6206

Merged
merged 5 commits into from
Jan 31, 2025
Merged

Conversation

clee2000
Copy link
Contributor

Second commit onwards are the actual changes. The first commit just changes all the formatting for the existing files.

This changes the formatting of the params.json file to allow for example inputs for the queries that can be used to compare results and performance to be used in the script mentioned below. The new format can be seen in the README.

This also adds a script to get compare time and memory a query uses between local and a specific commit. It can also compare what the query returns.

Copy link

vercel bot commented Jan 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
torchci ✅ Ready (Inspect) Visit Preview Jan 31, 2025 6:19pm

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 22, 2025
@clee2000 clee2000 force-pushed the csl/ch_query_perf_local branch 2 times, most recently from 3d18cc9 to e93971e Compare January 22, 2025 21:43
"params": {
"shas": "String"
},
"tests": []
Copy link
Contributor

@huydhn huydhn Jan 24, 2025

Choose a reason for hiding this comment

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

We will probably need a linter for this later to enforce this structure I guess, maybe put up a warning about having no test case

Copy link
Contributor Author

@clee2000 clee2000 Jan 29, 2025

Choose a reason for hiding this comment

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

Added a simple linter for the structure but it doesn't check much more than that. No warnings for test cases yet

for i, test in enumerate(tests):
new_results = query_clickhouse(query, test)
base_results = query_clickhouse(base_query, test)
if new_results != base_results:
Copy link
Contributor

Choose a reason for hiding this comment

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

This comparison might be brittle if the results returned by the query is not sorted. But I think we could keep it simple with the current implementation.

A more complex approach would be to provide an option to compare the results in strict mode (same order) and relax mode (in any order)

Copy link
Contributor Author

@clee2000 clee2000 Jan 29, 2025

Choose a reason for hiding this comment

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

Weirdly, a lot of clickhouse results are ordered, probably because the table themselves have orderings.
Added an arg to sort the results when comparing

print(table)


def results_compare(args: argparse.Namespace) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

For the comparison, an edge case might be when adding a new query or, in rarer case, to delete one.

Copy link
Contributor

@huydhn huydhn left a comment

Choose a reason for hiding this comment

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

Awesome! This is a solid foundation for future improvements of CH queries

@clee2000 clee2000 force-pushed the csl/ch_query_perf_local branch from 0fb6559 to e367365 Compare January 31, 2025 18:18
@clee2000 clee2000 merged commit 063abf8 into main Jan 31, 2025
8 checks passed
@clee2000 clee2000 deleted the csl/ch_query_perf_local branch January 31, 2025 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants