Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions enginetest/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ import (
// times during a single test run, and must return a "fresh" engine instance each time, i.e. an instance that contains
// exactly the test data provided via other setup methods.
type Harness interface {
// Parallelism returns how many parallel go routines to use when constructing an engine for test.
Parallelism() int
// NewContext allows a harness to specify any sessions or context variables necessary for the proper functioning of
// their engine implementation. Every harnessed engine test uses the context created by this method, with some
// additional information (e.g. current DB) set uniformly. To replicate the behavior of tests during setup,
Expand Down
20 changes: 4 additions & 16 deletions enginetest/initialization.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ func NewContextWithClient(harness ClientHarness, client sql.Client) *sql.Context
return newContextSetup(harness.NewContextWithClient(client))
}

// TODO: remove
func NewContextWithEngine(harness Harness, engine QueryEngine) *sql.Context {
return NewContext(harness)
}

var pid uint64

func newContextSetup(ctx *sql.Context) *sql.Context {
Expand Down Expand Up @@ -84,22 +79,15 @@ func NewBaseSession() *sql.BaseSession {

// NewEngineWithProvider returns a new engine with the specified provider
func NewEngineWithProvider(_ *testing.T, harness Harness, provider sql.DatabaseProvider) *sqle.Engine {
var a *analyzer.Analyzer

if harness.Parallelism() > 1 {
a = analyzer.NewBuilder(provider).WithParallelism(harness.Parallelism()).Build()
} else {
a = analyzer.NewDefault(provider)
}
analyzer := analyzer.NewDefault(provider)

// All tests will run with all privileges on the built-in root account
a.Catalog.MySQLDb.AddRootAccount()
analyzer.Catalog.MySQLDb.AddRootAccount()
// Almost no tests require an information schema that can be updated, but test setup makes it difficult to not
// provide everywhere
a.Catalog.InfoSchema = information_schema.NewInformationSchemaDatabase()

engine := sqle.New(a, new(sqle.Config))
analyzer.Catalog.InfoSchema = information_schema.NewInformationSchemaDatabase()

engine := sqle.New(analyzer, new(sqle.Config))
if idh, ok := harness.(IndexDriverHarness); ok {
idh.InitializeIndexDriver(engine.Analyzer.Catalog.AllDatabases(NewContext(harness)))
}
Expand Down
4 changes: 0 additions & 4 deletions enginetest/memory_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,6 @@ func TestIndexQueryPlans(t *testing.T) {
}
}

func TestParallelismQueries(t *testing.T) {
enginetest.TestParallelismQueries(t, enginetest.NewMemoryHarness("default", 2, testNumPartitions, true, nil))
}

func TestQueryErrors(t *testing.T) {
enginetest.TestQueryErrors(t, enginetest.NewDefaultMemoryHarness())
}
Expand Down
61 changes: 0 additions & 61 deletions enginetest/parallelism.go

This file was deleted.

2 changes: 1 addition & 1 deletion enginetest/plangen/cmd/plangen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func generatePlansForSuite(spec PlanSpec, w *bytes.Buffer) error {
_, _ = w.WriteString("\n")

if !tt.Skip {
ctx := enginetest.NewContextWithEngine(harness, engine)
ctx := enginetest.NewContext(harness)
binder := planbuilder.New(ctx, engine.EngineAnalyzer().Catalog, sql.NewMysqlParser())
parsed, _, _, qFlags, err := binder.Parse(tt.Query, nil, false)
if err != nil {
Expand Down
17 changes: 2 additions & 15 deletions sql/analyzer/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ type Builder struct {
afterAllRules []Rule
provider sql.DatabaseProvider
debug bool
parallelism int
}

// NewBuilder creates a new Builder from a specific catalog.
Expand All @@ -100,12 +99,6 @@ func (ab *Builder) WithDebug() *Builder {
return ab
}

// WithParallelism sets the parallelism level on the analyzer.
func (ab *Builder) WithParallelism(parallelism int) *Builder {
ab.parallelism = parallelism
return ab
}

// AddPreAnalyzeRule adds a new rule to the analyze before the standard analyzer rules.
func (ab *Builder) AddPreAnalyzeRule(id RuleId, fn RuleFunc) *Builder {
ab.preAnalyzeRules = append(ab.preAnalyzeRules, Rule{id, fn})
Expand Down Expand Up @@ -271,7 +264,6 @@ func (ab *Builder) Build() *Analyzer {
contextStack: make([]string, 0),
Batches: batches,
Catalog: NewCatalog(ab.provider),
Parallelism: ab.parallelism,
Coster: memo.NewDefaultCoster(),
ExecBuilder: rowexec.DefaultBuilder,
}
Expand All @@ -286,7 +278,6 @@ type Analyzer struct {
Verbose bool
// A stack of debugger context. See PushDebugContext, PopDebugContext
contextStack []string
Parallelism int
// Batches of Rules to apply.
Batches []*Batch
// Catalog of databases and registered functions.
Expand All @@ -304,7 +295,6 @@ type Analyzer struct {
// To add custom rules, the easiest way is use the Builder.
func NewDefault(provider sql.DatabaseProvider) *Analyzer {
return NewBuilder(provider).Build()

}

// NewDefaultWithVersion creates a default Analyzer instance either
Expand Down Expand Up @@ -402,10 +392,8 @@ func NewProcRuleSelector(sel RuleSelector) RuleSelector {
switch id {
case pruneTablesId,
unnestInSubqueriesId,

// once after default rules should only be run once
TrackProcessId,
parallelizeId:
TrackProcessId:
return false
}
return sel(id)
Expand Down Expand Up @@ -452,8 +440,7 @@ func NewFinalizeUnionSel(sel RuleSelector) RuleSelector {
case
// skip recursive resolve rules
resolveSubqueriesId,
resolveUnionsId,
parallelizeId:
resolveUnionsId:
return false
case finalizeSubqueriesId,
hoistOutOfScopeFiltersId:
Expand Down
202 changes: 0 additions & 202 deletions sql/analyzer/parallelize.go

This file was deleted.

Loading
Loading