Skip to content

Commit

Permalink
feat(spanner/spansql): fix unstable SelectFromTable SQL (#4473)
Browse files Browse the repository at this point in the history
#4457 made unstable SQL string, and fail test sometimes like this.
Because map range result is unstable.
This PR makes the SQL output stable by sorting the Hints keys.
  • Loading branch information
Takeshi Nakata committed Jul 21, 2021
1 parent b850315 commit 39bc4ec
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions spanner/spansql/sql.go
Expand Up @@ -25,6 +25,7 @@ package spansql

import (
"fmt"
"sort"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -373,6 +374,7 @@ func (sft SelectFromTable) SQL() string {
kvs[i] = fmt.Sprintf("%s=%s", k, v)
i++
}
sort.Strings(kvs)
str += strings.Join(kvs, ",")
str += "}"
}
Expand Down

0 comments on commit 39bc4ec

Please sign in to comment.