Skip to content

Commit e5ebae7

Browse files
committed
Skip estimates and analysis for keyless table plan tests.
The difference between setting an expected value to "skip" vs omitting is how plangen treats it: plangen will generate omitted estimates (since we typically want them) but will avoid generating estimates that are explicitly skipped. This is because of dolthub/dolt#10160
1 parent 0e8a922 commit e5ebae7

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

enginetest/enginetests.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,12 +724,12 @@ func TestQueryPlan(t *testing.T, harness Harness, e QueryEngine, tt queries.Quer
724724
runTestWithDescribeOptions(t, tt.Query, tt.ExpectedPlan, sql.DescribeOptions{
725725
Debug: true,
726726
})
727-
if tt.ExpectedEstimates != "" {
727+
if tt.ExpectedEstimates != "" && tt.ExpectedEstimates != "skip" {
728728
runTestWithDescribeOptions(t, tt.Query, tt.ExpectedEstimates, sql.DescribeOptions{
729729
Estimates: true,
730730
})
731731
}
732-
if tt.ExpectedAnalysis != "" {
732+
if tt.ExpectedAnalysis != "" && tt.ExpectedAnalysis != "skip" {
733733
runTestWithDescribeOptions(t, tt.Query, tt.ExpectedAnalysis, sql.DescribeOptions{
734734
Estimates: true,
735735
Analyze: true,

enginetest/plangen/cmd/plangen/main.go

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -209,19 +209,28 @@ func generatePlansForSuite(spec PlanSpec, w *bytes.Buffer) error {
209209

210210
if node.IsReadOnly() {
211211
_, _ = w.WriteString(`ExpectedEstimates: `)
212-
planString = sql.Describe(enginetest.ExtractQueryNode(node), sql.DescribeOptions{
213-
Estimates: true,
214-
})
212+
var planString string
213+
if tt.ExpectedEstimates != "skip" {
214+
planString = sql.Describe(enginetest.ExtractQueryNode(node), sql.DescribeOptions{
215+
Estimates: true,
216+
})
217+
} else {
218+
planString = "skip"
219+
}
215220
writePlanString(w, planString)
216-
err = enginetest.ExecuteNode(ctx, engine, node)
217-
if err != nil {
218-
exit(fmt.Errorf("%w\nfailed to execute query: %s", err, tt.Query))
221+
if tt.ExpectedAnalysis != "skip" {
222+
err = enginetest.ExecuteNode(ctx, engine, node)
223+
if err != nil {
224+
exit(fmt.Errorf("%w\nfailed to execute query: %s", err, tt.Query))
225+
}
226+
_, _ = w.WriteString(`ExpectedAnalysis: `)
227+
planString = sql.Describe(enginetest.ExtractQueryNode(node), sql.DescribeOptions{
228+
Analyze: true,
229+
Estimates: true,
230+
})
231+
} else {
232+
planString = "skip"
219233
}
220-
_, _ = w.WriteString(`ExpectedAnalysis: `)
221-
planString = sql.Describe(enginetest.ExtractQueryNode(node), sql.DescribeOptions{
222-
Analyze: true,
223-
Estimates: true,
224-
})
225234
writePlanString(w, planString)
226235
}
227236
} else {

0 commit comments

Comments
 (0)