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: explicitly check for nulls in selBoolOp #40610

Merged
merged 1 commit into from
Sep 9, 2019

Conversation

yuzefovich
Copy link
Member

Previously, we would copy the bool vector from boolVecToSelOp directly.
However, we also need to look at the null values so that nulls are
treated as false. Now this is fixed.

Release note: None

@yuzefovich yuzefovich requested review from jordanlewis, rafiss and a team September 9, 2019 19:24
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

lgtm, just had one potential optional optimization

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis, @rafiss, and @yuzefovich)


pkg/sql/exec/bool_vec_to_sel.go, line 147 at r1 (raw file):

			}
		} else {
			for i := uint16(0); i < n; i++ {

not sure about this, but is there a bounds-check elimination opportunity here? like if the loop were changed to something like:

outSlice := d.boolVecToSelOp.outputCol[:n]
for i := range outSlice {
  if nulls.NullAt(i) {
    outSlice[i] = false
  }
}

Previously, we would copy the bool vector from boolVecToSelOp directly.
However, we also need to look at the null values so that nulls are
treated as false. Now this is fixed.

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.

TFTR!

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis and @rafiss)


pkg/sql/exec/bool_vec_to_sel.go, line 147 at r1 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

not sure about this, but is there a bounds-check elimination opportunity here? like if the loop were changed to something like:

outSlice := d.boolVecToSelOp.outputCol[:n]
for i := range outSlice {
  if nulls.NullAt(i) {
    outSlice[i] = false
  }
}

Done. I initially didn't want to look into this, so I left a TODO :) But I guess it's a quick check to see whether the bounds check is eliminated, so your nudge changed my mind.

Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r1, 1 of 1 files at r2.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis and @rafiss)

@craig
Copy link
Contributor

craig bot commented Sep 9, 2019

Build failed

@yuzefovich
Copy link
Member Author

The logic tests seem to have timed out.

bors r+

craig bot pushed a commit that referenced this pull request Sep 9, 2019
40610: exec: explicitly check for nulls in selBoolOp r=yuzefovich a=yuzefovich

Previously, we would copy the bool vector from boolVecToSelOp directly.
However, we also need to look at the null values so that nulls are
treated as false. Now this is fixed.

Release note: None

Co-authored-by: Yahor Yuzefovich <[email protected]>
@craig
Copy link
Contributor

craig bot commented Sep 9, 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