Skip to content

Commit

Permalink
gen4: Support explicit column aliases on derived tables (#14129)
Browse files Browse the repository at this point in the history
Co-authored-by: Manan Gupta <[email protected]>
  • Loading branch information
systay and GuptaManan100 authored Oct 2, 2023
1 parent d5efe8e commit d928738
Show file tree
Hide file tree
Showing 35 changed files with 556 additions and 3,068 deletions.
578 changes: 0 additions & 578 deletions go/vt/vtgate/planbuilder/aggregation_pushing.go

This file was deleted.

1 change: 0 additions & 1 deletion go/vt/vtgate/planbuilder/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ func gen4DeleteStmtPlanner(
if ks, tables := ctx.SemTable.SingleUnshardedKeyspace(); ks != nil {
if fkManagementNotRequired(ctx, vschema, tables) {
plan := deleteUnshardedShortcut(deleteStmt, ks, tables)
plan = pushCommentDirectivesOnPlan(plan, deleteStmt)
return newPlanResult(plan.Primitive(), operators.QualifiedTables(ks, tables)...), nil
}
}
Expand Down
85 changes: 0 additions & 85 deletions go/vt/vtgate/planbuilder/doc.go

This file was deleted.

4 changes: 2 additions & 2 deletions go/vt/vtgate/planbuilder/expression_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func booleanValues(astExpr sqlparser.Expr) evalengine.Expr {
)
switch node := astExpr.(type) {
case *sqlparser.Literal:
//set autocommit = 'on'
// set autocommit = 'on'
if node.Type == sqlparser.StrVal {
switch strings.ToLower(node.Val) {
case "on":
Expand All @@ -50,7 +50,7 @@ func booleanValues(astExpr sqlparser.Expr) evalengine.Expr {
}
}
case *sqlparser.ColName:
//set autocommit = on
// set autocommit = on
switch node.Name.Lowered() {
case "on":
return ON
Expand Down
36 changes: 0 additions & 36 deletions go/vt/vtgate/planbuilder/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ limitations under the License.
package planbuilder

import (
"vitess.io/vitess/go/vt/sqlparser"
"vitess.io/vitess/go/vt/vterrors"
"vitess.io/vitess/go/vt/vtgate/engine"
"vitess.io/vitess/go/vt/vtgate/evalengine"
"vitess.io/vitess/go/vt/vtgate/planbuilder/plancontext"
)

type (
Expand All @@ -34,38 +30,6 @@ type (

var _ logicalPlan = (*filter)(nil)

func resolveFromPlan(ctx *plancontext.PlanningContext, plan logicalPlan, canPushProjection bool) evalengine.ColumnResolver {
return func(expr *sqlparser.ColName) (int, error) {
offset, added, err := pushProjection(ctx, &sqlparser.AliasedExpr{Expr: expr}, plan, true, true, false)
if err != nil {
return 0, err
}
if added && !canPushProjection {
return 0, vterrors.VT13001("column should not be pushed to projection while doing a column lookup")
}
return offset, nil
}
}

// newFilter builds a new filter.
func newFilter(ctx *plancontext.PlanningContext, plan logicalPlan, expr sqlparser.Expr) (*filter, error) {
predicate, err := evalengine.Translate(expr, &evalengine.Config{
ResolveColumn: resolveFromPlan(ctx, plan, false),
ResolveType: ctx.SemTable.TypeForExpr,
Collation: ctx.SemTable.Collation,
})
if err != nil {
return nil, err
}
return &filter{
logicalPlanCommon: newBuilderCommon(plan),
efilter: &engine.Filter{
Predicate: predicate,
ASTPredicate: expr,
},
}, nil
}

// Primitive implements the logicalPlan interface
func (l *filter) Primitive() engine.Primitive {
l.efilter.Input = l.input.Primitive()
Expand Down
110 changes: 0 additions & 110 deletions go/vt/vtgate/planbuilder/hash_join.go

This file was deleted.

Loading

0 comments on commit d928738

Please sign in to comment.