Skip to content

Commit

Permalink
session: set EnableWindowFunction for all SessionVars (pingcap#55991)
Browse files Browse the repository at this point in the history
  • Loading branch information
winoros authored and Benjamin2037 committed Sep 11, 2024
1 parent d9f0476 commit 194f501
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 0 additions & 4 deletions pkg/session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -1186,10 +1186,6 @@ func createSessionFunc(store kv.Storage) pools.Factory {
if err != nil {
return nil, errors.Trace(err)
}
err = se.sessionVars.SetSystemVar(variable.TiDBEnableWindowFunction, variable.BoolToOnOff(variable.DefEnableWindowFunction))
if err != nil {
return nil, errors.Trace(err)
}
err = se.sessionVars.SetSystemVar(variable.TiDBConstraintCheckInPlacePessimistic, variable.On)
if err != nil {
return nil, errors.Trace(err)
Expand Down
1 change: 1 addition & 0 deletions pkg/sessionctx/variable/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -2213,6 +2213,7 @@ func NewSessionVars(hctx HookContext) *SessionVars {
DefaultCollationForUTF8MB4: mysql.DefaultCollationName,
GroupConcatMaxLen: DefGroupConcatMaxLen,
EnableRedactLog: DefTiDBRedactLog,
EnableWindowFunction: DefEnableWindowFunction,
}
vars.status.Store(uint32(mysql.ServerStatusAutocommit))
vars.StmtCtx.ResourceGroupName = resourcegroup.DefaultResourceGroupName
Expand Down
11 changes: 11 additions & 0 deletions pkg/sessionctx/variable/sysvar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1742,6 +1742,17 @@ func TestTiDBSchemaCacheSize(t *testing.T) {
require.Error(t, err)
}

func TestEnableWindowFunction(t *testing.T) {
vars := NewSessionVars(nil)
require.Equal(t, vars.EnableWindowFunction, DefEnableWindowFunction)
require.NoError(t, vars.SetSystemVar(TiDBEnableWindowFunction, "on"))
require.Equal(t, vars.EnableWindowFunction, true)
require.NoError(t, vars.SetSystemVar(TiDBEnableWindowFunction, "0"))
require.Equal(t, vars.EnableWindowFunction, false)
require.NoError(t, vars.SetSystemVar(TiDBEnableWindowFunction, "1"))
require.Equal(t, vars.EnableWindowFunction, true)
}

func TestTiDBAutoAnalyzeConcurrencyValidation(t *testing.T) {
vars := NewSessionVars(nil)

Expand Down

0 comments on commit 194f501

Please sign in to comment.