Skip to content

Commit

Permalink
*: Address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
shenli committed Jan 23, 2016
1 parent 6ed674f commit 7aa2791
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions ast/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,9 @@ func (n *AggregateFuncExpr) updateGroupConcat() error {
return nil
}
}
if ctx.Buffer.Len() > 0 {
if ctx.Buffer == nil {
ctx.Buffer = &bytes.Buffer{}
} else {
// now use comma separator
ctx.Buffer.WriteString(",")
}
Expand Down Expand Up @@ -621,6 +623,6 @@ type AggEvaluateContext struct {
distinctChecker *distinct.Checker
Count int64
Value interface{}
Buffer bytes.Buffer // Buffer is used for group_concat.
Buffer *bytes.Buffer // Buffer is used for group_concat.
evaluated bool
}
2 changes: 1 addition & 1 deletion optimizer/evaluator/evaluator.go
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ func (e *Evaluator) evalAggAvg(v *ast.AggregateFuncExpr) {

func (e *Evaluator) evalAggGroupConcat(v *ast.AggregateFuncExpr) {
ctx := v.GetContext()
if ctx.Buffer.Len() > 0 {
if ctx.Buffer != nil {
v.SetValue(ctx.Buffer.String())
} else {
v.SetValue(nil)
Expand Down

0 comments on commit 7aa2791

Please sign in to comment.