Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkingrei committed Feb 26, 2024
1 parent 6ddfa85 commit 191ba50
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions pkg/parser/digester.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func (d *sqlDigester) normalize(sql string, keepHint bool, forBinding bool, forP
continue
}

d.reduceLit(&currTok)
d.reduceLit(&currTok, forBinding)
if forPlanReplayerReload {
// Apply for plan replayer to match specific rules, changing IN (...) to IN (?). This can avoid plan replayer load failures caused by parse errors.
d.replaceSingleLiteralWithInList(&currTok)
Expand Down Expand Up @@ -313,7 +313,7 @@ func (d *sqlDigester) reduceOptimizerHint(tok *token) (reduced bool) {
return
}

func (d *sqlDigester) reduceLit(currTok *token) {
func (d *sqlDigester) reduceLit(currTok *token, forBinding bool) {
if !d.isLit(*currTok) {
return
}
Expand Down Expand Up @@ -350,12 +350,14 @@ func (d *sqlDigester) reduceLit(currTok *token) {
}
// reduce "In (row(...), row(...))" to "In (row(...))"
// final, it will be reduced to "In (...)". Issue: #51222
last9 := d.tokens.back(9)
if d.isGenericRowListsWithIn(last9) {
d.tokens.popBack(5)
currTok.tok = genericSymbolList
currTok.lit = "..."
return
if forBinding {
last9 := d.tokens.back(9)
if d.isGenericRowListsWithIn(last9) {
d.tokens.popBack(5)
currTok.tok = genericSymbolList
currTok.lit = "..."
return
}
}

// order by n => order by n
Expand Down

0 comments on commit 191ba50

Please sign in to comment.