-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
exec: add nulls injection test to runTests harness #40658
Conversation
pkg/sql/exec/utils_test.go
Outdated
@@ -372,7 +460,7 @@ func (s *opTestInput) Next(context.Context) coldata.Batch { | |||
// If useSel is false, then the selection vector will contain | |||
// [0, ..., batchSize] in ascending order. | |||
outputIdx := s.selection[j] | |||
if tups[j][i] == nil { | |||
if tups[j][i] == nil || s.injectNulls { |
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 seems to be all-nulls injection. I think we should try injecting random nulls too, although I guess predicting output differences won't be straightforward. I guess at the least we could test that nothing errors or panics.
pkg/sql/exec/utils_test.go
Outdated
}) | ||
} | ||
|
||
// runTestsWithoutNullsInjection is the same as runTests that skips the nulls |
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.
nit: s/that/but it/
f45bdb5
to
a2bfb96
Compare
This commit adds a nulls injection test to always run with runTests. The idea is that it runs the operator on two inputs: the original input tuples that are passed into the test, and only null tuples (i.e. of the same length and of the same count with only nil values). Then, the expectation is that unless the original input tuples already consist only of null values, the output should be different. This assumption is incorrect for some operators and in some test cases for other operators. In such cases, runTestsWithoutNullsInjection needs to be used and the justification needs to be provided for doing so. Release note: None
a2bfb96
to
8190ae3
Compare
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @asubiotto and @jordanlewis)
pkg/sql/exec/utils_test.go, line 163 at r1 (raw file):
Previously, jordanlewis (Jordan Lewis) wrote…
nit: s/that/but it/
Done.
pkg/sql/exec/utils_test.go, line 463 at r1 (raw file):
Previously, jordanlewis (Jordan Lewis) wrote…
This seems to be all-nulls injection. I think we should try injecting random nulls too, although I guess predicting output differences won't be straightforward. I guess at the least we could test that nothing errors or panics.
Good idea, added.
TFTR! bors r=jordanlewis |
40658: exec: add nulls injection test to runTests harness r=jordanlewis a=yuzefovich This commit adds a nulls injection test to always run with runTests. The idea is that it runs the operator on two inputs: the original input tuples that are passed into the test, and only null tuples (i.e. of the same length and of the same count with only nil values). Then, the expectation is that unless the original input tuples already consist only of null values, the output should be different. This assumption is incorrect for some operators and in some test cases for other operators. In such cases, runTestsWithoutNullsInjection needs to be used and the justification needs to be provided for doing so. Justification: Category 1: Non-production code changes. Release note: None 40673: opt: inline single-use WithExprs r=justinj a=justinj This commit adds a rule to inline With expressions which are referenced at most once. This avoid buffering in the common case and also allows optimizations to cross this boundary. Release note (sql change): CTEs which are used a single time will no longer create an optimization fence. Co-authored-by: Yahor Yuzefovich <[email protected]> Co-authored-by: Justin Jaffray <[email protected]>
Build succeeded |
This commit adds a nulls injection test to always run with runTests.
The idea is that it runs the operator on two inputs: the original
input tuples that are passed into the test, and only null tuples
(i.e. of the same length and of the same count with only nil values).
Then, the expectation is that unless the original input tuples already
consist only of null values, the output should be different.
This assumption is incorrect for some operators and in some test cases
for other operators. In such cases, runTestsWithoutNullsInjection needs
to be used and the justification needs to be provided for doing so.
Justification: Category 1: Non-production code changes.
Release note: None