Skip to content

Commit

Permalink
This is an automated cherry-pick of pingcap#52908
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <[email protected]>
  • Loading branch information
yibin87 authored and ti-chi-bot committed Apr 26, 2024
1 parent 3627c71 commit b21c295
Show file tree
Hide file tree
Showing 3 changed files with 522 additions and 0 deletions.
18 changes: 18 additions & 0 deletions executor/index_lookup_hash_join.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

"github.com/pingcap/errors"
"github.com/pingcap/failpoint"
<<<<<<< HEAD:executor/index_lookup_hash_join.go
"github.com/pingcap/tidb/expression"
plannercore "github.com/pingcap/tidb/planner/core"
"github.com/pingcap/tidb/types"
Expand All @@ -34,6 +35,17 @@ import (
"github.com/pingcap/tidb/util/codec"
"github.com/pingcap/tidb/util/memory"
"github.com/pingcap/tidb/util/ranger"
=======
"github.com/pingcap/tidb/pkg/executor/internal/exec"
"github.com/pingcap/tidb/pkg/expression"
"github.com/pingcap/tidb/pkg/types"
"github.com/pingcap/tidb/pkg/util"
"github.com/pingcap/tidb/pkg/util/channel"
"github.com/pingcap/tidb/pkg/util/chunk"
"github.com/pingcap/tidb/pkg/util/codec"
"github.com/pingcap/tidb/pkg/util/memory"
"github.com/pingcap/tidb/pkg/util/ranger"
>>>>>>> 944fff519c9 (executor: Fix index join hash produces redundant rows for left outer anti semi join type (#52908)):pkg/executor/index_lookup_hash_join.go
)

// numResChkHold indicates the number of resource chunks that an inner worker
Expand Down Expand Up @@ -722,10 +734,16 @@ func (iw *indexHashJoinInnerWorker) getMatchedOuterRows(innerRow chunk.Row, task
return nil, nil, nil
}
joinType := JoinerType(iw.joiner)
<<<<<<< HEAD:executor/index_lookup_hash_join.go
isSemiJoin := joinType == plannercore.SemiJoin || joinType == plannercore.LeftOuterSemiJoin
matchedRows = make([]chunk.Row, 0, len(iw.matchedOuterPtrs))
matchedRowPtr = make([]chunk.RowPtr, 0, len(iw.matchedOuterPtrs))
for _, ptr := range iw.matchedOuterPtrs {
=======
isSemiJoin := joinType.IsSemiJoin()
for ; matchedOuterEntry != nil; matchedOuterEntry = matchedOuterEntry.next {
ptr := matchedOuterEntry.ptr
>>>>>>> 944fff519c9 (executor: Fix index join hash produces redundant rows for left outer anti semi join type (#52908)):pkg/executor/index_lookup_hash_join.go
outerRow := task.outerResult.GetRow(ptr)
ok, err := codec.EqualChunkRow(iw.ctx.GetSessionVars().StmtCtx, innerRow, iw.hashTypes, iw.hashCols, outerRow, iw.outerCtx.hashTypes, iw.outerCtx.hashCols)
if err != nil {
Expand Down
25 changes: 25 additions & 0 deletions pkg/executor/test/jointest/hashjoin/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
load("@io_bazel_rules_go//go:def.bzl", "go_test")

go_test(
name = "hashjoin_test",
timeout = "short",
srcs = [
"hash_join_test.go",
"main_test.go",
],
flaky = True,
race = "on",
shard_count = 11,
deps = [
"//pkg/config",
"//pkg/meta/autoid",
"//pkg/session",
"//pkg/sessionctx/variable",
"//pkg/testkit",
"//pkg/util/dbterror/exeerrors",
"@com_github_pingcap_failpoint//:failpoint",
"@com_github_stretchr_testify//require",
"@com_github_tikv_client_go_v2//tikv",
"@org_uber_go_goleak//:goleak",
],
)
Loading

0 comments on commit b21c295

Please sign in to comment.