@@ -827,10 +827,10 @@ func (b *PlanBuilder) buildJoin(ctx context.Context, joinNode *ast.Join) (Logica
827
827
// on the "USING" clause.
828
828
//
829
829
// According to the standard SQL, columns are ordered in the following way:
830
- // 1. coalesced common columns of "leftPlan" and "rightPlan", in the order they
831
- // appears in "leftPlan".
832
- // 2. the rest columns in "leftPlan", in the order they appears in "leftPlan".
833
- // 3. the rest columns in "rightPlan", in the order they appears in "rightPlan".
830
+ // 1. coalesced common columns of "leftPlan" and "rightPlan", in the order they
831
+ // appears in "leftPlan".
832
+ // 2. the rest columns in "leftPlan", in the order they appears in "leftPlan".
833
+ // 3. the rest columns in "rightPlan", in the order they appears in "rightPlan".
834
834
func (b * PlanBuilder ) buildUsingClause (p * LogicalJoin , leftPlan , rightPlan LogicalPlan , join * ast.Join ) error {
835
835
filter := make (map [string ]bool , len (join .Using ))
836
836
for _ , col := range join .Using {
@@ -851,9 +851,10 @@ func (b *PlanBuilder) buildUsingClause(p *LogicalJoin, leftPlan, rightPlan Logic
851
851
// buildNaturalJoin builds natural join output schema. It finds out all the common columns
852
852
// then using the same mechanism as buildUsingClause to eliminate redundant columns and build join conditions.
853
853
// According to standard SQL, producing this display order:
854
- // All the common columns
855
- // Every column in the first (left) table that is not a common column
856
- // Every column in the second (right) table that is not a common column
854
+ //
855
+ // All the common columns
856
+ // Every column in the first (left) table that is not a common column
857
+ // Every column in the second (right) table that is not a common column
857
858
func (b * PlanBuilder ) buildNaturalJoin (p * LogicalJoin , leftPlan , rightPlan LogicalPlan , join * ast.Join ) error {
858
859
err := b .coalesceCommonColumns (p , leftPlan , rightPlan , join .Tp , nil )
859
860
if err != nil {
@@ -1799,7 +1800,9 @@ func (b *PlanBuilder) buildUnion(ctx context.Context, selects []LogicalPlan, aft
1799
1800
// divideUnionSelectPlans resolves union's select stmts to logical plans.
1800
1801
// and divide result plans into "union-distinct" and "union-all" parts.
1801
1802
// divide rule ref:
1802
- // https://dev.mysql.com/doc/refman/5.7/en/union.html
1803
+ //
1804
+ // https://dev.mysql.com/doc/refman/5.7/en/union.html
1805
+ //
1803
1806
// "Mixed UNION types are treated such that a DISTINCT union overrides any ALL union to its left."
1804
1807
func (b * PlanBuilder ) divideUnionSelectPlans (_ context.Context , selects []LogicalPlan , setOprTypes []* ast.SetOprType ) (distinctSelects []LogicalPlan , allSelects []LogicalPlan , err error ) {
1805
1808
firstUnionAllIdx := 0
@@ -6490,6 +6493,12 @@ func (u *updatableTableListResolver) Leave(inNode ast.Node) (ast.Node, bool) {
6490
6493
return inNode , true
6491
6494
}
6492
6495
6496
+ // ExtractTableList extracts all the TableNames from node.
6497
+ // Tag: no-upstream.
6498
+ func ExtractTableList (node ast.Node , input []* ast.TableName , asName bool ) []* ast.TableName {
6499
+ return extractTableList (node , input , asName )
6500
+ }
6501
+
6493
6502
// extractTableList extracts all the TableNames from node.
6494
6503
// If asName is true, extract AsName prior to OrigName.
6495
6504
// Privilege check should use OrigName, while expression may use AsName.
0 commit comments