Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
systay committed Jan 17, 2025
1 parent a4bcee3 commit 1a7b110
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions go/vt/vtgate/planbuilder/operators/ast_to_op.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package operators

import (
"fmt"
"vitess.io/vitess/go/vt/vtgate/semantics/bitset"

"vitess.io/vitess/go/vt/sqlparser"
"vitess.io/vitess/go/vt/vterrors"
Expand Down Expand Up @@ -121,17 +122,17 @@ func cloneASTAndSemState[T sqlparser.SQLNode](ctx *plancontext.PlanningContext,

// findTablesContained returns the TableSet of all the contained
func findTablesContained(ctx *plancontext.PlanningContext, node sqlparser.SQLNode) semantics.TableSet {
var tables []semantics.TableSet
bs := bitset.NewMutable()
_ = sqlparser.Walk(func(node sqlparser.SQLNode) (bool, error) {
t, ok := node.(*sqlparser.AliasedTableExpr)
if !ok {
return true, nil
}
ts := ctx.SemTable.TableSetFor(t)
tables = append(tables, ts)
bs.Or(bitset.Bitset(ts))
return true, nil
}, node)
return semantics.MergeTableSets(tables...)
return semantics.TableSet(bs.AsImmutable())
}

// joinPredicateCollector is used to inspect the predicates inside the subquery, looking for any
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vtgate/semantics/bitset/mutable.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ type Mutable struct {
data []byte
}

// NewMutableTableSet creates an initially empty MutableTableSet.
func NewMutableTableSet() *Mutable {
// NewMutable creates an initially empty mutable BitSet.
func NewMutable() *Mutable {
return &Mutable{}
}

Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/semantics/semantic_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ func (d ExprDependencies) dependencies(expr sqlparser.Expr) (deps TableSet) {
}()
}

depsCalc := bitset.NewMutableTableSet()
depsCalc := bitset.NewMutable()
// During the original semantic analysis, all ColNames were found and bound to the corresponding tables
// Here, we'll walk the expression tree and look to see if we can find any sub-expressions
// that have already set dependencies.
Expand Down

0 comments on commit 1a7b110

Please sign in to comment.