Skip to content
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
257 changes: 0 additions & 257 deletions sql/analyzer/aggregations.go

This file was deleted.

19 changes: 0 additions & 19 deletions sql/analyzer/aliases.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,25 +294,6 @@ func aliasedExpressionsInNode(n sql.Node) map[string]string {
return aliasesFromExpressionToName
}

// aliasesDefinedInNode returns the expression aliases that are defined in the first Projector node found, starting
// the search from the specified node. All returned alias names are normalized to lower case.
func aliasesDefinedInNode(n sql.Node) []string {
projector := findFirstProjectorNode(n)
if projector == nil {
return nil
}

var aliases []string
for _, e := range projector.ProjectedExprs() {
alias, ok := e.(*expression.Alias)
if ok {
aliases = append(aliases, strings.ToLower(alias.Name()))
}
}

return aliases
}

// normalizeExpressions returns the expressions given after normalizing them to replace table and expression aliases
// with their underlying names. This is necessary to match such expressions against those declared by implementors of
// various interfaces that declare expressions to handle, such as Index.Expressions(), FilteredTable, etc.
Expand Down
2 changes: 1 addition & 1 deletion sql/analyzer/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ func (a *Analyzer) analyzeWithSelector(ctx *sql.Context, n sql.Node, scope *plan
a.LogNode(n)

batches := a.Batches
if b, ok := getBatchesForNode(n, batches); ok {
if b, ok := getBatchesForNode(n); ok {
batches = b
}

Expand Down
14 changes: 0 additions & 14 deletions sql/analyzer/autocommit.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,3 @@ func addAutocommit(ctx *sql.Context, a *Analyzer, n sql.Node, scope *plan.Scope,
}
return plan.NewTransactionCommittingNode(n), transform.NewTree, nil
}

func hasShowWarningsNode(n sql.Node) bool {
var ret bool
transform.Inspect(n, func(n sql.Node) bool {
if _, ok := n.(plan.ShowWarnings); ok {
ret = true
return false
}

return true
})

return ret
}
21 changes: 0 additions & 21 deletions sql/analyzer/indexed_joins.go
Original file line number Diff line number Diff line change
Expand Up @@ -1387,24 +1387,3 @@ func isWeaklyMonotonic(e sql.Expression) bool {
}
})
}

// attrsRefSingleTableCol returns false if there are
// getFields sourced from zero or more than one table.
func attrsRefSingleTableCol(e sql.Expression) (tableCol, bool) {
var tc tableCol
var invalid bool
transform.InspectExpr(e, func(e sql.Expression) bool {
switch e := e.(type) {
case *expression.GetField:
newTc := newTableCol(e.Table(), e.Name())
if tc.table == "" && !invalid {
tc = newTc
} else if tc != newTc {
invalid = true
}
default:
}
return invalid
})
return tc, !invalid && tc.table != ""
}
24 changes: 0 additions & 24 deletions sql/analyzer/inserts.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,27 +331,3 @@ func isAutoUuidColumn(col *sql.Column) bool {

return false
}

// validGeneratedColumnValue returns true if the column is a generated column and the source node is not a values node.
// Explicit default values (`DEFAULT`) are the only valid values to specify for a generated column
func validGeneratedColumnValue(idx int, source sql.Node) bool {
switch source := source.(type) {
case *plan.Values:
for _, tuple := range source.ExpressionTuples {
switch val := tuple[idx].(type) {
case *sql.ColumnDefaultValue: // should be wrapped, but just in case
return true
case *expression.Wrapper:
if _, ok := val.Unwrap().(*sql.ColumnDefaultValue); ok {
return true
}
return false
default:
return false
}
}
return false
default:
return false
}
}
4 changes: 2 additions & 2 deletions sql/analyzer/node_batches.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

// getBatchesForNode returns a partial analyzer ruleset for simple node
// types that require little prior validation before execution.
func getBatchesForNode(n sql.Node, orig []*Batch) ([]*Batch, bool) {
switch n := n.(type) {
func getBatchesForNode(node sql.Node) ([]*Batch, bool) {
switch n := node.(type) {
case *plan.Commit:
return nil, true
case *plan.StartTransaction:
Expand Down
Loading