-
-
Notifications
You must be signed in to change notification settings - Fork 238
[no-release-notes] generate query script plans #3120
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
Conversation
d32306e to
2fa0640
Compare
enginetest/queries/script_queries.go
Outdated
| // ExpectedColumns indicates the Name and Type of the columns expected; no other schema fields are tested. | ||
| ExpectedColumns sql.Schema | ||
|
|
||
| // TODO: replace this with ExpectedPlan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be replaced with ExpectedPlan. There's a lot of cases where you don't care about the exact plan, only that a certain index or join type gets used. Forcing the test to validate a specific plan makes the test much more brittle.
enginetest/queries/script_queries.go
Outdated
| // The string representation of indexes that we expect to appear in the query plan | ||
| ExpectedIndexes []string | ||
|
|
||
| // TODO: replace this with ExpectedPlan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
| fmt.Fprintf(&buf, `// Copyright 2024 Dolthub, Inc. | ||
| func writeHeader(buf *bytes.Buffer, pkg string) { | ||
| _, _ = fmt.Fprint(buf, "// Code generated by plangen.\n\n") | ||
| _, _ = fmt.Fprint(buf, `// Copyright 2024-2025 Dolthub, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can just say 2025
This PR adds a way to write script plan tests and includes code to generate plans as well.
This allows us to write script tests that also enforce specific query plans.