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

exec: add nulls injection test to runTests harness #40658

Merged
merged 1 commit into from
Sep 11, 2019

Conversation

yuzefovich
Copy link
Member

@yuzefovich yuzefovich commented Sep 11, 2019

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

@yuzefovich yuzefovich requested review from jordanlewis, asubiotto and a team September 11, 2019 00:39
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@@ -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 {
Copy link
Member

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.

})
}

// runTestsWithoutNullsInjection is the same as runTests that skips the nulls
Copy link
Member

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/

@yuzefovich yuzefovich force-pushed the null-injection branch 3 times, most recently from f45bdb5 to a2bfb96 Compare September 11, 2019 18:39
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
Copy link
Member Author

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: 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.

@yuzefovich
Copy link
Member Author

TFTR!

bors r=jordanlewis

craig bot pushed a commit that referenced this pull request Sep 11, 2019
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]>
@craig
Copy link
Contributor

craig bot commented Sep 11, 2019

Build succeeded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants