Skip to content

Commit d384eba

Browse files
committed
sqlsmith: add join hints to random joins
Informs: #153633 Release note: None
1 parent 392ea40 commit d384eba

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pkg/internal/sqlsmith/relational.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,17 @@ func makeJoinExpr(s *Smither, refs colRefs, forJoin bool) (tree.TableExpr, colRe
200200
Left: left,
201201
Right: right,
202202
}
203+
switch s.rnd.Intn(10) {
204+
// INVERTED is unlikely to work unless we get very lucky, so skip it for now.
205+
case 0:
206+
joinExpr.Hint = "HASH"
207+
case 1:
208+
joinExpr.Hint = "LOOKUP"
209+
case 2:
210+
joinExpr.Hint = "MERGE"
211+
case 3:
212+
joinExpr.Hint = "STRAIGHT"
213+
}
203214

204215
if s.disableCrossJoins {
205216
if available, ok := getAvailablePairedColsForJoinPreds(s, leftRefs, rightRefs); ok {

0 commit comments

Comments
 (0)