Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
zachmu committed Nov 15, 2023
1 parent 0b8924b commit 3c871c2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
19 changes: 11 additions & 8 deletions server/ast/expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,15 +464,18 @@ func nodeExpr(node tree.Expr) (vitess.Expr, error) {
case *tree.Subquery:
return nodeSubquery(node)
case *tree.Tuple:
valTuple := make(vitess.ValTuple, len(node.Exprs))
var err error
for i, expr := range node.Exprs {
valTuple[i], err = nodeExpr(expr)
if err != nil {
return nil, err
}
if len(node.Labels) > 0 {
return nil, fmt.Errorf("tuple labels are not yet supported")
}
if node.Row {
return nil, fmt.Errorf("ROW keyword for tuples not yet supported")
}

valTuple, err := nodeExprs(node.Exprs)
if err != nil {
return nil, err
}
return valTuple, nil
return vitess.ValTuple(valTuple), nil
case *tree.TupleStar:
return nil, fmt.Errorf("(E).* is not yet supported")
case *tree.UnaryExpr:
Expand Down
6 changes: 1 addition & 5 deletions server/ast/select_clause.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ func nodeSelectClause(node *tree.SelectClause) (*vitess.Select, error) {
if err != nil {
return nil, err
}
var distinct bool
if node.Distinct {
distinct = true
}
if len(node.DistinctOn) > 0 {
return nil, fmt.Errorf("DISTINCT ON is not yet supported")
}
Expand All @@ -59,7 +55,7 @@ func nodeSelectClause(node *tree.SelectClause) (*vitess.Select, error) {
return nil, err
}
return &vitess.Select{
QueryOpts: vitess.QueryOpts{Distinct: distinct},
QueryOpts: vitess.QueryOpts{Distinct: node.Distinct},
SelectExprs: selectExprs,
From: from,
Where: where,
Expand Down
2 changes: 1 addition & 1 deletion server/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func (l *Listener) execute(conn net.Conn, mysqlConn *mysql.Conn, query Converted
Query: query.String,
Rows: 0,
}

if err := l.comQuery(mysqlConn, query, func(res *sqltypes.Result, more bool) error {
if err := connection.Send(conn, messages.RowDescription{
Fields: res.Fields,
Expand Down

0 comments on commit 3c871c2

Please sign in to comment.