Skip to content

Commit

Permalink
json fake context
Browse files Browse the repository at this point in the history
  • Loading branch information
lcwangchao committed Oct 16, 2023
1 parent 287b2ae commit d942a33
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
1 change: 1 addition & 0 deletions br/pkg/lightning/backend/kv/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ func NewSession(options *encode.SessionOptions, logger log.Logger) *Session {
}
}
}

vars.StmtCtx.SetTimeZone(vars.Location())
vars.StmtCtx.SetTypeFlags(types.StrictFlags.
WithClipNegativeToZero(true),
Expand Down
7 changes: 1 addition & 6 deletions pkg/ddl/backfilling_scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"context"
"fmt"
"sync"
"time"

"github.com/pingcap/errors"
"github.com/pingcap/tidb/pkg/ddl/copr"
Expand Down Expand Up @@ -149,11 +148,6 @@ func initSessCtx(
sqlMode mysql.SQLMode,
tzLocation *model.TimeZoneLocation,
) error {
// Unify the TimeZone settings in newContext.
if sessCtx.GetSessionVars().StmtCtx.TimeZone() == nil {
tz := *time.UTC
sessCtx.GetSessionVars().StmtCtx.SetTimeZone(&tz)
}
// Set the row encode format version.
rowFormat := variable.GetDDLReorgRowFormat()
sessCtx.GetSessionVars().RowEncoder.Enable = rowFormat != variable.DefTiDBRowFormatV1
Expand All @@ -162,6 +156,7 @@ func initSessCtx(
if err := setSessCtxLocation(sessCtx, tzLocation); err != nil {
return errors.Trace(err)
}
sessCtx.GetSessionVars().StmtCtx.SetTimeZone(sessCtx.GetSessionVars().Location())
sessCtx.GetSessionVars().StmtCtx.BadNullAsWarning = !sqlMode.HasStrictMode()
sessCtx.GetSessionVars().StmtCtx.TruncateAsWarning = !sqlMode.HasStrictMode()
sessCtx.GetSessionVars().StmtCtx.OverflowAsWarning = !sqlMode.HasStrictMode()
Expand Down
1 change: 0 additions & 1 deletion pkg/expression/builtin_cast.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,6 @@ var fakeSctx = newFakeSctx()

func newFakeSctx() *stmtctx.StatementContext {
sc := stmtctx.NewStmtCtx()
sc.InInsertStmt = true
sc.SetTypeFlags(types.StrictFlags.
WithClipNegativeToZero(true),
)
Expand Down

0 comments on commit d942a33

Please sign in to comment.