From 0afe54d7562f31bbccd8acdeed0dbd404bb8e0c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=B6=85?= Date: Wed, 22 May 2024 12:58:17 +0800 Subject: [PATCH] *: fix unstable assert for location (#53376) close pingcap/tidb#53375 --- pkg/expression/context/context.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/expression/context/context.go b/pkg/expression/context/context.go index 4a3a3475f178b..736376c21ac17 100644 --- a/pkg/expression/context/context.go +++ b/pkg/expression/context/context.go @@ -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, ) }