Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
40651: exec: fix a bug with ON expression support for joiners r=yuzefovich a=yuzefovich

Previously, a selection vector was ignored when applying a filter
on the batch. Now this is fixed. It is extremely difficult to write
a unit test for this at the moment because the filter planning code
lives in sql/distsqlrun.

Release note: None

Co-authored-by: Yahor Yuzefovich <[email protected]>
  • Loading branch information
craig[bot] and yuzefovich committed Sep 10, 2019
2 parents 5bfc009 + 38853eb commit bdf41f7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/sql/exec/hashjoiner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func TestHashJoinerInt64(t *testing.T) {
}
}

// TODO(yuzefovich): add unit tests for cases with ON expression.
tcs := []struct {
leftTypes []coltypes.T
rightTypes []coltypes.T
Expand Down
4 changes: 4 additions & 0 deletions pkg/sql/exec/joiner_util_tmpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ func (f *joinerFilter) setInputBatch(lBatch, rBatch coldata.Batch, lIdx, rIdx in
execerror.VectorizedInternalPanic("only one of lBatch and rBatch can be nil")
}
setOneSide := func(colOffset int, batch coldata.Batch, sourceTypes []coltypes.T, idx int) {
sel := batch.Selection()
if sel != nil {
idx = int(sel[idx])
}
for colIdx := 0; colIdx < batch.Width(); colIdx++ {
colType := sourceTypes[colIdx]
col := batch.ColVec(colIdx)
Expand Down
2 changes: 2 additions & 0 deletions pkg/sql/exec/mergejoiner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ type mjTestInitializer interface {
initWithBatchSize(outBatchSize uint16)
}

// TODO(yuzefovich): add unit tests for cases with ON expression.

type mjTestCase struct {
description string
joinType sqlbase.JoinType
Expand Down

0 comments on commit bdf41f7

Please sign in to comment.