Skip to content

Commit

Permalink
session: set EnableWindowFunction for all SessionVars (#55991) (#55999)
Browse files Browse the repository at this point in the history
close #55981
  • Loading branch information
ti-chi-bot authored Sep 27, 2024
1 parent e02c06b commit e61d6dd
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 @@ -1317,10 +1317,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 @@ -2022,6 +2022,7 @@ func NewSessionVars(hctx HookContext) *SessionVars {
TiFlashComputeDispatchPolicy: tiflashcompute.DispatchPolicyConsistentHash,
ResourceGroupName: resourcegroup.DefaultResourceGroupName,
DefaultCollationForUTF8MB4: mysql.DefaultCollationName,
EnableWindowFunction: DefEnableWindowFunction,
}
vars.KVVars = tikvstore.NewVariables(&vars.Killed)
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 @@ -1437,3 +1437,14 @@ func TestSetTiDBCloudStorageURI(t *testing.T) {
require.Len(t, val, 0)
cancel()
}

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)
}

0 comments on commit e61d6dd

Please sign in to comment.