Repository: vitessio/vitess
Pull request #8901 (2021-09-29 07:41:36)

Clean up Primitive interface implementations
## Description
Pure clean up. Addresses a lot of linting errors from the engine package.

## Checklist
- [x] Tests were added or are not required
- [x] Documentation was added or is not required



Patch:
diff --git a/go/vt/vtgate/engine/concatenate.go b/go/vt/vtgate/engine/concatenate.go
index 0d660565a7..1336e43fac 100644
--- a/go/vt/vtgate/engine/concatenate.go
+++ b/go/vt/vtgate/engine/concatenate.go
@@ -230,7 +230,7 @@ func (c *Concatenate) Inputs() []Primitive {
 	return c.Sources
 }
 
-func (c *Concatenate) Description() PrimitiveDescription {
+func (c *Concatenate) description() PrimitiveDescription {
 	return PrimitiveDescription{OperatorType: c.RouteType()}
 }
 
diff --git a/go/vt/vtgate/engine/dbddl.go b/go/vt/vtgate/engine/dbddl.go
index e69c2f01c4..013e40f567 100644
--- a/go/vt/vtgate/engine/dbddl.go
+++ b/go/vt/vtgate/engine/dbddl.go
@@ -94,7 +94,7 @@ func (c *DBDDL) GetTableName() string {
 	return ""
 }
 
-// Execute implements the Primitive interface
+// TryExecute implements the Primitive interface
 func (c *DBDDL) TryExecute(vcursor VCursor, _ map[string]*querypb.BindVariable, _ bool) (*sqltypes.Result, error) {
 	name := vcursor.GetDBDDLPluginName()
 	plugin, ok := databaseCreatorPlugins[name]
@@ -180,7 +180,7 @@ func (c *DBDDL) dropDatabase(vcursor VCursor, plugin DBDDLPlugin) (*sqltypes.Res
 	return &sqltypes.Result{StatusFlags: sqltypes.ServerStatusDbDropped}, nil
 }
 
-// StreamExecute implements the Primitive interface
+// TryStreamExecute implements the Primitive interface
 func (c *DBDDL) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	res, err := c.TryExecute(vcursor, bindVars, wantfields)
 	if err != nil {
@@ -194,8 +194,8 @@ func (c *DBDDL) GetFields(VCursor, map[string]*querypb.BindVariable) (*sqltypes.
 	return &sqltypes.Result{}, nil
 }
 
-// Description implements the Primitive interface
-func (c *DBDDL) Description() PrimitiveDescription {
+// description implements the Primitive interface
+func (c *DBDDL) description() PrimitiveDescription {
 	return PrimitiveDescription{
 		OperatorType: strings.ToUpper(c.RouteType()),
 		Keyspace:     &vindexes.Keyspace{Name: c.name},
diff --git a/go/vt/vtgate/engine/ddl.go b/go/vt/vtgate/engine/ddl.go
index b02acc695a..13ca94d886 100644
--- a/go/vt/vtgate/engine/ddl.go
+++ b/go/vt/vtgate/engine/ddl.go
@@ -47,7 +47,7 @@ type DDL struct {
 	noInputs
 }
 
-func (ddl *DDL) Description() PrimitiveDescription {
+func (ddl *DDL) description() PrimitiveDescription {
 	other := map[string]interface{}{
 		"Query": ddl.SQL,
 	}
@@ -85,7 +85,7 @@ func (ddl *DDL) isOnlineSchemaDDL() bool {
 	return false
 }
 
-// Execute implements the Primitive interface
+// TryExecute implements the Primitive interface
 func (ddl *DDL) TryExecute(vcursor VCursor, bindVars map[string]*query.BindVariable, wantfields bool) (result *sqltypes.Result, err error) {
 	if ddl.CreateTempTable {
 		vcursor.Session().HasCreatedTempTable()
@@ -113,7 +113,7 @@ func (ddl *DDL) TryExecute(vcursor VCursor, bindVars map[string]*query.BindVaria
 	}
 }
 
-// StreamExecute implements the Primitive interface
+// TryStreamExecute implements the Primitive interface
 func (ddl *DDL) TryStreamExecute(vcursor VCursor, bindVars map[string]*query.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	results, err := ddl.TryExecute(vcursor, bindVars, wantfields)
 	if err != nil {
diff --git a/go/vt/vtgate/engine/delete.go b/go/vt/vtgate/engine/delete.go
index c89027afb3..2eadd0c524 100644
--- a/go/vt/vtgate/engine/delete.go
+++ b/go/vt/vtgate/engine/delete.go
@@ -68,7 +68,7 @@ func (del *Delete) GetTableName() string {
 	return ""
 }
 
-// Execute performs a non-streaming exec.
+// TryExecute performs a non-streaming exec.
 func (del *Delete) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, _ bool) (*sqltypes.Result, error) {
 	if del.QueryTimeout != 0 {
 		cancel := vcursor.SetContextTimeout(time.Duration(del.QueryTimeout) * time.Millisecond)
@@ -92,7 +92,7 @@ func (del *Delete) TryExecute(vcursor VCursor, bindVars map[string]*querypb.Bind
 	}
 }
 
-// StreamExecute performs a streaming exec.
+// TryStreamExecute performs a streaming exec.
 func (del *Delete) TryStreamExecute(VCursor, map[string]*querypb.BindVariable, bool, func(*sqltypes.Result) error) error {
 	return fmt.Errorf("query %q cannot be used for streaming", del.Query)
 }
@@ -229,7 +229,7 @@ func (del *Delete) deleteVindexEntries(vcursor VCursor, bindVars map[string]*que
 	return nil
 }
 
-func (del *Delete) Description() PrimitiveDescription {
+func (del *Delete) description() PrimitiveDescription {
 	other := map[string]interface{}{
 		"Query":                del.Query,
 		"Table":                del.GetTableName(),
diff --git a/go/vt/vtgate/engine/distinct.go b/go/vt/vtgate/engine/distinct.go
index 462da47731..fe28e6fe34 100644
--- a/go/vt/vtgate/engine/distinct.go
+++ b/go/vt/vtgate/engine/distinct.go
@@ -88,7 +88,7 @@ func newProbeTable() *probeTable {
 	return &probeTable{m: map[int64][]row{}}
 }
 
-// Execute implements the Primitive interface
+// TryExecute implements the Primitive interface
 func (d *Distinct) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
 	input, err := vcursor.ExecutePrimitive(d.Source, bindVars, wantfields)
 	if err != nil {
@@ -115,7 +115,7 @@ func (d *Distinct) TryExecute(vcursor VCursor, bindVars map[string]*querypb.Bind
 	return result, err
 }
 
-// StreamExecute implements the Primitive interface
+// TryStreamExecute implements the Primitive interface
 func (d *Distinct) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	pt := newProbeTable()
 
@@ -169,7 +169,7 @@ func (d *Distinct) Inputs() []Primitive {
 	return []Primitive{d.Source}
 }
 
-func (d *Distinct) Description() PrimitiveDescription {
+func (d *Distinct) description() PrimitiveDescription {
 	return PrimitiveDescription{
 		OperatorType: "Distinct",
 	}
diff --git a/go/vt/vtgate/engine/gen4_compare_v3.go b/go/vt/vtgate/engine/gen4_compare_v3.go
index edcc8caa28..1a68b51b46 100644
--- a/go/vt/vtgate/engine/gen4_compare_v3.go
+++ b/go/vt/vtgate/engine/gen4_compare_v3.go
@@ -158,15 +158,16 @@ func (gc *Gen4CompareV3) printMismatch(v3Result *sqltypes.Result, gen4Result *sq
 
 // Inputs implements the Primitive interface
 func (gc *Gen4CompareV3) Inputs() []Primitive {
-	return gc.Gen4.Inputs()
+	return []Primitive{gc.Gen4, gc.V3}
 }
 
-// Description implements the Primitive interface
-func (gc *Gen4CompareV3) Description() PrimitiveDescription {
-	return gc.Gen4.Description()
+// description implements the Primitive interface
+func (gc *Gen4CompareV3) description() PrimitiveDescription {
+	return PrimitiveDescription{OperatorType: "Gen4CompareV3"}
 }
 
-func CompareV3AndGen4Errors(v3Err error, gen4Err error) error {
+// CompareV3AndGen4Errors compares the two errors, and if they don't match, produces an error
+func CompareV3AndGen4Errors(v3Err, gen4Err error) error {
 	if v3Err != nil && gen4Err != nil {
 		if v3Err.Error() == gen4Err.Error() {
 			return gen4Err
diff --git a/go/vt/vtgate/engine/insert.go b/go/vt/vtgate/engine/insert.go
index 6a5bde145d..09581a2cb8 100644
--- a/go/vt/vtgate/engine/insert.go
+++ b/go/vt/vtgate/engine/insert.go
@@ -187,8 +187,8 @@ func (ins *Insert) GetTableName() string {
 	return ""
 }
 
-// Execute performs a non-streaming exec.
-func (ins *Insert) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
+// TryExecute performs a non-streaming exec.
+func (ins *Insert) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, _ bool) (*sqltypes.Result, error) {
 	if ins.QueryTimeout != 0 {
 		cancel := vcursor.SetContextTimeout(time.Duration(ins.QueryTimeout) * time.Millisecond)
 		defer cancel()
@@ -205,13 +205,13 @@ func (ins *Insert) TryExecute(vcursor VCursor, bindVars map[string]*querypb.Bind
 	}
 }
 
-// StreamExecute performs a streaming exec.
-func (ins *Insert) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
+// TryStreamExecute performs a streaming exec.
+func (ins *Insert) TryStreamExecute(VCursor, map[string]*querypb.BindVariable, bool, func(*sqltypes.Result) error) error {
 	return fmt.Errorf("query %q cannot be used for streaming", ins.Query)
 }
 
 // GetFields fetches the field info.
-func (ins *Insert) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error) {
+func (ins *Insert) GetFields(VCursor, map[string]*querypb.BindVariable) (*sqltypes.Result, error) {
 	return nil, vterrors.Errorf(vtrpcpb.Code_INTERNAL, "[BUG] unreachable code for %q", ins.Query)
 }
 
@@ -615,7 +615,7 @@ func InsertVarName(col sqlparser.ColIdent, rowNum int) string {
 	return fmt.Sprintf("_%s_%d", col.CompliantName(), rowNum)
 }
 
-func (ins *Insert) Description() PrimitiveDescription {
+func (ins *Insert) description() PrimitiveDescription {
 	other := map[string]interface{}{
 		"Query":                ins.Query,
 		"TableName":            ins.GetTableName(),
diff --git a/go/vt/vtgate/engine/join.go b/go/vt/vtgate/engine/join.go
index 0daadd8f3f..55d0742fef 100644
--- a/go/vt/vtgate/engine/join.go
+++ b/go/vt/vtgate/engine/join.go
@@ -48,7 +48,7 @@ type Join struct {
 	Vars map[string]int `json:",omitempty"`
 }
 
-// Execute performs a non-streaming exec.
+// TryExecute performs a non-streaming exec.
 func (jn *Join) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
 	joinVars := make(map[string]*querypb.BindVariable)
 	lresult, err := vcursor.ExecutePrimitive(jn.Left, bindVars, wantfields)
@@ -92,7 +92,7 @@ func (jn *Join) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVar
 	return result, nil
 }
 
-// StreamExecute performs a streaming exec.
+// TryStreamExecute performs a streaming exec.
 func (jn *Join) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	joinVars := make(map[string]*querypb.BindVariable)
 	err := vcursor.StreamExecutePrimitive(jn.Left, bindVars, wantfields, func(lresult *sqltypes.Result) error {
@@ -257,7 +257,7 @@ func combineVars(bv1, bv2 map[string]*querypb.BindVariable) map[string]*querypb.
 	return out
 }
 
-func (jn *Join) Description() PrimitiveDescription {
+func (jn *Join) description() PrimitiveDescription {
 	other := map[string]interface{}{
 		"TableName":         jn.GetTableName(),
 		"JoinColumnIndexes": strings.Trim(strings.Join(strings.Fields(fmt.Sprint(jn.Cols)), ","), "[]"),
diff --git a/go/vt/vtgate/engine/limit.go b/go/vt/vtgate/engine/limit.go
index 7f96a80d38..622c1742c8 100644
--- a/go/vt/vtgate/engine/limit.go
+++ b/go/vt/vtgate/engine/limit.go
@@ -51,7 +51,7 @@ func (l *Limit) GetTableName() string {
 	return l.Input.GetTableName()
 }
 
-// Execute satisfies the Primtive interface.
+// TryExecute satisfies the Primitive interface.
 func (l *Limit) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
 	count, err := l.fetchCount(bindVars)
 	if err != nil {
@@ -85,7 +85,7 @@ func (l *Limit) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVar
 	return result, nil
 }
 
-// StreamExecute satisfies the Primtive interface.
+// TryStreamExecute satisfies the Primitive interface.
 func (l *Limit) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	count, err := l.fetchCount(bindVars)
 	if err != nil {
@@ -206,7 +206,7 @@ func (l *Limit) fetchOffset(bindVars map[string]*querypb.BindVariable) (int, err
 	return offset, nil
 }
 
-func (l *Limit) Description() PrimitiveDescription {
+func (l *Limit) description() PrimitiveDescription {
 	other := map[string]interface{}{}
 
 	if !l.Count.IsNull() {
diff --git a/go/vt/vtgate/engine/lock.go b/go/vt/vtgate/engine/lock.go
index 829e20d303..dccd6354af 100644
--- a/go/vt/vtgate/engine/lock.go
+++ b/go/vt/vtgate/engine/lock.go
@@ -58,7 +58,7 @@ func (l *Lock) GetTableName() string {
 	return "dual"
 }
 
-// Execute is part of the Primitive interface
+// TryExecute is part of the Primitive interface
 func (l *Lock) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, _ bool) (*sqltypes.Result, error) {
 	rss, _, err := vcursor.ResolveDestinations(l.Keyspace.Name, nil, []key.Destination{l.TargetDestination})
 	if err != nil {
@@ -75,7 +75,7 @@ func (l *Lock) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVari
 	return vcursor.ExecuteLock(rss[0], query)
 }
 
-// StreamExecute is part of the Primitive interface
+// TryStreamExecute is part of the Primitive interface
 func (l *Lock) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	qr, err := l.TryExecute(vcursor, bindVars, wantfields)
 	if err != nil {
@@ -89,7 +89,7 @@ func (l *Lock) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVaria
 	return nil, vterrors.New(vtrpc.Code_UNIMPLEMENTED, "not implements in lock primitive")
 }
 
-func (l *Lock) Description() PrimitiveDescription {
+func (l *Lock) description() PrimitiveDescription {
 	other := map[string]interface{}{
 		"Query": l.Query,
 	}
diff --git a/go/vt/vtgate/engine/memory_sort.go b/go/vt/vtgate/engine/memory_sort.go
index 5b5161de63..406b48e7bf 100644
--- a/go/vt/vtgate/engine/memory_sort.go
+++ b/go/vt/vtgate/engine/memory_sort.go
@@ -64,7 +64,7 @@ func (ms *MemorySort) SetTruncateColumnCount(count int) {
 	ms.TruncateColumnCount = count
 }
 
-// Execute satisfies the Primitive interface.
+// TryExecute satisfies the Primitive interface.
 func (ms *MemorySort) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
 	count, err := ms.fetchCount(bindVars)
 	if err != nil {
@@ -90,7 +90,7 @@ func (ms *MemorySort) TryExecute(vcursor VCursor, bindVars map[string]*querypb.B
 	return result.Truncate(ms.TruncateColumnCount), nil
 }
 
-// StreamExecute satisfies the Primitive interface.
+// TryStreamExecute satisfies the Primitive interface.
 func (ms *MemorySort) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	count, err := ms.fetchCount(bindVars)
 	if err != nil {
@@ -176,7 +176,7 @@ func (ms *MemorySort) fetchCount(bindVars map[string]*querypb.BindVariable) (int
 	return count, nil
 }
 
-func (ms *MemorySort) Description() PrimitiveDescription {
+func (ms *MemorySort) description() PrimitiveDescription {
 	orderByIndexes := GenericJoin(ms.OrderBy, orderByParamsToString)
 	value := ms.UpperLimit.Value
 	other := map[string]interface{}{"OrderBy": orderByIndexes}
diff --git a/go/vt/vtgate/engine/merge_sort.go b/go/vt/vtgate/engine/merge_sort.go
index c01961bb10..9d59a50596 100644
--- a/go/vt/vtgate/engine/merge_sort.go
+++ b/go/vt/vtgate/engine/merge_sort.go
@@ -64,7 +64,7 @@ func (ms *MergeSort) GetKeyspaceName() string { return "" }
 // GetTableName satisfies Primitive.
 func (ms *MergeSort) GetTableName() string { return "" }
 
-// Execute is not supported.
+// TryExecute is not supported.
 func (ms *MergeSort) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
 	return nil, vterrors.Errorf(vtrpcpb.Code_INTERNAL, "[BUG] Execute is not reachable")
 }
@@ -74,7 +74,7 @@ func (ms *MergeSort) GetFields(vcursor VCursor, bindVars map[string]*querypb.Bin
 	return nil, vterrors.Errorf(vtrpcpb.Code_INTERNAL, "[BUG] GetFields is not reachable")
 }
 
-// StreamExecute performs a streaming exec.
+// TryStreamExecute performs a streaming exec.
 func (ms *MergeSort) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	ctx, cancel := context.WithCancel(vcursor.Context())
 	defer cancel()
@@ -208,7 +208,7 @@ func (ms *MergeSort) getStreamingFields(handles []*streamHandle, callback func(*
 	return nil
 }
 
-func (ms *MergeSort) Description() PrimitiveDescription {
+func (ms *MergeSort) description() PrimitiveDescription {
 	other := map[string]interface{}{
 		"OrderBy": ms.OrderBy,
 	}
diff --git a/go/vt/vtgate/engine/mstream.go b/go/vt/vtgate/engine/mstream.go
index 34590abbf4..6c8ea21b9f 100644
--- a/go/vt/vtgate/engine/mstream.go
+++ b/go/vt/vtgate/engine/mstream.go
@@ -58,12 +58,12 @@ func (m *MStream) GetTableName() string {
 	return m.TableName
 }
 
-// Execute implements the Primitive interface
+// TryExecute implements the Primitive interface
 func (m *MStream) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
 	return nil, vterrors.New(vtrpcpb.Code_INTERNAL, "[BUG] 'Execute' called for Stream")
 }
 
-// StreamExecute implements the Primitive interface
+// TryStreamExecute implements the Primitive interface
 func (m *MStream) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	rss, _, err := vcursor.ResolveDestinations(m.Keyspace.Name, nil, []key.Destination{m.TargetDestination})
 	if err != nil {
@@ -77,7 +77,7 @@ func (m *MStream) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVa
 	return nil, vterrors.New(vtrpcpb.Code_INTERNAL, "[BUG] 'GetFields' called for Stream")
 }
 
-func (m *MStream) Description() PrimitiveDescription {
+func (m *MStream) description() PrimitiveDescription {
 	return PrimitiveDescription{
 		OperatorType:      "MStream",
 		Keyspace:          m.Keyspace,
diff --git a/go/vt/vtgate/engine/online_ddl.go b/go/vt/vtgate/engine/online_ddl.go
index e3c33ddf12..c7efa6792d 100644
--- a/go/vt/vtgate/engine/online_ddl.go
+++ b/go/vt/vtgate/engine/online_ddl.go
@@ -46,7 +46,7 @@ type OnlineDDL struct {
 	noInputs
 }
 
-func (v *OnlineDDL) Description() PrimitiveDescription {
+func (v *OnlineDDL) description() PrimitiveDescription {
 	return PrimitiveDescription{
 		OperatorType: "OnlineDDL",
 		Keyspace:     v.Keyspace,
@@ -71,7 +71,7 @@ func (v *OnlineDDL) GetTableName() string {
 	return v.DDL.GetTable().Name.String()
 }
 
-// Execute implements the Primitive interface
+// TryExecute implements the Primitive interface
 func (v *OnlineDDL) TryExecute(vcursor VCursor, bindVars map[string]*query.BindVariable, wantfields bool) (result *sqltypes.Result, err error) {
 	result = &sqltypes.Result{
 		Fields: []*querypb.Field{
@@ -114,7 +114,7 @@ func (v *OnlineDDL) TryExecute(vcursor VCursor, bindVars map[string]*query.BindV
 	return result, err
 }
 
-//StreamExecute implements the Primitive interface
+// TryStreamExecute implements the Primitive interface
 func (v *OnlineDDL) TryStreamExecute(vcursor VCursor, bindVars map[string]*query.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	results, err := v.TryExecute(vcursor, bindVars, wantfields)
 	if err != nil {
diff --git a/go/vt/vtgate/engine/ordered_aggregate.go b/go/vt/vtgate/engine/ordered_aggregate.go
index 9ba6f6c74f..08d9c4d9ad 100644
--- a/go/vt/vtgate/engine/ordered_aggregate.go
+++ b/go/vt/vtgate/engine/ordered_aggregate.go
@@ -251,7 +251,7 @@ func (oa *OrderedAggregate) execute(vcursor VCursor, bindVars map[string]*queryp
 	return out, nil
 }
 
-// StreamExecute is a Primitive function.
+// TryStreamExecute is a Primitive function.
 func (oa *OrderedAggregate) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	var current []sqltypes.Value
 	var curDistincts []sqltypes.Value
@@ -505,7 +505,7 @@ func groupByParamsToString(i interface{}) string {
 	return i.(*GroupByParams).String()
 }
 
-func (oa *OrderedAggregate) Description() PrimitiveDescription {
+func (oa *OrderedAggregate) description() PrimitiveDescription {
 	aggregates := GenericJoin(oa.Aggregates, aggregateParamsToString)
 	groupBy := GenericJoin(oa.GroupByKeys, groupByParamsToString)
 	other := map[string]interface{}{
diff --git a/go/vt/vtgate/engine/plan_description.go b/go/vt/vtgate/engine/plan_description.go
index 86cb993f2a..f3a0b21494 100644
--- a/go/vt/vtgate/engine/plan_description.go
+++ b/go/vt/vtgate/engine/plan_description.go
@@ -121,7 +121,7 @@ func marshalAdd(prepend string, buf *bytes.Buffer, name string, obj interface{})
 
 // PrimitiveToPlanDescription transforms a primitive tree into a corresponding PlanDescription tree
 func PrimitiveToPlanDescription(in Primitive) PrimitiveDescription {
-	this := in.Description()
+	this := in.description()
 
 	for _, input := range in.Inputs() {
 		this.Inputs = append(this.Inputs, PrimitiveToPlanDescription(input))
diff --git a/go/vt/vtgate/engine/primitive.go b/go/vt/vtgate/engine/primitive.go
index db4a5ee0a3..829ed10fde 100644
--- a/go/vt/vtgate/engine/primitive.go
+++ b/go/vt/vtgate/engine/primitive.go
@@ -199,9 +199,9 @@ type (
 		// Inputs is a slice containing the inputs to this Primitive
 		Inputs() []Primitive
 
-		// Description is the description, sans the inputs, of this Primitive.
+		// description is the description, sans the inputs, of this Primitive.
 		// to get the plan description with all children, use PrimitiveToPlanDescription()
-		Description() PrimitiveDescription
+		description() PrimitiveDescription
 	}
 
 	// noInputs default implementation for Primitives that are leaves
diff --git a/go/vt/vtgate/engine/projection.go b/go/vt/vtgate/engine/projection.go
index 3eaa8f6e20..d749e31139 100644
--- a/go/vt/vtgate/engine/projection.go
+++ b/go/vt/vtgate/engine/projection.go
@@ -31,7 +31,7 @@ func (p *Projection) GetTableName() string {
 	return p.Input.GetTableName()
 }
 
-// Execute implements the Primitive interface
+// TryExecute implements the Primitive interface
 func (p *Projection) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
 	result, err := vcursor.ExecutePrimitive(p.Input, bindVars, wantfields)
 	if err != nil {
@@ -64,7 +64,7 @@ func (p *Projection) TryExecute(vcursor VCursor, bindVars map[string]*querypb.Bi
 	return result, nil
 }
 
-// StreamExecute implements the Primitive interface
+// TryStreamExecute implements the Primitive interface
 func (p *Projection) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantields bool, callback func(*sqltypes.Result) error) error {
 	result, err := vcursor.ExecutePrimitive(p.Input, bindVars, wantields)
 	if err != nil {
@@ -130,8 +130,8 @@ func (p *Projection) Inputs() []Primitive {
 	return []Primitive{p.Input}
 }
 
-// Description implements the Primitive interface
-func (p *Projection) Description() PrimitiveDescription {
+// description implements the Primitive interface
+func (p *Projection) description() PrimitiveDescription {
 	var exprs []string
 	for _, e := range p.Exprs {
 		exprs = append(exprs, e.String())
diff --git a/go/vt/vtgate/engine/pullout_subquery.go b/go/vt/vtgate/engine/pullout_subquery.go
index 371c6d1b82..2378ea50a6 100644
--- a/go/vt/vtgate/engine/pullout_subquery.go
+++ b/go/vt/vtgate/engine/pullout_subquery.go
@@ -61,7 +61,7 @@ func (ps *PulloutSubquery) GetTableName() string {
 	return ps.Underlying.GetTableName()
 }
 
-// Execute satisfies the Primitive interface.
+// TryExecute satisfies the Primitive interface.
 func (ps *PulloutSubquery) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
 	combinedVars, err := ps.execSubquery(vcursor, bindVars)
 	if err != nil {
@@ -70,7 +70,7 @@ func (ps *PulloutSubquery) TryExecute(vcursor VCursor, bindVars map[string]*quer
 	return vcursor.ExecutePrimitive(ps.Underlying, combinedVars, wantfields)
 }
 
-// StreamExecute performs a streaming exec.
+// TryStreamExecute performs a streaming exec.
 func (ps *PulloutSubquery) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	combinedVars, err := ps.execSubquery(vcursor, bindVars)
 	if err != nil {
@@ -170,7 +170,7 @@ func (ps *PulloutSubquery) execSubquery(vcursor VCursor, bindVars map[string]*qu
 	return combinedVars, nil
 }
 
-func (ps *PulloutSubquery) Description() PrimitiveDescription {
+func (ps *PulloutSubquery) description() PrimitiveDescription {
 	return PrimitiveDescription{
 		OperatorType: "Subquery",
 		Variant:      ps.Opcode.String(),
diff --git a/go/vt/vtgate/engine/rename_fields.go b/go/vt/vtgate/engine/rename_fields.go
index 61a1c8988c..4bc8c676fd 100644
--- a/go/vt/vtgate/engine/rename_fields.go
+++ b/go/vt/vtgate/engine/rename_fields.go
@@ -60,7 +60,7 @@ func (r *RenameFields) GetTableName() string {
 	return r.Input.GetTableName()
 }
 
-// Execute implements the primitive interface
+// TryExecute implements the Primitive interface
 func (r *RenameFields) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
 	qr, err := vcursor.ExecutePrimitive(r.Input, bindVars, wantfields)
 	if err != nil {
@@ -82,7 +82,7 @@ func (r *RenameFields) renameFields(qr *sqltypes.Result) {
 	}
 }
 
-// StreamExecute implements the primitive interface
+// TryStreamExecute implements the Primitive interface
 func (r *RenameFields) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	if wantfields {
 		innerCallback := callback
@@ -113,8 +113,8 @@ func (r *RenameFields) Inputs() []Primitive {
 	return []Primitive{r.Input}
 }
 
-// Description implements the primitive interface
-func (r *RenameFields) Description() PrimitiveDescription {
+// description implements the primitive interface
+func (r *RenameFields) description() PrimitiveDescription {
 	return PrimitiveDescription{
 		OperatorType: "RenameFields",
 		Other: map[string]interface{}{
diff --git a/go/vt/vtgate/engine/replace_variables.go b/go/vt/vtgate/engine/replace_variables.go
index a9708f572a..15fc609ffd 100644
--- a/go/vt/vtgate/engine/replace_variables.go
+++ b/go/vt/vtgate/engine/replace_variables.go
@@ -49,7 +49,7 @@ func (r *ReplaceVariables) GetTableName() string {
 	return r.Input.GetTableName()
 }
 
-// Execute implements the Primitive interface
+// TryExecute implements the Primitive interface
 func (r *ReplaceVariables) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
 	qr, err := vcursor.ExecutePrimitive(r.Input, bindVars, wantfields)
 	if err != nil {
@@ -59,7 +59,7 @@ func (r *ReplaceVariables) TryExecute(vcursor VCursor, bindVars map[string]*quer
 	return qr, nil
 }
 
-// StreamExecute implements the Primitive interface
+// TryStreamExecute implements the Primitive interface
 func (r *ReplaceVariables) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	innerCallback := callback
 	callback = func(result *sqltypes.Result) error {
@@ -79,8 +79,8 @@ func (r *ReplaceVariables) Inputs() []Primitive {
 	return []Primitive{r.Input}
 }
 
-// Description implements the Primitive interface
-func (r *ReplaceVariables) Description() PrimitiveDescription {
+// description implements the Primitive interface
+func (r *ReplaceVariables) description() PrimitiveDescription {
 	return PrimitiveDescription{
 		OperatorType: "ReplaceVariables",
 	}
diff --git a/go/vt/vtgate/engine/revert_migration.go b/go/vt/vtgate/engine/revert_migration.go
index 71b6a4c72c..6408a8e0aa 100644
--- a/go/vt/vtgate/engine/revert_migration.go
+++ b/go/vt/vtgate/engine/revert_migration.go
@@ -44,7 +44,7 @@ type RevertMigration struct {
 	noInputs
 }
 
-func (v *RevertMigration) Description() PrimitiveDescription {
+func (v *RevertMigration) description() PrimitiveDescription {
 	return PrimitiveDescription{
 		OperatorType: "RevertMigration",
 		Keyspace:     v.Keyspace,
@@ -69,7 +69,7 @@ func (v *RevertMigration) GetTableName() string {
 	return ""
 }
 
-// Execute implements the Primitive interface
+// TryExecute implements the Primitive interface
 func (v *RevertMigration) TryExecute(vcursor VCursor, bindVars map[string]*query.BindVariable, wantfields bool) (result *sqltypes.Result, err error) {
 	result = &sqltypes.Result{
 		Fields: []*querypb.Field{
@@ -116,7 +116,7 @@ func (v *RevertMigration) TryExecute(vcursor VCursor, bindVars map[string]*query
 	return result, err
 }
 
-//StreamExecute implements the Primitive interface
+// TryStreamExecute implements the Primitive interface
 func (v *RevertMigration) TryStreamExecute(vcursor VCursor, bindVars map[string]*query.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	results, err := v.TryExecute(vcursor, bindVars, wantfields)
 	if err != nil {
diff --git a/go/vt/vtgate/engine/route.go b/go/vt/vtgate/engine/route.go
index 280a22f461..5879252b6d 100644
--- a/go/vt/vtgate/engine/route.go
+++ b/go/vt/vtgate/engine/route.go
@@ -242,7 +242,7 @@ func (route *Route) SetTruncateColumnCount(count int) {
 	route.TruncateColumnCount = count
 }
 
-// Execute performs a non-streaming exec.
+// TryExecute performs a non-streaming exec.
 func (route *Route) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
 	if route.QueryTimeout != 0 {
 		cancel := vcursor.SetContextTimeout(time.Duration(route.QueryTimeout) * time.Millisecond)
@@ -324,7 +324,7 @@ func filterOutNilErrors(errs []error) []error {
 	return errors
 }
 
-// StreamExecute performs a streaming exec.
+// TryStreamExecute performs a streaming exec.
 func (route *Route) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	var rss []*srvtopo.ResolvedShard
 	var bvs []map[string]*querypb.BindVariable
@@ -779,7 +779,7 @@ func allowOnlyPrimary(rss ...*srvtopo.ResolvedShard) error {
 	return nil
 }
 
-func (route *Route) Description() PrimitiveDescription {
+func (route *Route) description() PrimitiveDescription {
 	other := map[string]interface{}{
 		"Query":      route.Query,
 		"Table":      route.TableName,
diff --git a/go/vt/vtgate/engine/rows.go b/go/vt/vtgate/engine/rows.go
index 6d223a7f93..f047af7570 100644
--- a/go/vt/vtgate/engine/rows.go
+++ b/go/vt/vtgate/engine/rows.go
@@ -23,7 +23,7 @@ import (
 
 var _ Primitive = (*Rows)(nil)
 
-//Rows simply returns a number or rows
+// Rows simply returns a number or rows
 type Rows struct {
 	rows   [][]sqltypes.Value
 	fields []*querypb.Field
@@ -32,27 +32,27 @@ type Rows struct {
 	noTxNeeded
 }
 
-//NewRowsPrimitive returns a new Rows primitie
+// NewRowsPrimitive returns a new Rows primitie
 func NewRowsPrimitive(rows [][]sqltypes.Value, fields []*querypb.Field) *Rows {
 	return &Rows{rows: rows, fields: fields}
 }
 
-//RouteType implements the Primitive interface
+// RouteType implements the Primitive interface
 func (r *Rows) RouteType() string {
 	return "Rows"
 }
 
-//GetKeyspaceName implements the Primitive interface
+// GetKeyspaceName implements the Primitive interface
 func (r *Rows) GetKeyspaceName() string {
 	return ""
 }
 
-//GetTableName implements the Primitive interface
+// GetTableName implements the Primitive interface
 func (r *Rows) GetTableName() string {
 	return ""
 }
 
-//Execute implements the Primitive interface
+// TryExecute implements the Primitive interface
 func (r *Rows) TryExecute(VCursor, map[string]*querypb.BindVariable, bool) (*sqltypes.Result, error) {
 	return &sqltypes.Result{
 		Fields:   r.fields,
@@ -61,7 +61,7 @@ func (r *Rows) TryExecute(VCursor, map[string]*querypb.BindVariable, bool) (*sql
 	}, nil
 }
 
-//StreamExecute implements the Primitive interface
+// TryStreamExecute implements the Primitive interface
 func (r *Rows) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantields bool, callback func(*sqltypes.Result) error) error {
 	result, err := r.TryExecute(vcursor, bindVars, wantields)
 	if err != nil {
@@ -70,7 +70,7 @@ func (r *Rows) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.Bi
 	return callback(result)
 }
 
-//GetFields implements the Primitive interface
+// GetFields implements the Primitive interface
 func (r *Rows) GetFields(VCursor, map[string]*querypb.BindVariable) (*sqltypes.Result, error) {
 	return &sqltypes.Result{
 		Fields:   r.fields,
@@ -79,6 +79,6 @@ func (r *Rows) GetFields(VCursor, map[string]*querypb.BindVariable) (*sqltypes.R
 	}, nil
 }
 
-func (r *Rows) Description() PrimitiveDescription {
+func (r *Rows) description() PrimitiveDescription {
 	return PrimitiveDescription{OperatorType: "Rows"}
 }
diff --git a/go/vt/vtgate/engine/send.go b/go/vt/vtgate/engine/send.go
index b8a048f729..762764cc61 100644
--- a/go/vt/vtgate/engine/send.go
+++ b/go/vt/vtgate/engine/send.go
@@ -81,7 +81,7 @@ func (s *Send) GetTableName() string {
 	return ""
 }
 
-// Execute implements Primitive interface
+// TryExecute implements Primitive interface
 func (s *Send) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
 	rss, _, err := vcursor.ResolveDestinations(s.Keyspace.Name, nil, []key.Destination{s.TargetDestination})
 	if err != nil {
@@ -131,7 +131,7 @@ func copyBindVars(in map[string]*querypb.BindVariable) map[string]*querypb.BindV
 	return out
 }
 
-// StreamExecute implements Primitive interface
+// TryStreamExecute implements Primitive interface
 func (s *Send) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	rss, _, err := vcursor.ResolveDestinations(s.Keyspace.Name, nil, []key.Destination{s.TargetDestination})
 	if err != nil {
@@ -169,7 +169,7 @@ func (s *Send) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVaria
 	return qr, nil
 }
 
-func (s *Send) Description() PrimitiveDescription {
+func (s *Send) description() PrimitiveDescription {
 	other := map[string]interface{}{
 		"Query": s.Query,
 		"Table": s.GetTableName(),
diff --git a/go/vt/vtgate/engine/session_primitive.go b/go/vt/vtgate/engine/session_primitive.go
index c29485292f..bb2733456b 100644
--- a/go/vt/vtgate/engine/session_primitive.go
+++ b/go/vt/vtgate/engine/session_primitive.go
@@ -58,12 +58,12 @@ func (s *SessionPrimitive) GetTableName() string {
 	return ""
 }
 
-// Execute implements the Primitive interface
+// TryExecute implements the Primitive interface
 func (s *SessionPrimitive) TryExecute(vcursor VCursor, _ map[string]*querypb.BindVariable, _ bool) (*sqltypes.Result, error) {
 	return s.action(vcursor.Session())
 }
 
-// StreamExecute implements the Primitive interface
+// TryStreamExecute implements the Primitive interface
 func (s *SessionPrimitive) TryStreamExecute(vcursor VCursor, _ map[string]*querypb.BindVariable, _ bool, callback func(*sqltypes.Result) error) error {
 	qr, err := s.action(vcursor.Session())
 	if err != nil {
@@ -77,8 +77,8 @@ func (s *SessionPrimitive) GetFields(_ VCursor, _ map[string]*querypb.BindVariab
 	return nil, vterrors.New(vtrpcpb.Code_INTERNAL, "not supported for this primitive")
 }
 
-// Description implements the Primitive interface
-func (s *SessionPrimitive) Description() PrimitiveDescription {
+// description implements the Primitive interface
+func (s *SessionPrimitive) description() PrimitiveDescription {
 	return PrimitiveDescription{
 		OperatorType: s.name,
 	}
diff --git a/go/vt/vtgate/engine/set.go b/go/vt/vtgate/engine/set.go
index e5bd220816..53d8fe024d 100644
--- a/go/vt/vtgate/engine/set.go
+++ b/go/vt/vtgate/engine/set.go
@@ -94,22 +94,22 @@ type (
 
 var _ Primitive = (*Set)(nil)
 
-//RouteType implements the Primitive interface method.
+// RouteType implements the Primitive interface method.
 func (s *Set) RouteType() string {
 	return "Set"
 }
 
-//GetKeyspaceName implements the Primitive interface method.
+// GetKeyspaceName implements the Primitive interface method.
 func (s *Set) GetKeyspaceName() string {
 	return ""
 }
 
-//GetTableName implements the Primitive interface method.
+// GetTableName implements the Primitive interface method.
 func (s *Set) GetTableName() string {
 	return ""
 }
 
-//Execute implements the Primitive interface method.
+// TryExecute implements the Primitive interface method.
 func (s *Set) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, _ bool) (*sqltypes.Result, error) {
 	input, err := vcursor.ExecutePrimitive(s.Input, bindVars, false)
 	if err != nil {
@@ -131,7 +131,7 @@ func (s *Set) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVaria
 	return &sqltypes.Result{}, nil
 }
 
-//StreamExecute implements the Primitive interface method.
+// TryStreamExecute implements the Primitive interface method.
 func (s *Set) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantields bool, callback func(*sqltypes.Result) error) error {
 	result, err := s.TryExecute(vcursor, bindVars, wantields)
 	if err != nil {
@@ -140,17 +140,17 @@ func (s *Set) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.Bin
 	return callback(result)
 }
 
-//GetFields implements the Primitive interface method.
+// GetFields implements the Primitive interface method.
 func (s *Set) GetFields(VCursor, map[string]*querypb.BindVariable) (*sqltypes.Result, error) {
 	return &sqltypes.Result{}, nil
 }
 
-//Inputs implements the Primitive interface
+// Inputs implements the Primitive interface
 func (s *Set) Inputs() []Primitive {
 	return []Primitive{s.Input}
 }
 
-func (s *Set) Description() PrimitiveDescription {
+func (s *Set) description() PrimitiveDescription {
 	other := map[string]interface{}{
 		"Ops": s.Ops,
 	}
@@ -162,7 +162,7 @@ func (s *Set) Description() PrimitiveDescription {
 
 var _ SetOp = (*UserDefinedVariable)(nil)
 
-//MarshalJSON provides the type to SetOp for plan json
+// MarshalJSON provides the type to SetOp for plan json
 func (u *UserDefinedVariable) MarshalJSON() ([]byte, error) {
 	return json.Marshal(struct {
 		Type string
@@ -176,12 +176,12 @@ func (u *UserDefinedVariable) MarshalJSON() ([]byte, error) {
 
 }
 
-//VariableName implements the SetOp interface method.
+// VariableName implements the SetOp interface method.
 func (u *UserDefinedVariable) VariableName() string {
 	return u.Name
 }
 
-//Execute implements the SetOp interface method.
+// Execute implements the SetOp interface method.
 func (u *UserDefinedVariable) Execute(vcursor VCursor, env evalengine.ExpressionEnv) error {
 	value, err := u.Expr.Evaluate(env)
 	if err != nil {
@@ -192,7 +192,7 @@ func (u *UserDefinedVariable) Execute(vcursor VCursor, env evalengine.Expression
 
 var _ SetOp = (*SysVarIgnore)(nil)
 
-//MarshalJSON provides the type to SetOp for plan json
+// MarshalJSON provides the type to SetOp for plan json
 func (svi *SysVarIgnore) MarshalJSON() ([]byte, error) {
 	return json.Marshal(struct {
 		Type string
@@ -204,12 +204,12 @@ func (svi *SysVarIgnore) MarshalJSON() ([]byte, error) {
 
 }
 
-//VariableName implements the SetOp interface method.
+// VariableName implements the SetOp interface method.
 func (svi *SysVarIgnore) VariableName() string {
 	return svi.Name
 }
 
-//Execute implements the SetOp interface method.
+// Execute implements the SetOp interface method.
 func (svi *SysVarIgnore) Execute(VCursor, evalengine.ExpressionEnv) error {
 	log.Infof("Ignored inapplicable SET %v = %v", svi.Name, svi.Expr)
 	return nil
@@ -217,7 +217,7 @@ func (svi *SysVarIgnore) Execute(VCursor, evalengine.ExpressionEnv) error {
 
 var _ SetOp = (*SysVarCheckAndIgnore)(nil)
 
-//MarshalJSON provides the type to SetOp for plan json
+// MarshalJSON provides the type to SetOp for plan json
 func (svci *SysVarCheckAndIgnore) MarshalJSON() ([]byte, error) {
 	return json.Marshal(struct {
 		Type string
@@ -229,12 +229,12 @@ func (svci *SysVarCheckAndIgnore) MarshalJSON() ([]byte, error) {
 
 }
 
-//VariableName implements the SetOp interface method
+// VariableName implements the SetOp interface method
 func (svci *SysVarCheckAndIgnore) VariableName() string {
 	return svci.Name
 }
 
-//Execute implements the SetOp interface method
+// Execute implements the SetOp interface method
 func (svci *SysVarCheckAndIgnore) Execute(vcursor VCursor, env evalengine.ExpressionEnv) error {
 	rss, _, err := vcursor.ResolveDestinations(svci.Keyspace.Name, nil, []key.Destination{svci.TargetDestination})
 	if err != nil {
@@ -261,7 +261,7 @@ func (svci *SysVarCheckAndIgnore) Execute(vcursor VCursor, env evalengine.Expres
 
 var _ SetOp = (*SysVarReservedConn)(nil)
 
-//MarshalJSON provides the type to SetOp for plan json
+// MarshalJSON provides the type to SetOp for plan json
 func (svs *SysVarReservedConn) MarshalJSON() ([]byte, error) {
 	return json.Marshal(struct {
 		Type string
@@ -273,12 +273,12 @@ func (svs *SysVarReservedConn) MarshalJSON() ([]byte, error) {
 
 }
 
-//VariableName implements the SetOp interface method
+// VariableName implements the SetOp interface method
 func (svs *SysVarReservedConn) VariableName() string {
 	return svs.Name
 }
 
-//Execute implements the SetOp interface method
+// Execute implements the SetOp interface method
 func (svs *SysVarReservedConn) Execute(vcursor VCursor, env evalengine.ExpressionEnv) error {
 	// For those running on advanced vitess settings.
 	if svs.TargetDestination != nil {
@@ -349,7 +349,7 @@ func (svs *SysVarReservedConn) checkAndUpdateSysVar(vcursor VCursor, res evaleng
 
 var _ SetOp = (*SysVarSetAware)(nil)
 
-//MarshalJSON marshals all the json
+// MarshalJSON marshals all the json
 func (svss *SysVarSetAware) MarshalJSON() ([]byte, error) {
 	return json.Marshal(struct {
 		Type string
@@ -362,7 +362,7 @@ func (svss *SysVarSetAware) MarshalJSON() ([]byte, error) {
 	})
 }
 
-//Execute implements the SetOp interface method
+// Execute implements the SetOp interface method
 func (svss *SysVarSetAware) Execute(vcursor VCursor, env evalengine.ExpressionEnv) error {
 	var err error
 	switch svss.Name {
@@ -514,7 +514,7 @@ func (svss *SysVarSetAware) setBoolSysVar(env evalengine.ExpressionEnv, setter f
 	return setter(boolValue)
 }
 
-//VariableName implements the SetOp interface method
+// VariableName implements the SetOp interface method
 func (svss *SysVarSetAware) VariableName() string {
 	return svss.Name
 }
diff --git a/go/vt/vtgate/engine/simple_projection.go b/go/vt/vtgate/engine/simple_projection.go
index b0c93e5d74..46355cefe0 100644
--- a/go/vt/vtgate/engine/simple_projection.go
+++ b/go/vt/vtgate/engine/simple_projection.go
@@ -51,7 +51,7 @@ func (sc *SimpleProjection) GetTableName() string {
 	return sc.Input.GetTableName()
 }
 
-// Execute performs a non-streaming exec.
+// TryExecute performs a non-streaming exec.
 func (sc *SimpleProjection) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
 	inner, err := vcursor.ExecutePrimitive(sc.Input, bindVars, wantfields)
 	if err != nil {
@@ -60,7 +60,7 @@ func (sc *SimpleProjection) TryExecute(vcursor VCursor, bindVars map[string]*que
 	return sc.buildResult(inner), nil
 }
 
-// StreamExecute performs a streaming exec.
+// TryStreamExecute performs a streaming exec.
 func (sc *SimpleProjection) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	return vcursor.StreamExecutePrimitive(sc.Input, bindVars, wantfields, func(inner *sqltypes.Result) error {
 		return callback(sc.buildResult(inner))
@@ -108,7 +108,7 @@ func (sc *SimpleProjection) buildFields(inner *sqltypes.Result) []*querypb.Field
 	return fields
 }
 
-func (sc *SimpleProjection) Description() PrimitiveDescription {
+func (sc *SimpleProjection) description() PrimitiveDescription {
 	other := map[string]interface{}{
 		"Columns": sc.Cols,
 	}
diff --git a/go/vt/vtgate/engine/singlerow.go b/go/vt/vtgate/engine/singlerow.go
index cbc0d275e3..622246d36c 100644
--- a/go/vt/vtgate/engine/singlerow.go
+++ b/go/vt/vtgate/engine/singlerow.go
@@ -44,8 +44,8 @@ func (s *SingleRow) GetTableName() string {
 	return ""
 }
 
-// Execute performs a non-streaming exec.
-func (s *SingleRow) TryExecute(vcursor VCursor, bindVars map[string]*query.BindVariable, wantfields bool) (*sqltypes.Result, error) {
+// TryExecute performs a non-streaming exec.
+func (s *SingleRow) TryExecute(VCursor, map[string]*query.BindVariable, bool) (*sqltypes.Result, error) {
 	result := sqltypes.Result{
 		Rows: [][]sqltypes.Value{
 			{},
@@ -54,8 +54,8 @@ func (s *SingleRow) TryExecute(vcursor VCursor, bindVars map[string]*query.BindV
 	return &result, nil
 }
 
-// StreamExecute performs a streaming exec.
-func (s *SingleRow) TryStreamExecute(vcursor VCursor, bindVars map[string]*query.BindVariable, wantields bool, callback func(*sqltypes.Result) error) error {
+// TryStreamExecute performs a streaming exec.
+func (s *SingleRow) TryStreamExecute(_ VCursor, _ map[string]*query.BindVariable, _ bool, callback func(*sqltypes.Result) error) error {
 	result := sqltypes.Result{
 		Rows: [][]sqltypes.Value{
 			{},
@@ -65,11 +65,11 @@ func (s *SingleRow) TryStreamExecute(vcursor VCursor, bindVars map[string]*query
 }
 
 // GetFields fetches the field info.
-func (s *SingleRow) GetFields(vcursor VCursor, bindVars map[string]*query.BindVariable) (*sqltypes.Result, error) {
+func (s *SingleRow) GetFields(_ VCursor, _ map[string]*query.BindVariable) (*sqltypes.Result, error) {
 	return &sqltypes.Result{}, nil
 }
 
-func (s *SingleRow) Description() PrimitiveDescription {
+func (s *SingleRow) description() PrimitiveDescription {
 	return PrimitiveDescription{
 		OperatorType: "SingleRow",
 	}
diff --git a/go/vt/vtgate/engine/sql_calc_found_rows.go b/go/vt/vtgate/engine/sql_calc_found_rows.go
index 5475c02777..f6ccdc2c40 100644
--- a/go/vt/vtgate/engine/sql_calc_found_rows.go
+++ b/go/vt/vtgate/engine/sql_calc_found_rows.go
@@ -26,28 +26,28 @@ import (
 
 var _ Primitive = (*SQLCalcFoundRows)(nil)
 
-//SQLCalcFoundRows is a primitive to execute limit and count query as per their individual plan.
+// SQLCalcFoundRows is a primitive to execute limit and count query as per their individual plan.
 type SQLCalcFoundRows struct {
 	LimitPrimitive Primitive
 	CountPrimitive Primitive
 }
 
-//RouteType implements the Primitive interface
+// RouteType implements the Primitive interface
 func (s SQLCalcFoundRows) RouteType() string {
 	return "SQLCalcFoundRows"
 }
 
-//GetKeyspaceName implements the Primitive interface
+// GetKeyspaceName implements the Primitive interface
 func (s SQLCalcFoundRows) GetKeyspaceName() string {
 	return s.LimitPrimitive.GetKeyspaceName()
 }
 
-//GetTableName implements the Primitive interface
+// GetTableName implements the Primitive interface
 func (s SQLCalcFoundRows) GetTableName() string {
 	return s.LimitPrimitive.GetTableName()
 }
 
-//Execute implements the Primitive interface
+// TryExecute implements the Primitive interface
 func (s SQLCalcFoundRows) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
 	limitQr, err := vcursor.ExecutePrimitive(s.LimitPrimitive, bindVars, wantfields)
 	if err != nil {
@@ -68,7 +68,7 @@ func (s SQLCalcFoundRows) TryExecute(vcursor VCursor, bindVars map[string]*query
 	return limitQr, nil
 }
 
-//StreamExecute implements the Primitive interface
+// TryStreamExecute implements the Primitive interface
 func (s SQLCalcFoundRows) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	err := vcursor.StreamExecutePrimitive(s.LimitPrimitive, bindVars, wantfields, callback)
 	if err != nil {
@@ -102,22 +102,22 @@ func (s SQLCalcFoundRows) TryStreamExecute(vcursor VCursor, bindVars map[string]
 	return nil
 }
 
-//GetFields implements the Primitive interface
+// GetFields implements the Primitive interface
 func (s SQLCalcFoundRows) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error) {
 	return s.LimitPrimitive.GetFields(vcursor, bindVars)
 }
 
-//NeedsTransaction implements the Primitive interface
+// NeedsTransaction implements the Primitive interface
 func (s SQLCalcFoundRows) NeedsTransaction() bool {
 	return s.LimitPrimitive.NeedsTransaction()
 }
 
-//Inputs implements the Primitive interface
+// Inputs implements the Primitive interface
 func (s SQLCalcFoundRows) Inputs() []Primitive {
 	return []Primitive{s.LimitPrimitive, s.CountPrimitive}
 }
 
-func (s SQLCalcFoundRows) Description() PrimitiveDescription {
+func (s SQLCalcFoundRows) description() PrimitiveDescription {
 	return PrimitiveDescription{
 		OperatorType: "SQL_CALC_FOUND_ROWS",
 	}
diff --git a/go/vt/vtgate/engine/update.go b/go/vt/vtgate/engine/update.go
index cf79a95206..9bb52b3719 100644
--- a/go/vt/vtgate/engine/update.go
+++ b/go/vt/vtgate/engine/update.go
@@ -80,7 +80,7 @@ func (upd *Update) GetTableName() string {
 	return ""
 }
 
-// Execute performs a non-streaming exec.
+// TryExecute performs a non-streaming exec.
 func (upd *Update) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
 	if upd.QueryTimeout != 0 {
 		cancel := vcursor.SetContextTimeout(time.Duration(upd.QueryTimeout) * time.Millisecond)
@@ -104,7 +104,7 @@ func (upd *Update) TryExecute(vcursor VCursor, bindVars map[string]*querypb.Bind
 	}
 }
 
-// StreamExecute performs a streaming exec.
+// TryStreamExecute performs a streaming exec.
 func (upd *Update) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	return fmt.Errorf("query %q cannot be used for streaming", upd.Query)
 }
@@ -269,7 +269,7 @@ func (upd *Update) updateVindexEntries(vcursor VCursor, bindVars map[string]*que
 	return nil
 }
 
-func (upd *Update) Description() PrimitiveDescription {
+func (upd *Update) description() PrimitiveDescription {
 	other := map[string]interface{}{
 		"Query":                upd.Query,
 		"Table":                upd.GetTableName(),
diff --git a/go/vt/vtgate/engine/update_target.go b/go/vt/vtgate/engine/update_target.go
index e9f75e2acb..3ade69ebd5 100644
--- a/go/vt/vtgate/engine/update_target.go
+++ b/go/vt/vtgate/engine/update_target.go
@@ -36,7 +36,7 @@ type UpdateTarget struct {
 	noTxNeeded
 }
 
-func (updTarget *UpdateTarget) Description() PrimitiveDescription {
+func (updTarget *UpdateTarget) description() PrimitiveDescription {
 	return PrimitiveDescription{
 		OperatorType: "UpdateTarget",
 		Other:        map[string]interface{}{"target": updTarget.Target},
@@ -58,7 +58,7 @@ func (updTarget *UpdateTarget) GetTableName() string {
 	return ""
 }
 
-// Execute implements the Primitive interface
+// TryExecute implements the Primitive interface
 func (updTarget *UpdateTarget) TryExecute(vcursor VCursor, bindVars map[string]*query.BindVariable, wantfields bool) (*sqltypes.Result, error) {
 	err := vcursor.Session().SetTarget(updTarget.Target)
 	if err != nil {
@@ -67,7 +67,7 @@ func (updTarget *UpdateTarget) TryExecute(vcursor VCursor, bindVars map[string]*
 	return &sqltypes.Result{}, nil
 }
 
-// StreamExecute implements the Primitive interface
+// TryStreamExecute implements the Primitive interface
 func (updTarget *UpdateTarget) TryStreamExecute(vcursor VCursor, bindVars map[string]*query.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	result, err := updTarget.TryExecute(vcursor, bindVars, wantfields)
 	if err != nil {
diff --git a/go/vt/vtgate/engine/vindex_func.go b/go/vt/vtgate/engine/vindex_func.go
index 9d54c1a59a..fd102f38be 100644
--- a/go/vt/vtgate/engine/vindex_func.go
+++ b/go/vt/vtgate/engine/vindex_func.go
@@ -85,12 +85,12 @@ func (vf *VindexFunc) GetTableName() string {
 	return ""
 }
 
-// Execute performs a non-streaming exec.
+// TryExecute performs a non-streaming exec.
 func (vf *VindexFunc) TryExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
 	return vf.mapVindex(vcursor, bindVars)
 }
 
-// StreamExecute performs a streaming exec.
+// TryStreamExecute performs a streaming exec.
 func (vf *VindexFunc) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	r, err := vf.mapVindex(vcursor, bindVars)
 	if err != nil {
@@ -204,7 +204,7 @@ func (vf *VindexFunc) buildRow(id sqltypes.Value, ksid []byte, kr *topodatapb.Ke
 	return row
 }
 
-func (vf *VindexFunc) Description() PrimitiveDescription {
+func (vf *VindexFunc) description() PrimitiveDescription {
 	fields := map[string]string{}
 	for _, field := range vf.Fields {
 		fields[field.Name] = field.Type.String()
diff --git a/go/vt/vtgate/engine/vschema_ddl.go b/go/vt/vtgate/engine/vschema_ddl.go
index 87e6a69831..4273755023 100644
--- a/go/vt/vtgate/engine/vschema_ddl.go
+++ b/go/vt/vtgate/engine/vschema_ddl.go
@@ -38,7 +38,7 @@ type AlterVSchema struct {
 	noInputs
 }
 
-func (v *AlterVSchema) Description() PrimitiveDescription {
+func (v *AlterVSchema) description() PrimitiveDescription {
 	return PrimitiveDescription{
 		OperatorType: "AlterVSchema",
 		Keyspace:     v.Keyspace,
@@ -48,22 +48,22 @@ func (v *AlterVSchema) Description() PrimitiveDescription {
 	}
 }
 
-//RouteType implements the Primitive interface
+// RouteType implements the Primitive interface
 func (v *AlterVSchema) RouteType() string {
 	return "AlterVSchema"
 }
 
-//GetKeyspaceName implements the Primitive interface
+// GetKeyspaceName implements the Primitive interface
 func (v *AlterVSchema) GetKeyspaceName() string {
 	return v.Keyspace.Name
 }
 
-//GetTableName implements the Primitive interface
+// GetTableName implements the Primitive interface
 func (v *AlterVSchema) GetTableName() string {
 	return v.AlterVschemaDDL.Table.Name.String()
 }
 
-//Execute implements the Primitive interface
+// TryExecute implements the Primitive interface
 func (v *AlterVSchema) TryExecute(vcursor VCursor, bindVars map[string]*query.BindVariable, wantfields bool) (*sqltypes.Result, error) {
 	err := vcursor.ExecuteVSchema(v.Keyspace.Name, v.AlterVschemaDDL)
 	if err != nil {
@@ -72,12 +72,12 @@ func (v *AlterVSchema) TryExecute(vcursor VCursor, bindVars map[string]*query.Bi
 	return &sqltypes.Result{}, nil
 }
 
-//StreamExecute implements the Primitive interface
+// TryStreamExecute implements the Primitive interface
 func (v *AlterVSchema) TryStreamExecute(vcursor VCursor, bindVars map[string]*query.BindVariable, wantields bool, callback func(*sqltypes.Result) error) error {
 	return vterrors.Errorf(vtrpcpb.Code_UNIMPLEMENTED, "Alter vschema not supported in streaming")
 }
 
-//GetFields implements the Primitive interface
+// GetFields implements the Primitive interface
 func (v *AlterVSchema) GetFields(vcursor VCursor, bindVars map[string]*query.BindVariable) (*sqltypes.Result, error) {
 	return nil, vterrors.NewErrorf(vtrpcpb.Code_UNIMPLEMENTED, vterrors.UnsupportedPS, "This command is not supported in the prepared statement protocol yet")
 }
diff --git a/go/vt/vtgate/engine/vstream.go b/go/vt/vtgate/engine/vstream.go
index de14ffedab..3d7223eba6 100644
--- a/go/vt/vtgate/engine/vstream.go
+++ b/go/vt/vtgate/engine/vstream.go
@@ -60,12 +60,12 @@ func (v *VStream) GetTableName() string {
 	return v.TableName
 }
 
-// Execute implements the Primitive interface
+// TryExecute implements the Primitive interface
 func (v *VStream) TryExecute(_ VCursor, _ map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
 	return nil, vterrors.New(vtrpcpb.Code_INTERNAL, "[BUG] 'Execute' called for VStream")
 }
 
-// StreamExecute implements the Primitive interface
+// TryStreamExecute implements the Primitive interface
 func (v *VStream) TryStreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
 	rss, _, err := vcursor.ResolveDestinations(v.Keyspace.Name, nil, []key.Destination{v.TargetDestination})
 	if err != nil {
@@ -145,7 +145,7 @@ func (v *VStream) GetFields(_ VCursor, _ map[string]*querypb.BindVariable) (*sql
 	return nil, vterrors.New(vtrpcpb.Code_INTERNAL, "[BUG] 'GetFields' called for VStream")
 }
 
-func (v *VStream) Description() PrimitiveDescription {
+func (v *VStream) description() PrimitiveDescription {
 	other := map[string]interface{}{
 		"Table":    v.TableName,
 		"Limit":    v.Limit,
diff --git a/go/vt/vtgate/planbuilder/abstract/join.go b/go/vt/vtgate/planbuilder/abstract/join.go
index 67a5152af5..843828b2c5 100644
--- a/go/vt/vtgate/planbuilder/abstract/join.go
+++ b/go/vt/vtgate/planbuilder/abstract/join.go
@@ -25,9 +25,8 @@ import (
 
 // Join represents a join. If we have a predicate, this is an inner join. If no predicate exists, it is a cross join
 type Join struct {
-	LHS, RHS  Operator
-	Predicate sqlparser.Expr
-	LeftJoin  bool
+	LHS, RHS Operator
+	Exp      sqlparser.Expr
 }
 
 var _ Operator = (*Join)(nil)
@@ -39,29 +38,9 @@ func (j *Join) PushPredicate(expr sqlparser.Expr, semTable *semantics.SemTable)
 	case deps.IsSolvedBy(j.LHS.TableID()):
 		return j.LHS.PushPredicate(expr, semTable)
 	case deps.IsSolvedBy(j.RHS.TableID()):
-		if !j.LeftJoin {
-			return j.RHS.PushPredicate(expr, semTable)
-		}
-		// we are looking for predicates like `tbl.col = <>` or `<> = tbl.col`,
-		// where tbl is on the rhs of the left outer join
-		if cmp, isCmp := expr.(*sqlparser.ComparisonExpr); isCmp && cmp.Operator != sqlparser.NullSafeEqualOp &&
-			sqlparser.IsColName(cmp.Left) && semTable.RecursiveDeps(cmp.Left).IsSolvedBy(j.RHS.TableID()) ||
-			sqlparser.IsColName(cmp.Right) && semTable.RecursiveDeps(cmp.Right).IsSolvedBy(j.RHS.TableID()) {
-			// When the predicate we are pushing is using information from an outer table, we can
-			// check whether the predicate is "null-intolerant" or not. Null-intolerant in this context means that
-			// the predicate will not return true if the table columns are null.
-			// Since an outer join is an inner join with the addition of all the rows from the left-hand side that
-			// matched no rows on the right-hand, if we are later going to remove all the rows where the right-hand
-			// side did not match, we might as well turn the join into an inner join.
-
-			// This is based on the paper "Canonical Abstraction for Outerjoin Optimization" by J Rao et al
-			j.LeftJoin = false
-			return j.RHS.PushPredicate(expr, semTable)
-		}
-		// TODO - we should do this on the vtgate level once we have a Filter primitive
-		return vterrors.Errorf(vtrpcpb.Code_UNIMPLEMENTED, "unsupported: cross-shard left join and where clause")
+		return j.RHS.PushPredicate(expr, semTable)
 	case deps.IsSolvedBy(j.LHS.TableID().Merge(j.RHS.TableID())):
-		j.Predicate = sqlparser.AndExpressions(j.Predicate, expr)
+		j.Exp = sqlparser.AndExpressions(j.Exp, expr)
 		return nil
 	}
 
diff --git a/go/vt/vtgate/planbuilder/abstract/left_join.go b/go/vt/vtgate/planbuilder/abstract/left_join.go
new file mode 100644
index 0000000000..49cfd251f8
--- /dev/null
+++ b/go/vt/vtgate/planbuilder/abstract/left_join.go
@@ -0,0 +1,80 @@
+/*
+Copyright 2021 The Vitess Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package abstract
+
+import (
+	vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc"
+	"vitess.io/vitess/go/vt/sqlparser"
+	"vitess.io/vitess/go/vt/vterrors"
+	"vitess.io/vitess/go/vt/vtgate/semantics"
+)
+
+// LeftJoin represents an outerjoin.
+type LeftJoin struct {
+	Left, Right Operator
+	Predicate   sqlparser.Expr
+}
+
+var _ Operator = (*LeftJoin)(nil)
+
+// PushPredicate implements the Operator interface
+func (lj *LeftJoin) PushPredicate(expr sqlparser.Expr, semTable *semantics.SemTable) error {
+	deps := semTable.RecursiveDeps(expr)
+	if deps.IsSolvedBy(lj.Left.TableID()) {
+		return lj.Left.PushPredicate(expr, semTable)
+	}
+
+	return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "Cannot push predicate: %s", sqlparser.String(expr))
+}
+
+// TableID implements the Operator interface
+func (lj *LeftJoin) TableID() semantics.TableSet {
+	return lj.Right.TableID().Merge(lj.Left.TableID())
+}
+
+// UnsolvedPredicates implements the Operator interface
+func (lj *LeftJoin) UnsolvedPredicates(semTable *semantics.SemTable) []sqlparser.Expr {
+	ts := lj.TableID()
+	var result []sqlparser.Expr
+	for _, expr := range lj.Left.UnsolvedPredicates(semTable) {
+		deps := semTable.DirectDeps(expr)
+		if !deps.IsSolvedBy(ts) {
+			result = append(result, expr)
+		}
+	}
+	for _, expr := range lj.Right.UnsolvedPredicates(semTable) {
+		deps := semTable.DirectDeps(expr)
+		if !deps.IsSolvedBy(ts) {
+			result = append(result, expr)
+		}
+	}
+	return result
+}
+
+// CheckValid implements the Operator interface
+func (lj *LeftJoin) CheckValid() error {
+	err := lj.Left.CheckValid()
+	if err != nil {
+		return err
+	}
+	return lj.Right.CheckValid()
+}
+
+// Compact implements the Operator interface
+func (lj *LeftJoin) Compact() Operator {
+	return lj
+}
diff --git a/go/vt/vtgate/planbuilder/abstract/operator.go b/go/vt/vtgate/planbuilder/abstract/operator.go
index 1727ede5d6..0f6f5a6d79 100644
--- a/go/vt/vtgate/planbuilder/abstract/operator.go
+++ b/go/vt/vtgate/planbuilder/abstract/operator.go
@@ -107,20 +107,23 @@ func getOperatorFromTableExpr(tableExpr sqlparser.TableExpr, semTable *semantics
 			}
 			return op, nil
 		case sqlparser.LeftJoinType, sqlparser.RightJoinType:
-			lhs, err := getOperatorFromTableExpr(tableExpr.LeftExpr, semTable)
+			inner, err := getOperatorFromTableExpr(tableExpr.LeftExpr, semTable)
 			if err != nil {
 				return nil, err
 			}
-			rhs, err := getOperatorFromTableExpr(tableExpr.RightExpr, semTable)
+			outer, err := getOperatorFromTableExpr(tableExpr.RightExpr, semTable)
 			if err != nil {
 				return nil, err
 			}
 			if tableExpr.Join == sqlparser.RightJoinType {
-				lhs, rhs = rhs, lhs
+				inner, outer = outer, inner
+			}
+			op := &LeftJoin{
+				Left:      inner,
+				Right:     outer,
+				Predicate: tableExpr.Condition.On,
 			}
-			return &Join{LHS: lhs, RHS: rhs, LeftJoin: true, Predicate: tableExpr.Condition.On}, nil
-		case sqlparser.StraightJoinType:
-			return nil, semantics.Gen4NotSupportedF(tableExpr.Join.ToString())
+			return op, nil
 		default:
 			return nil, vterrors.Errorf(vtrpcpb.Code_UNIMPLEMENTED, "unsupported: %s", tableExpr.Join.ToString())
 		}
@@ -202,10 +205,7 @@ func createOperatorFromSelect(sel *sqlparser.Select, semTable *semantics.SemTabl
 	if len(semTable.SubqueryMap[sel]) > 0 {
 		resultantOp = &SubQuery{}
 		for _, sq := range semTable.SubqueryMap[sel] {
-			subquerySelectStatement, isSel := sq.SubQuery.Select.(*sqlparser.Select)
-			if !isSel {
-				return nil, semantics.Gen4NotSupportedF("UNION in subquery")
-			}
+			subquerySelectStatement := sq.SubQuery.Select.(*sqlparser.Select)
 			opInner, err := createOperatorFromSelect(subquerySelectStatement, semTable)
 			if err != nil {
 				return nil, err
diff --git a/go/vt/vtgate/planbuilder/gen4_compare_v3_planner.go b/go/vt/vtgate/planbuilder/gen4_compare_v3_planner.go
index 59b5bc0327..072e7ceacb 100644
--- a/go/vt/vtgate/planbuilder/gen4_compare_v3_planner.go
+++ b/go/vt/vtgate/planbuilder/gen4_compare_v3_planner.go
@@ -37,15 +37,6 @@ func gen4CompareV3Planner(query string) func(sqlparser.Statement, *sqlparser.Res
 		// plan statement using Gen4
 		gen4Primitive, gen4Err := planWithPlannerVersion(statement, vars, ctxVSchema, query, Gen4)
 
-		// get V3's plan
-		v3Primitive, v3Err := planWithPlannerVersion(statement, vars, ctxVSchema, query, V3)
-
-		// check potential errors from Gen4 and V3
-		err = engine.CompareV3AndGen4Errors(v3Err, gen4Err)
-		if err != nil {
-			return nil, err
-		}
-
 		// if onlyGen4 is set to true or Gen4's instruction contain a lock primitive,
 		// we use only Gen4's primitive and exit early without using V3's.
 		// since lock primitives can imply the creation or deletion of locks,
@@ -55,6 +46,15 @@ func gen4CompareV3Planner(query string) func(sqlparser.Statement, *sqlparser.Res
 			return gen4Primitive, gen4Err
 		}
 
+		// get V3's plan
+		v3Primitive, v3Err := planWithPlannerVersion(statement, vars, ctxVSchema, query, V3)
+
+		// check potential errors from Gen4 and V3
+		err = engine.CompareV3AndGen4Errors(v3Err, gen4Err)
+		if err != nil {
+			return nil, err
+		}
+
 		return &engine.Gen4CompareV3{
 			V3:         v3Primitive,
 			Gen4:       gen4Primitive,
diff --git a/go/vt/vtgate/planbuilder/horizon_planning.go b/go/vt/vtgate/planbuilder/horizon_planning.go
index d4ad176416..c3e294fbcd 100644
--- a/go/vt/vtgate/planbuilder/horizon_planning.go
+++ b/go/vt/vtgate/planbuilder/horizon_planning.go
@@ -517,8 +517,6 @@ func planGroupByGen4(groupExpr abstract.GroupBy, plan logicalPlan, semTable *sem
 			return false, err
 		}
 		return colAdded || colAddedRecursively, nil
-	case *pulloutSubquery:
-		return false, vterrors.New(vtrpcpb.Code_UNIMPLEMENTED, "unsupported: subqueries disallowed in GROUP BY")
 	default:
 		return false, vterrors.Errorf(vtrpcpb.Code_UNIMPLEMENTED, "unsupported: group by on: %T", plan)
 	}
@@ -605,23 +603,11 @@ func (hp *horizonPlanning) planOrderBy(ctx *planningContext, orderExprs []abstra
 		}
 		plan.input = newUnderlyingPlan
 		return plan, nil
-	case *simpleProjection:
-		return nil, semantics.Gen4NotSupportedF("unsupported: ordering on derived table query")
-	case *vindexFunc:
-		return nil, semantics.Gen4NotSupportedF("unsupported: ordering on vindex func")
 	default:
 		return nil, vterrors.Errorf(vtrpcpb.Code_UNIMPLEMENTED, "ordering on complex query %T", plan)
 	}
 }
 
-func isSpecialOrderBy(o abstract.OrderBy) bool {
-	if sqlparser.IsNull(o.Inner.Expr) {
-		return true
-	}
-	f, isFunction := o.Inner.Expr.(*sqlparser.FuncExpr)
-	return isFunction && f.Name.Lowered() == "rand"
-}
-
 func planOrderByForRoute(orderExprs []abstract.OrderBy, plan *route, semTable *semantics.SemTable, hasStar bool) (logicalPlan, bool, error) {
 	origColCount := plan.Select.GetColumnCount()
 	for _, order := range orderExprs {
@@ -630,7 +616,7 @@ func planOrderByForRoute(orderExprs []abstract.OrderBy, plan *route, semTable *s
 			return nil, false, err
 		}
 		plan.Select.AddOrder(order.Inner)
-		if isSpecialOrderBy(order) {
+		if sqlparser.IsNull(order.Inner.Expr) {
 			continue
 		}
 		offset, weightStringOffset, _, err := wrapAndPushExpr(order.Inner.Expr, order.WeightStrExpr, plan, semTable)
@@ -678,13 +664,9 @@ func wrapAndPushExpr(expr sqlparser.Expr, weightStrExpr sqlparser.Expr, plan log
 	if weightStrExpr == nil {
 		return offset, -1, added, nil
 	}
-	if !sqlparser.IsColName(expr) {
-		unary, ok := expr.(*sqlparser.UnaryExpr)
-		if ok && sqlparser.IsColName(unary.Expr) {
-			expr = unary.Expr
-		} else {
-			return 0, 0, false, vterrors.Errorf(vtrpcpb.Code_UNIMPLEMENTED, "unsupported: in scatter query: complex order by expression: %s", sqlparser.String(expr))
-		}
+	_, ok := expr.(*sqlparser.ColName)
+	if !ok {
+		return 0, 0, false, vterrors.Errorf(vtrpcpb.Code_UNIMPLEMENTED, "unsupported: in scatter query: complex order by expression: %s", sqlparser.String(expr))
 	}
 	qt := semTable.TypeFor(expr)
 	wsNeeded := true
@@ -716,19 +698,6 @@ func weightStringFor(expr sqlparser.Expr) sqlparser.Expr {
 }
 
 func (hp *horizonPlanning) planOrderByForJoin(ctx *planningContext, orderExprs []abstract.OrderBy, plan *joinGen4) (logicalPlan, error) {
-	if len(orderExprs) == 1 && isSpecialOrderBy(orderExprs[0]) {
-		lhs, err := hp.planOrderBy(ctx, orderExprs, plan.Left)
-		if err != nil {
-			return nil, err
-		}
-		rhs, err := hp.planOrderBy(ctx, orderExprs, plan.Right)
-		if err != nil {
-			return nil, err
-		}
-		plan.Left = lhs
-		plan.Right = rhs
-		return plan, nil
-	}
 	if allLeft(orderExprs, ctx.semTable, plan.Left.ContainsTables()) {
 		newLeft, err := hp.planOrderBy(ctx, orderExprs, plan.Left)
 		if err != nil {
diff --git a/go/vt/vtgate/planbuilder/jointree.go b/go/vt/vtgate/planbuilder/jointree.go
index c687d89bbb..4f9c217585 100644
--- a/go/vt/vtgate/planbuilder/jointree.go
+++ b/go/vt/vtgate/planbuilder/jointree.go
@@ -31,7 +31,7 @@ type joinTree struct {
 	// the children of this plan
 	lhs, rhs queryTree
 
-	leftJoin bool
+	outer bool
 }
 
 var _ queryTree = (*joinTree)(nil)
@@ -42,10 +42,10 @@ func (jp *joinTree) tableID() semantics.TableSet {
 
 func (jp *joinTree) clone() queryTree {
 	result := &joinTree{
-		lhs:      jp.lhs.clone(),
-		rhs:      jp.rhs.clone(),
-		leftJoin: jp.leftJoin,
-		vars:     jp.vars,
+		lhs:   jp.lhs.clone(),
+		rhs:   jp.rhs.clone(),
+		outer: jp.outer,
+		vars:  jp.vars,
 	}
 	return result
 }
diff --git a/go/vt/vtgate/planbuilder/ordering.go b/go/vt/vtgate/planbuilder/ordering.go
index 24a2d4231e..09aee28e22 100644
--- a/go/vt/vtgate/planbuilder/ordering.go
+++ b/go/vt/vtgate/planbuilder/ordering.go
@@ -16,7 +16,7 @@ package planbuilder
 import (
 	"fmt"
 
-	vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc"
+	"vitess.io/vitess/go/vt/proto/vtrpc"
 	"vitess.io/vitess/go/vt/sqlparser"
 	"vitess.io/vitess/go/vt/vterrors"
 	"vitess.io/vitess/go/vt/vtgate/engine"
@@ -55,14 +55,14 @@ func planOrdering(pb *primitiveBuilder, input logicalPlan, orderBy v3OrderBy) (l
 	case *orderedAggregate:
 		return planOAOrdering(pb, orderBy, node)
 	case *mergeSort:
-		return nil, vterrors.Errorf(vtrpcpb.Code_UNIMPLEMENTED, "can't do ORDER BY on top of ORDER BY")
+		return nil, vterrors.Errorf(vtrpc.Code_UNIMPLEMENTED, "can't do ORDER BY on top of ORDER BY")
 	case *concatenate:
 		if len(orderBy) == 0 {
 			return input, nil
 		}
-		return nil, vterrors.Errorf(vtrpcpb.Code_UNIMPLEMENTED, "can't do ORDER BY on top of UNION")
+		return nil, vterrors.Errorf(vtrpc.Code_UNIMPLEMENTED, "can't do ORDER BY on top of UNION")
 	}
-	return nil, vterrors.Errorf(vtrpcpb.Code_INTERNAL, "[BUG] unreachable %T.ordering", input)
+	return nil, vterrors.Errorf(vtrpc.Code_INTERNAL, "[BUG] unreachable %T.ordering", input)
 }
 
 func planOAOrdering(pb *primitiveBuilder, orderBy v3OrderBy, oa *orderedAggregate) (logicalPlan, error) {
@@ -213,11 +213,11 @@ func planJoinOrdering(pb *primitiveBuilder, orderBy v3OrderBy, node *join) (logi
 				switch e := in.(type) {
 				case *sqlparser.ColName:
 					if e.Metadata.(*column).Origin().Order() > node.Left.Order() {
-						return false, vterrors.New(vtrpcpb.Code_UNIMPLEMENTED, "unsupported: order by spans across shards")
+						return false, vterrors.New(vtrpc.Code_UNIMPLEMENTED, "unsupported: order by spans across shards")
 					}
 				case *sqlparser.Subquery:
 					// Unreachable because ResolveSymbols perfoms this check up above.
-					return false, vterrors.New(vtrpcpb.Code_UNIMPLEMENTED, "unsupported: order by has subquery")
+					return false, vterrors.New(vtrpc.Code_UNIMPLEMENTED, "unsupported: order by has subquery")
 				}
 				return true, nil
 			}, order.Expr)
@@ -320,8 +320,8 @@ func planRouteOrdering(orderBy v3OrderBy, node *route) (logicalPlan, error) {
 						} else {
 							tableMeta = tableMap[tableName]
 						}
-						if tableMeta == nil || !tableMeta.isAuthoritative {
-							return nil, vterrors.Errorf(vtrpcpb.Code_UNIMPLEMENTED, "unsupported: in scatter query, can't order by a column that comes after `*` expressions in the SELECT list")
+						if tableMeta == nil {
+							break
 						}
 						starColFixedIndex += len(tableMeta.columnNames) - 1
 					}
diff --git a/go/vt/vtgate/planbuilder/querytree_transformers.go b/go/vt/vtgate/planbuilder/querytree_transformers.go
index c881a7d1b9..88a503a9b6 100644
--- a/go/vt/vtgate/planbuilder/querytree_transformers.go
+++ b/go/vt/vtgate/planbuilder/querytree_transformers.go
@@ -357,7 +357,7 @@ func transformJoinPlan(ctx *planningContext, n *joinTree) (logicalPlan, error) {
 		return nil, err
 	}
 	opCode := engine.InnerJoin
-	if n.leftJoin {
+	if n.outer {
 		opCode = engine.LeftJoin
 	}
 	return &joinGen4{
diff --git a/go/vt/vtgate/planbuilder/route_planning.go b/go/vt/vtgate/planbuilder/route_planning.go
index b9770a625a..dc1e85b4f6 100644
--- a/go/vt/vtgate/planbuilder/route_planning.go
+++ b/go/vt/vtgate/planbuilder/route_planning.go
@@ -56,6 +56,16 @@ func optimizeQuery(ctx *planningContext, opTree abstract.Operator) (queryTree, e
 		default:
 			return greedySolve(ctx, op)
 		}
+	case *abstract.LeftJoin:
+		treeInner, err := optimizeQuery(ctx, op.Left)
+		if err != nil {
+			return nil, err
+		}
+		treeOuter, err := optimizeQuery(ctx, op.Right)
+		if err != nil {
+			return nil, err
+		}
+		return mergeOrJoin(ctx, treeInner, treeOuter, []sqlparser.Expr{op.Predicate}, false)
 	case *abstract.Join:
 		treeInner, err := optimizeQuery(ctx, op.LHS)
 		if err != nil {
@@ -65,7 +75,7 @@ func optimizeQuery(ctx *planningContext, opTree abstract.Operator) (queryTree, e
 		if err != nil {
 			return nil, err
 		}
-		return mergeOrJoin(ctx, treeInner, treeOuter, sqlparser.SplitAndExpression(nil, op.Predicate), !op.LeftJoin)
+		return mergeOrJoin(ctx, treeInner, treeOuter, sqlparser.SplitAndExpression(nil, op.Exp), true)
 	case *abstract.Derived:
 		treeInner, err := optimizeQuery(ctx, op.Inner)
 		if err != nil {
@@ -186,7 +196,7 @@ func tryMergeSubQuery(ctx *planningContext, outer, subq queryTree, subQueryInner
 		}
 		return merged, err
 	case *joinTree:
-		if outerTree.leftJoin {
+		if outerTree.outer {
 			return nil, nil
 		}
 		newMergefunc := func(a, b *routeTree) (*routeTree, error) {
@@ -491,10 +501,10 @@ func pushJoinPredicateOnJoin(ctx *planningContext, exprs []sqlparser.Expr, node
 		return nil, err
 	}
 	return &joinTree{
-		lhs:      lhsPlan,
-		rhs:      rhsPlan,
-		leftJoin: node.leftJoin,
-		vars:     node.vars,
+		lhs:   lhsPlan,
+		rhs:   rhsPlan,
+		outer: node.outer,
+		vars:  node.vars,
 	}, nil
 }
 
@@ -548,7 +558,7 @@ func mergeOrJoin(ctx *planningContext, lhs, rhs queryTree, joinPredicates []sqlp
 		return newPlan, nil
 	}
 
-	tree := &joinTree{lhs: lhs.clone(), rhs: rhs.clone(), leftJoin: !inner, vars: map[string]int{}}
+	tree := &joinTree{lhs: lhs.clone(), rhs: rhs.clone(), outer: !inner, vars: map[string]int{}}
 	return pushJoinPredicate(ctx, joinPredicates, tree)
 }
 
diff --git a/go/vt/vtgate/schema/uptate_controller.go b/go/vt/vtgate/schema/uptate_controller.go
index 18472a2016..36bd7d5332 100644
--- a/go/vt/vtgate/schema/uptate_controller.go
+++ b/go/vt/vtgate/schema/uptate_controller.go
@@ -99,6 +99,9 @@ func (u *updateController) add(th *discovery.TabletHealth) {
 		return
 	}
 
+	u.mu.Lock()
+	defer u.mu.Unlock()
+
 	// Received a health check from primary tablet that is not reachable from VTGate.
 	// The connection will get reset and the tracker needs to reload the schema for the keyspace.
 	if !th.Serving {
@@ -106,9 +109,6 @@ func (u *updateController) add(th *discovery.TabletHealth) {
 		return
 	}
 
-	u.mu.Lock()
-	defer u.mu.Unlock()
-
 	// If the keyspace schema is loaded and there is no schema change detected. Then there is nothing to process.
 	if len(th.Stats.TableSchemaChanged) == 0 && u.loaded {
 		return
diff --git a/go/vt/vtgate/semantics/table_collector.go b/go/vt/vtgate/semantics/table_collector.go
index 06e879dae5..b52966edc6 100644
--- a/go/vt/vtgate/semantics/table_collector.go
+++ b/go/vt/vtgate/semantics/table_collector.go
@@ -82,7 +82,7 @@ func (tc *tableCollector) up(cursor *sqlparser.Cursor) error {
 			return scope.addTable(tableInfo)
 
 		default:
-			return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "[BUG] %T in a derived table", sel)
+			return Gen4NotSupportedF("%T in a derived table", sel)
 		}
 
 	case sqlparser.TableName:


Test patch:
diff --git a/go/test/endtoend/vtgate/misc_test.go b/go/test/endtoend/vtgate/misc_test.go
index 386a0b1005..66db6549c9 100644
--- a/go/test/endtoend/vtgate/misc_test.go
+++ b/go/test/endtoend/vtgate/misc_test.go
@@ -753,24 +753,6 @@ func TestSimpleOrderBy(t *testing.T) {
 	assertMatches(t, conn, `SELECT id2 FROM t1 ORDER BY id2 ASC`, `[[INT64(5)] [INT64(6)] [INT64(7)] [INT64(8)] [INT64(9)] [INT64(10)]]`)
 }
 
-func TestSelectEqualUniqueOuterJoinRightPredicate(t *testing.T) {
-	defer cluster.PanicHandler(t)
-	ctx := context.Background()
-	conn, err := mysql.Connect(ctx, &vtParams)
-	require.NoError(t, err)
-	defer conn.Close()
-
-	exec(t, conn, `delete from t1`)
-	exec(t, conn, `delete from t2`)
-	defer func() {
-		exec(t, conn, `delete from t1`)
-		exec(t, conn, `delete from t2`)
-	}()
-	exec(t, conn, "insert into t1(id1, id2) values (0,10),(1,9),(2,8),(3,7),(4,6),(5,5)")
-	exec(t, conn, "insert into t2(id3, id4) values (0,20),(1,19),(2,18),(3,17),(4,16),(5,15)")
-	assertMatches(t, conn, `SELECT id3 FROM t1 LEFT JOIN t2 ON t1.id1 = t2.id3 WHERE t2.id3 = 10`, `[]`)
-}
-
 func assertMatches(t *testing.T, conn *mysql.Conn, query, expected string) {
 	t.Helper()
 	qr := exec(t, conn, query)
diff --git a/go/test/endtoend/vtgate/system_schema_test.go b/go/test/endtoend/vtgate/system_schema_test.go
index 142a20bdd1..a84d39e067 100644
--- a/go/test/endtoend/vtgate/system_schema_test.go
+++ b/go/test/endtoend/vtgate/system_schema_test.go
@@ -89,6 +89,7 @@ func TestInformationSchemaWithSubquery(t *testing.T) {
 }
 
 func TestInformationSchemaQueryGetsRoutedToTheRightTableAndKeyspace(t *testing.T) {
+	t.Skip("flaky. skipping for now")
 	defer cluster.PanicHandler(t)
 	ctx := context.Background()
 	conn, err := mysql.Connect(ctx, &vtParams)
diff --git a/go/vt/vtgate/engine/fake_primitive_test.go b/go/vt/vtgate/engine/fake_primitive_test.go
index 0ea9ec00c3..172c6af786 100644
--- a/go/vt/vtgate/engine/fake_primitive_test.go
+++ b/go/vt/vtgate/engine/fake_primitive_test.go
@@ -139,6 +139,6 @@ func wrapStreamExecute(prim Primitive, vcursor VCursor, bindVars map[string]*que
 	return result, err
 }
 
-func (f *fakePrimitive) Description() PrimitiveDescription {
+func (f *fakePrimitive) description() PrimitiveDescription {
 	return PrimitiveDescription{OperatorType: "fake"}
 }
diff --git a/go/vt/vtgate/planbuilder/abstract/operator_test.go b/go/vt/vtgate/planbuilder/abstract/operator_test.go
index 0bf45509a7..6b87361f97 100644
--- a/go/vt/vtgate/planbuilder/abstract/operator_test.go
+++ b/go/vt/vtgate/planbuilder/abstract/operator_test.go
@@ -119,10 +119,11 @@ func testString(op Operator) string {
 	case *Join:
 		leftStr := indent(testString(op.LHS))
 		rightStr := indent(testString(op.RHS))
-		if op.LeftJoin {
-			return fmt.Sprintf("OuterJoin: {\n\tInner: %s\n\tOuter: %s\n\tPredicate: %s\n}", leftStr, rightStr, sqlparser.String(op.Predicate))
-		}
-		return fmt.Sprintf("Join: {\n\tLHS: %s\n\tRHS: %s\n\tPredicate: %s\n}", leftStr, rightStr, sqlparser.String(op.Predicate))
+		return fmt.Sprintf("Join: {\n\tLHS: %s\n\tRHS: %s\n\tPredicate: %s\n}", leftStr, rightStr, sqlparser.String(op.Exp))
+	case *LeftJoin:
+		leftStr := indent(testString(op.Left))
+		rightStr := indent(testString(op.Right))
+		return fmt.Sprintf("OuterJoin: {\n\tInner: %s\n\tOuter: %s\n\tPredicate: %s\n}", leftStr, rightStr, sqlparser.String(op.Predicate))
 	case *Derived:
 		inner := indent(testString(op.Inner))
 		query := sqlparser.String(op.Sel)
diff --git a/go/vt/vtgate/planbuilder/testdata/aggr_cases.txt b/go/vt/vtgate/planbuilder/testdata/aggr_cases.txt
index 170983ed43..4a69c0b071 100644
--- a/go/vt/vtgate/planbuilder/testdata/aggr_cases.txt
+++ b/go/vt/vtgate/planbuilder/testdata/aggr_cases.txt
@@ -1699,7 +1699,6 @@ Gen4 plan same as above
 # scatter aggregate with complex select list (can't build order by)
 "select distinct a+1 from user"
 "generating order by clause: cannot reference a complex expression"
-Gen4 error: unsupported: in scatter query: complex order by expression: a + 1
 
 # scatter aggregate with numbered order by columns
 "select a, b, c, d, count(*) from user group by 1, 2, 3 order by 1, 2, 3"
diff --git a/go/vt/vtgate/planbuilder/testdata/ddl_cases_no_default_keyspace.txt b/go/vt/vtgate/planbuilder/testdata/ddl_cases_no_default_keyspace.txt
index 335a3b62fb..c87d48386a 100644
--- a/go/vt/vtgate/planbuilder/testdata/ddl_cases_no_default_keyspace.txt
+++ b/go/vt/vtgate/planbuilder/testdata/ddl_cases_no_default_keyspace.txt
@@ -509,18 +509,6 @@ Gen4 plan same as above
     "Query": "create view view_a as select * from music where user_id = 1"
   }
 }
-{
-  "QueryType": "DDL",
-  "Original": "create view user.view_a as select sql_calc_found_rows * from music where user_id = 1",
-  "Instructions": {
-    "OperatorType": "DDL",
-    "Keyspace": {
-      "Name": "user",
-      "Sharded": true
-    },
-    "Query": "create view view_a as select * from music where user_id = 1"
-  }
-}
 
 # DDL
 "create index a on user(id)"
diff --git a/go/vt/vtgate/planbuilder/testdata/filter_cases.txt b/go/vt/vtgate/planbuilder/testdata/filter_cases.txt
index d9627baa8b..d216a9c648 100644
--- a/go/vt/vtgate/planbuilder/testdata/filter_cases.txt
+++ b/go/vt/vtgate/planbuilder/testdata/filter_cases.txt
@@ -670,25 +670,6 @@ Gen4 plan same as above
     "Vindex": "user_index"
   }
 }
-{
-  "QueryType": "SELECT",
-  "Original": "select user_extra.id from user left join user_extra on user.id = user_extra.user_id where user_extra.user_id = 5",
-  "Instructions": {
-    "OperatorType": "Route",
-    "Variant": "SelectEqualUnique",
-    "Keyspace": {
-      "Name": "user",
-      "Sharded": true
-    },
-    "FieldQuery": "select user_extra.id from `user`, user_extra where 1 != 1",
-    "Query": "select user_extra.id from `user`, user_extra where user_extra.user_id = 5 and `user`.id = user_extra.user_id",
-    "Table": "`user`, user_extra",
-    "Values": [
-      5
-    ],
-    "Vindex": "user_index"
-  }
-}
 
 # Multi-route unique vindex constraint
 "select user_extra.id from user join user_extra on user.col = user_extra.col where user.id = 5"
@@ -3146,44 +3127,3 @@ Gen4 plan same as above
   }
 }
 Gen4 plan same as above
-
-# left join where clauses where we can optimize into an inner join
-"select user.id from user left join user_extra on user.col = user_extra.col where user_extra.foobar = 5"
-"unsupported: cross-shard left join and where clause"
-{
-  "QueryType": "SELECT",
-  "Original": "select user.id from user left join user_extra on user.col = user_extra.col where user_extra.foobar = 5",
-  "Instructions": {
-    "OperatorType": "Join",
-    "Variant": "Join",
-    "JoinColumnIndexes": "-2",
-    "JoinVars": {
-      "user_col": 0
-    },
-    "TableName": "`user`_user_extra",
-    "Inputs": [
-      {
-        "OperatorType": "Route",
-        "Variant": "SelectScatter",
-        "Keyspace": {
-          "Name": "user",
-          "Sharded": true
-        },
-        "FieldQuery": "select `user`.col, `user`.id from `user` where 1 != 1",
-        "Query": "select `user`.col, `user`.id from `user`",
-        "Table": "`user`"
-      },
-      {
-        "OperatorType": "Route",
-        "Variant": "SelectScatter",
-        "Keyspace": {
-          "Name": "user",
-          "Sharded": true
-        },
-        "FieldQuery": "select 1 from user_extra where 1 != 1",
-        "Query": "select 1 from user_extra where user_extra.foobar = 5 and user_extra.col = :user_col",
-        "Table": "user_extra"
-      }
-    ]
-  }
-}
diff --git a/go/vt/vtgate/planbuilder/testdata/memory_sort_cases.txt b/go/vt/vtgate/planbuilder/testdata/memory_sort_cases.txt
index 769e387d3c..56d871a47a 100644
--- a/go/vt/vtgate/planbuilder/testdata/memory_sort_cases.txt
+++ b/go/vt/vtgate/planbuilder/testdata/memory_sort_cases.txt
@@ -675,23 +675,6 @@ Gen4 plan same as above
     "Table": "`user`"
   }
 }
-{
-  "QueryType": "SELECT",
-  "Original": "select a from user order by binary a desc",
-  "Instructions": {
-    "OperatorType": "Route",
-    "Variant": "SelectScatter",
-    "Keyspace": {
-      "Name": "user",
-      "Sharded": true
-    },
-    "FieldQuery": "select a, binary a, weight_string(binary a) from `user` where 1 != 1",
-    "OrderBy": "(1|2) DESC",
-    "Query": "select a, binary a, weight_string(binary a) from `user` order by binary a desc",
-    "ResultColumns": 1,
-    "Table": "`user`"
-  }
-}
 
 # unary expression in join query
 "select u.a from user u join music m on u.a = m.a order by binary a desc"
diff --git a/go/vt/vtgate/planbuilder/testdata/postprocess_cases.txt b/go/vt/vtgate/planbuilder/testdata/postprocess_cases.txt
index b72fcce9c6..aef29a91d9 100644
--- a/go/vt/vtgate/planbuilder/testdata/postprocess_cases.txt
+++ b/go/vt/vtgate/planbuilder/testdata/postprocess_cases.txt
@@ -341,23 +341,83 @@ Gen4 plan same as above
 
 # ORDER BY on select t.*
 "select t.*, t.col from user t order by t.col"
-"unsupported: in scatter query, can't order by a column that comes after `*` expressions in the SELECT list"
-Gen4 error: unsupported: '*' expression in cross-shard query
+{
+  "QueryType": "SELECT",
+  "Original": "select t.*, t.col from user t order by t.col",
+  "Instructions": {
+    "OperatorType": "Route",
+    "Variant": "SelectScatter",
+    "Keyspace": {
+      "Name": "user",
+      "Sharded": true
+    },
+    "FieldQuery": "select t.*, t.col, weight_string(t.col) from `user` as t where 1 != 1",
+    "OrderBy": "(9|2) ASC",
+    "Query": "select t.*, t.col, weight_string(t.col) from `user` as t order by t.col asc",
+    "ResultColumns": 2,
+    "Table": "`user`"
+  }
+}
 
 # ORDER BY on select *
 "select *, col from user order by col"
-"unsupported: in scatter query, can't order by a column that comes after `*` expressions in the SELECT list"
-Gen4 error: unsupported: '*' expression in cross-shard query
+{
+  "QueryType": "SELECT",
+  "Original": "select *, col from user order by col",
+  "Instructions": {
+    "OperatorType": "Route",
+    "Variant": "SelectScatter",
+    "Keyspace": {
+      "Name": "user",
+      "Sharded": true
+    },
+    "FieldQuery": "select *, col, weight_string(col) from `user` where 1 != 1",
+    "OrderBy": "(9|2) ASC",
+    "Query": "select *, col, weight_string(col) from `user` order by col asc",
+    "ResultColumns": 2,
+    "Table": "`user`"
+  }
+}
 
 # ORDER BY on select multi t.*
 "select t.*, t.name, t.*, t.col from user t order by t.col"
-"unsupported: in scatter query, can't order by a column that comes after `*` expressions in the SELECT list"
-Gen4 error: unsupported: '*' expression in cross-shard query
+{
+  "QueryType": "SELECT",
+  "Original": "select t.*, t.name, t.*, t.col from user t order by t.col",
+  "Instructions": {
+    "OperatorType": "Route",
+    "Variant": "SelectScatter",
+    "Keyspace": {
+      "Name": "user",
+      "Sharded": true
+    },
+    "FieldQuery": "select t.*, t.`name`, t.*, t.col, weight_string(t.col) from `user` as t where 1 != 1",
+    "OrderBy": "(19|4) ASC",
+    "Query": "select t.*, t.`name`, t.*, t.col, weight_string(t.col) from `user` as t order by t.col asc",
+    "ResultColumns": 4,
+    "Table": "`user`"
+  }
+}
 
 # ORDER BY on select multi *
 "select *, name, *, col from user order by col"
-"unsupported: in scatter query, can't order by a column that comes after `*` expressions in the SELECT list"
-Gen4 error: unsupported: '*' expression in cross-shard query
+{
+  "QueryType": "SELECT",
+  "Original": "select *, name, *, col from user order by col",
+  "Instructions": {
+    "OperatorType": "Route",
+    "Variant": "SelectScatter",
+    "Keyspace": {
+      "Name": "user",
+      "Sharded": true
+    },
+    "FieldQuery": "select *, `name`, *, col, weight_string(col) from `user` where 1 != 1",
+    "OrderBy": "(19|4) ASC",
+    "Query": "select *, `name`, *, col, weight_string(col) from `user` order by col asc",
+    "ResultColumns": 4,
+    "Table": "`user`"
+  }
+}
 
 # ORDER BY works for select * from authoritative table
 "select * from authoritative order by user_id"
@@ -694,7 +754,7 @@ Gen4 plan same as above
           "Sharded": true
         },
         "FieldQuery": "select music.col3 from music where 1 != 1",
-        "Query": "select music.col3 from music where music.id = :user_id order by null",
+        "Query": "select music.col3 from music where music.id = :user_id",
         "Table": "music",
         "Values": [
           ":user_id"
@@ -977,7 +1037,6 @@ Gen4 plan same as above
     "Table": "`user`"
   }
 }
-Gen4 plan same as above
 
 # ORDER BY RAND() for join
 "select user.col1 as a, user.col2, music.col3 from user join music on user.id = music.id where user.id = 1 order by RAND()"
@@ -1026,52 +1085,6 @@ Gen4 plan same as above
     ]
   }
 }
-{
-  "QueryType": "SELECT",
-  "Original": "select user.col1 as a, user.col2, music.col3 from user join music on user.id = music.id where user.id = 1 order by RAND()",
-  "Instructions": {
-    "OperatorType": "Join",
-    "Variant": "Join",
-    "JoinColumnIndexes": "-2,-3,1",
-    "JoinVars": {
-      "user_id": 0
-    },
-    "TableName": "`user`_music",
-    "Inputs": [
-      {
-        "OperatorType": "Route",
-        "Variant": "SelectEqualUnique",
-        "Keyspace": {
-          "Name": "user",
-          "Sharded": true
-        },
-        "FieldQuery": "select `user`.id, `user`.col1 as a, `user`.col2 from `user` where 1 != 1",
-        "Query": "select `user`.id, `user`.col1 as a, `user`.col2 from `user` where `user`.id = 1 order by RAND()",
-        "Table": "`user`",
-        "Values": [
-          1
-        ],
-        "Vindex": "user_index"
-      },
-      {
-        "OperatorType": "Route",
-        "Variant": "SelectEqualUnique",
-        "Keyspace": {
-          "Name": "user",
-          "Sharded": true
-        },
-        "FieldQuery": "select music.col3 from music where 1 != 1",
-        "Query": "select music.col3 from music where music.id = :user_id order by RAND()",
-        "Table": "music",
-        "Values": [
-          ":user_id"
-        ],
-        "Vindex": "music_user_map"
-      }
-    ]
-  }
-}
-
 
 # ORDER BY RAND() after pull-out subquery
 "select col from user where col in (select col2 from user) order by rand()"
@@ -1107,38 +1120,6 @@ Gen4 plan same as above
     ]
   }
 }
-{
-  "QueryType": "SELECT",
-  "Original": "select col from user where col in (select col2 from user) order by rand()",
-  "Instructions": {
-    "OperatorType": "Subquery",
-    "Variant": "PulloutIn",
-    "Inputs": [
-      {
-        "OperatorType": "Route",
-        "Variant": "SelectScatter",
-        "Keyspace": {
-          "Name": "user",
-          "Sharded": true
-        },
-        "FieldQuery": "select col2 from `user` where 1 != 1",
-        "Query": "select col2 from `user`",
-        "Table": "`user`"
-      },
-      {
-        "OperatorType": "Route",
-        "Variant": "SelectScatter",
-        "Keyspace": {
-          "Name": "user",
-          "Sharded": true
-        },
-        "FieldQuery": "select col from `user` where 1 != 1",
-        "Query": "select col from `user` where col in ::__sq1 order by rand()",
-        "Table": "`user`"
-      }
-    ]
-  }
-}
 
 # Order by, '*' expression
 "select * from user where id = 5 order by col"
diff --git a/go/vt/vtgate/planbuilder/testdata/select_cases.txt b/go/vt/vtgate/planbuilder/testdata/select_cases.txt
index 4e16023506..c6b8184701 100644
--- a/go/vt/vtgate/planbuilder/testdata/select_cases.txt
+++ b/go/vt/vtgate/planbuilder/testdata/select_cases.txt
@@ -1485,7 +1485,6 @@ Gen4 plan same as above
     "Table": "unsharded"
   }
 }
-Gen4 error: nesting of unions at the right-hand side is not yet supported
 
 # unsharded nested union with limit
 "(select id from unsharded order by id asc limit 1) union (select id from unsharded order by id desc limit 1) order by id asc limit 1"
diff --git a/go/vt/vtgate/planbuilder/testdata/unsupported_cases.txt b/go/vt/vtgate/planbuilder/testdata/unsupported_cases.txt
index 9fa7325fe8..7e9860b64d 100644
--- a/go/vt/vtgate/planbuilder/testdata/unsupported_cases.txt
+++ b/go/vt/vtgate/planbuilder/testdata/unsupported_cases.txt
@@ -66,10 +66,9 @@ Gen4 plan same as above
 "unsupported: cross-shard left join and column expressions"
 Gen4 plan same as above
 
-# left join where clauses #2
-"select user.id from user left join user_extra on user.col = user_extra.col where coalesce(user_extra.col, 4) = 5"
+# left join where clauses
+"select user.id from user left join user_extra on user.col = user_extra.col where user_extra.col = 5"
 "unsupported: cross-shard left join and where clause"
-Gen4 plan same as above
 
 # * expresson not allowed for cross-shard joins
 "select * from user join user_extra"
@@ -134,7 +133,6 @@ Gen4 error: Expression of SELECT list is not in GROUP BY clause and contains non
 # subqueries not supported in group by
 "select id from user group by id, (select id from user_extra)"
 "unsupported: subqueries disallowed in GROUP or ORDER BY"
-Gen4 error: unsupported: subqueries disallowed in GROUP BY
 
 # Order by uses cross-shard expression
 "select id from user order by id+1"