Skip to content

Commit

Permalink
Merge pull request #8905 from vmg/vmg/tableset
Browse files Browse the repository at this point in the history
gen4: implement a growable semantics.TableSet
  • Loading branch information
vmg authored Sep 30, 2021
2 parents 8830b6d + 8da869a commit b6c3566
Show file tree
Hide file tree
Showing 19 changed files with 579 additions and 229 deletions.
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/abstract/concatenate.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var _ Operator = (*Concatenate)(nil)
func (c *Concatenate) TableID() semantics.TableSet {
var tableSet semantics.TableSet
for _, source := range c.Sources {
tableSet |= source.TableID()
tableSet.MergeInPlace(source.TableID())
}
return tableSet
}
Expand Down
10 changes: 3 additions & 7 deletions go/vt/vtgate/planbuilder/abstract/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (qt *QueryTable) testString() string {
where = " where " + strings.Join(preds, " and ")
}

return fmt.Sprintf("\t%d:%s%s%s", qt.TableID, sqlparser.String(qt.Table), alias, where)
return fmt.Sprintf("\t%v:%s%s%s", qt.TableID, sqlparser.String(qt.Table), alias, where)
}

func (qg *QueryGraph) testString() string {
Expand All @@ -208,17 +208,13 @@ func (qg *QueryGraph) crossPredicateString() string {
}
var joinPreds []string
for deps, predicates := range qg.innerJoins {
var tables []string
for _, id := range deps.Constituents() {
tables = append(tables, fmt.Sprintf("%d", id))
}
var expressions []string
for _, expr := range predicates {
expressions = append(expressions, sqlparser.String(expr))
}
tableConcat := strings.Join(tables, ":")

exprConcat := strings.Join(expressions, " and ")
joinPreds = append(joinPreds, fmt.Sprintf("\t%s - %s", tableConcat, exprConcat))
joinPreds = append(joinPreds, fmt.Sprintf("\t%v - %s", deps, exprConcat))
}
sort.Strings(joinPreds)
return fmt.Sprintf("\nJoinPredicates:\n%s", strings.Join(joinPreds, "\n"))
Expand Down
Loading

0 comments on commit b6c3566

Please sign in to comment.