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: plan more opcodes #8254

Merged
merged 8 commits into from
Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from 7 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
4 changes: 2 additions & 2 deletions go/vt/sqlparser/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -1794,8 +1794,8 @@ type (

// IsExpr represents an IS ... or an IS NOT ... expression.
IsExpr struct {
Operator IsExprOperator
Expr Expr
Left Expr
Right IsExprOperator
}

// IsExprOperator is an enum for IsExpr.Operator
Expand Down
2 changes: 1 addition & 1 deletion go/vt/sqlparser/ast_clone.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions go/vt/sqlparser/ast_equals.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/vt/sqlparser/ast_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ func (node *RangeCond) Format(buf *TrackedBuffer) {

// Format formats the node.
func (node *IsExpr) Format(buf *TrackedBuffer) {
buf.astPrintf(node, "%v %s", node.Expr, node.Operator.ToString())
buf.astPrintf(node, "%v %s", node.Left, node.Right.ToString())
}

// Format formats the node.
Expand Down
4 changes: 2 additions & 2 deletions go/vt/sqlparser/ast_format_fast.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions go/vt/sqlparser/ast_rewrite.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/vt/sqlparser/ast_visit.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions go/vt/sqlparser/cached_size.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/vt/sqlparser/precedence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func readable(node Expr) string {
case *BinaryExpr:
return fmt.Sprintf("(%s %s %s)", readable(node.Left), node.Operator.ToString(), readable(node.Right))
case *IsExpr:
return fmt.Sprintf("(%s %s)", readable(node.Expr), node.Operator.ToString())
return fmt.Sprintf("(%s %s)", readable(node.Left), node.Right.ToString())
default:
return String(node)
}
Expand Down
4 changes: 2 additions & 2 deletions go/vt/sqlparser/random_expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func (g *generator) isExpr() Expr {
ops := []IsExprOperator{IsNullOp, IsNotNullOp, IsTrueOp, IsNotTrueOp, IsFalseOp, IsNotFalseOp}

return &IsExpr{
Operator: ops[g.r.Intn(len(ops))],
Expr: g.booleanExpr(),
Right: ops[g.r.Intn(len(ops))],
Left: g.booleanExpr(),
}
}
2 changes: 1 addition & 1 deletion go/vt/sqlparser/sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/vt/sqlparser/sql.y
Original file line number Diff line number Diff line change
Expand Up @@ -3513,7 +3513,7 @@ expression:
}
| expression IS is_suffix
{
$$ = &IsExpr{Operator: $3, Expr: $1}
$$ = &IsExpr{Left: $1, Right: $3}
}
| value_expression
{
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vtgate/planbuilder/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,11 +668,11 @@ func (rb *route) computeEqualPlan(pb *primitiveBuilder, comparison *sqlparser.Co
// computeIS computes the plan for an equality constraint.
func (rb *route) computeISPlan(pb *primitiveBuilder, comparison *sqlparser.IsExpr) (opcode engine.RouteOpcode, vindex vindexes.SingleColumn, expr sqlparser.Expr) {
// we only handle IS NULL correct. IsExpr can contain other expressions as well
if comparison.Operator != sqlparser.IsNullOp {
if comparison.Right != sqlparser.IsNullOp {
return engine.SelectScatter, nil, nil
}

vindex = pb.st.Vindex(comparison.Expr, rb)
vindex = pb.st.Vindex(comparison.Left, rb)
// fallback to scatter gather if there is no vindex
if vindex == nil {
return engine.SelectScatter, nil, nil
Expand Down
Loading