Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gen4: implement a growable semantics.TableSet #8905

Merged
merged 2 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 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