Skip to content

Commit

Permalink
feat: turn off the cost check before using hash joins. we'll just rel…
Browse files Browse the repository at this point in the history
…y on the hint for now

Signed-off-by: Andres Taylor <[email protected]>
  • Loading branch information
systay committed Nov 22, 2021
1 parent cba1975 commit 51b97da
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 0 additions & 2 deletions go/vt/vtgate/planbuilder/gen4_planner.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import (

var _ selectPlanner = gen4Planner

const MinHashJoinCost = 5

func gen4Planner(query string) func(sqlparser.Statement, *sqlparser.ReservedVars, ContextVSchema) (engine.Primitive, error) {
return func(stmt sqlparser.Statement, reservedVars *sqlparser.ReservedVars, vschema ContextVSchema) (engine.Primitive, error) {
selStatement, ok := stmt.(sqlparser.SelectStatement)
Expand Down
3 changes: 2 additions & 1 deletion go/vt/vtgate/planbuilder/querytree_transformers.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,8 @@ func transformJoinPlan(ctx *planningContext, n *joinTree) (logicalPlan, error) {
// Hash joins are only supporting equality join predicates, which is why the join predicate
// has to be an EqualOp.
func canHashJoin(ctx *planningContext, n *joinTree) (canHash bool, lhs, rhs joinColumnInfo, err error) {
if len(n.predicatesToRemoveFromHashJoin) != 1 || n.rhs.cost() <= MinHashJoinCost || n.leftJoin ||
if len(n.predicatesToRemoveFromHashJoin) != 1 ||
n.leftJoin ||
!sqlparser.ExtractCommentDirectives(ctx.semTable.Comments).IsSet(sqlparser.DirectiveAllowHashJoin) {
return
}
Expand Down

0 comments on commit 51b97da

Please sign in to comment.