Skip to content

Commit

Permalink
*: fix unstable assert for location (#53376)
Browse files Browse the repository at this point in the history
close #53375
  • Loading branch information
lcwangchao authored May 22, 2024
1 parent d1b8c5b commit 0afe54d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/expression/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,11 @@ func (ctx *NullRejectCheckExprContext) IsInNullRejectCheck() bool {
// AssertLocationWithSessionVars asserts the location in the context and session variables are the same.
// It is only used for testing.
func AssertLocationWithSessionVars(ctxLoc *time.Location, vars *variable.SessionVars) {
varsLoc := vars.Location()
stmtLoc := vars.StmtCtx.TimeZone()
intest.Assert(ctxLoc == varsLoc && ctxLoc == stmtLoc,
ctxLocStr := ctxLoc.String()
varsLocStr := vars.Location().String()
stmtLocStr := vars.StmtCtx.TimeZone().String()
intest.Assert(ctxLocStr == varsLocStr && ctxLocStr == stmtLocStr,
"location mismatch, ctxLoc: %s, varsLoc: %s, stmtLoc: %s",
ctxLoc.String(), varsLoc.String(), stmtLoc.String(),
ctxLoc.String(), ctxLocStr, stmtLocStr,
)
}

0 comments on commit 0afe54d

Please sign in to comment.