Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Sirek committed Aug 23, 2022
1 parent e7b724e commit 40a8d44
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion pkg/sql/opt/testutils/opttester/opt_tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,11 @@ func New(catalog cat.Catalog, sql string) *OptTester {
//
// - skip-race: skips the test if the race detector is enabled.
//
// - set: sets the session setting for the given SQL statement, for example:
// build set=prefer_lookup_joins_for_fks=true
// DELETE FROM parent WHERE p = 3
// ----
//
func (ot *OptTester) RunCommand(tb testing.TB, d *datadriven.TestData) string {
// Allow testcases to override the flags.
for _, a := range d.CmdArgs {
Expand Down Expand Up @@ -867,7 +872,7 @@ func (f *Flags) Set(arg datadriven.CmdArg) error {
for _, val := range arg.Vals {
s := strings.Split(val, "=")
if len(s) != 2 {
return errors.Errorf("Expected both session variable name and value for set command")
return errors.Errorf("Expected both session variable name and value for set flag")
}
err := sql.SetSessionVariable(f.ot.ctx, f.ot.evalCtx, s[0], s[1])
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion pkg/sql/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -2227,8 +2227,10 @@ func init() {
}()
}

// SetSessionVariable sets a new value for session setting `varName` is the
// SetSessionVariable sets a new value for session setting `varName` in the
// session settings owned by `evalCtx`, returning an error if not successful.
// This function should only be used for testing. For general-purpose code,
// please use SessionAccessor.SetSessionVar instead.
func SetSessionVariable(
ctx context.Context, evalCtx eval.Context, varName, varValue string,
) (err error) {
Expand Down

0 comments on commit 40a8d44

Please sign in to comment.