Skip to content

Commit

Permalink
addressed review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
  • Loading branch information
harshit-gangal committed Jan 15, 2025
1 parent 9d74fa9 commit 7bd4c1b
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions go/vt/sqlparser/ast_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2369,11 +2369,11 @@ func GetFirstSelect(selStmt TableStatement) (*Select, error) {
case *Select:
return node, nil
case *ValuesStatement:
return nil, fmt.Errorf("first table_reference is a VALUES")
return nil, vterrors.VT12001("first table_reference as VALUES")
case *Union:
return GetFirstSelect(node.Left)
}
panic("[BUG]: unknown type for SelectStatement")
return nil, vterrors.VT13001(fmt.Sprintf("unknown type for SelectStatement: %T", selStmt))
}

// GetAllSelects gets all the select statement s
Expand Down
2 changes: 1 addition & 1 deletion go/vt/sqlparser/ast_rewriting.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ func (er *astRewriter) existsRewrite(cursor *Cursor, node *ExistsExpr) {
sel.GroupBy = nil
}

// rewriteDistinctableAggr removed Distinctable from Max and Min Aggregations as it does not impact the result. But, makes the plan simpler.
// rewriteDistinctableAggr removed Distinct from Max and Min Aggregations as it does not impact the result. But, makes the plan simpler.
func (er *astRewriter) rewriteDistinctableAggr(cursor *Cursor, node DistinctableAggr) {
if !node.IsDistinct() {
return
Expand Down
3 changes: 1 addition & 2 deletions go/vt/sqlparser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ func yyParsePooled(yylex yyLexer) int {
*parser = zeroParser
parserPool.Put(parser)
}()
parse := parser.Parse(yylex)
return parse
return parser.Parse(yylex)
}

// Instructions for creating new types: If a type
Expand Down
5 changes: 1 addition & 4 deletions go/vt/vtgate/planbuilder/operators/expressions.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ limitations under the License.
package operators

import (
"fmt"

"vitess.io/vitess/go/vt/sqlparser"
"vitess.io/vitess/go/vt/vterrors"
"vitess.io/vitess/go/vt/vtgate/planbuilder/plancontext"
"vitess.io/vitess/go/vt/vtgate/semantics"
)
Expand Down Expand Up @@ -128,7 +125,7 @@ func simplifyPredicates(ctx *plancontext.PlanningContext, in sqlparser.Expr) sql
func getFirstSelect(selStmt sqlparser.TableStatement) *sqlparser.Select {
firstSelect, err := sqlparser.GetFirstSelect(selStmt)
if err != nil {
panic(vterrors.VT12001(fmt.Sprintf("first UNION part not a SELECT: %v", err)))
panic(err)
}
return firstSelect
}
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/operators/horizon_expanding.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func expandSelectHorizon(ctx *plancontext.PlanningContext, horizon *Horizon, sel

if qp.NeedsDistinct() {
op = newDistinct(op, qp, true)
extracted = append(extracted, "Distinctable")
extracted = append(extracted, "Distinct")
}

if sel.Having != nil {
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/operators/phases.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (p Phase) String() string {
case addAggrOrdering:
return "optimize aggregations with ORDER BY"
case cleanOutPerfDistinct:
return "optimize Distinctable operations"
return "optimize Distinct operations"
case subquerySettling:
return "settle subqueries"
case dmlWithInput:
Expand Down

0 comments on commit 7bd4c1b

Please sign in to comment.