@@ -30,23 +30,23 @@ import (
3030
3131// processTableExprs analyzes the FROM clause. It produces a builder
3232// with all the routes identified.
33- func (pb * planBuilder ) processTableExprs (tableExprs sqlparser.TableExprs ) error {
33+ func (pb * primitiveBuilder ) processTableExprs (tableExprs sqlparser.TableExprs ) error {
3434 if len (tableExprs ) == 1 {
3535 return pb .processTableExpr (tableExprs [0 ])
3636 }
3737
3838 if err := pb .processTableExpr (tableExprs [0 ]); err != nil {
3939 return err
4040 }
41- rpb := newPlanBuilder (pb .vschema , pb .jt )
41+ rpb := newPrimitiveBuilder (pb .vschema , pb .jt )
4242 if err := rpb .processTableExprs (tableExprs [1 :]); err != nil {
4343 return err
4444 }
4545 return pb .join (rpb , nil )
4646}
4747
4848// processTableExpr produces a builder subtree for the given TableExpr.
49- func (pb * planBuilder ) processTableExpr (tableExpr sqlparser.TableExpr ) error {
49+ func (pb * primitiveBuilder ) processTableExpr (tableExpr sqlparser.TableExpr ) error {
5050 switch tableExpr := tableExpr .(type ) {
5151 case * sqlparser.AliasedTableExpr :
5252 return pb .processAliasedTable (tableExpr )
@@ -73,12 +73,12 @@ func (pb *planBuilder) processTableExpr(tableExpr sqlparser.TableExpr) error {
7373// versatile than a subquery. If a subquery becomes a route, then any result
7474// columns that represent underlying vindex columns are also exposed as
7575// vindex columns.
76- func (pb * planBuilder ) processAliasedTable (tableExpr * sqlparser.AliasedTableExpr ) error {
76+ func (pb * primitiveBuilder ) processAliasedTable (tableExpr * sqlparser.AliasedTableExpr ) error {
7777 switch expr := tableExpr .Expr .(type ) {
7878 case sqlparser.TableName :
7979 return pb .buildTablePrimitive (tableExpr , expr )
8080 case * sqlparser.Subquery :
81- spb := newPlanBuilder (pb .vschema , pb .jt )
81+ spb := newPrimitiveBuilder (pb .vschema , pb .jt )
8282 switch stmt := expr .Select .(type ) {
8383 case * sqlparser.Select :
8484 if err := spb .processSelect (stmt , nil ); err != nil {
@@ -136,7 +136,7 @@ func (pb *planBuilder) processAliasedTable(tableExpr *sqlparser.AliasedTableExpr
136136}
137137
138138// buildTablePrimitive builds a primitive based on the table name.
139- func (pb * planBuilder ) buildTablePrimitive (tableExpr * sqlparser.AliasedTableExpr , tableName sqlparser.TableName ) error {
139+ func (pb * primitiveBuilder ) buildTablePrimitive (tableExpr * sqlparser.AliasedTableExpr , tableName sqlparser.TableName ) error {
140140 alias := tableName
141141 if ! tableExpr .As .IsEmpty () {
142142 alias = sqlparser.TableName {Name : tableExpr .As }
@@ -202,7 +202,7 @@ func (pb *planBuilder) buildTablePrimitive(tableExpr *sqlparser.AliasedTableExpr
202202// processJoin produces a builder subtree for the given Join.
203203// If the left and right nodes can be part of the same route,
204204// then it's a route. Otherwise, it's a join.
205- func (pb * planBuilder ) processJoin (ajoin * sqlparser.JoinTableExpr ) error {
205+ func (pb * primitiveBuilder ) processJoin (ajoin * sqlparser.JoinTableExpr ) error {
206206 switch ajoin .Join {
207207 case sqlparser .JoinStr , sqlparser .StraightJoinStr , sqlparser .LeftJoinStr :
208208 case sqlparser .RightJoinStr :
@@ -213,7 +213,7 @@ func (pb *planBuilder) processJoin(ajoin *sqlparser.JoinTableExpr) error {
213213 if err := pb .processTableExpr (ajoin .LeftExpr ); err != nil {
214214 return err
215215 }
216- rpb := newPlanBuilder (pb .vschema , pb .jt )
216+ rpb := newPrimitiveBuilder (pb .vschema , pb .jt )
217217 if err := rpb .processTableExpr (ajoin .RightExpr ); err != nil {
218218 return err
219219 }
@@ -234,7 +234,7 @@ func convertToLeftJoin(ajoin *sqlparser.JoinTableExpr) {
234234 ajoin .Join = sqlparser .LeftJoinStr
235235}
236236
237- func (pb * planBuilder ) join (rpb * planBuilder , ajoin * sqlparser.JoinTableExpr ) error {
237+ func (pb * primitiveBuilder ) join (rpb * primitiveBuilder , ajoin * sqlparser.JoinTableExpr ) error {
238238 if ajoin != nil && ajoin .Condition .Using != nil {
239239 return errors .New ("unsupported: join with USING(column_list) clause" )
240240 }
@@ -291,7 +291,7 @@ nomerge:
291291// see if the primitive can be improved. The operation can fail if
292292// the expression contains a non-pushable subquery. ajoin can be nil
293293// if the join is on a ',' operator.
294- func (pb * planBuilder ) mergeRoutes (rpb * planBuilder , ajoin * sqlparser.JoinTableExpr ) error {
294+ func (pb * primitiveBuilder ) mergeRoutes (rpb * primitiveBuilder , ajoin * sqlparser.JoinTableExpr ) error {
295295 lRoute := pb .bldr .(* route )
296296 rRoute := rpb .bldr .(* route )
297297 sel := lRoute .Select .(* sqlparser.Select )
@@ -330,7 +330,7 @@ func (pb *planBuilder) mergeRoutes(rpb *planBuilder, ajoin *sqlparser.JoinTableE
330330// isSameRoute returns true if the join constraint makes the routes
331331// mergeable by unique vindex. The constraint has to be an equality
332332// like a.id = b.id where both columns have the same unique vindex.
333- func (pb * planBuilder ) isSameRoute (rpb * planBuilder , filter sqlparser.Expr ) bool {
333+ func (pb * primitiveBuilder ) isSameRoute (rpb * primitiveBuilder , filter sqlparser.Expr ) bool {
334334 lRoute := pb .bldr .(* route )
335335 rRoute := rpb .bldr .(* route )
336336
0 commit comments