Skip to content

Commit d8190ef

Browse files
committed
[ga-format-pr] Run ./format_repo.sh to fix formatting
1 parent 6988ee2 commit d8190ef

File tree

4 files changed

+109
-109
lines changed

4 files changed

+109
-109
lines changed

engine.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -446,21 +446,21 @@ func (e *Engine) QueryWithBindings(ctx *sql.Context, query string, parsed sqlpar
446446
return nil, nil, nil, err
447447
}
448448

449-
ctx.GetLogger().WithField("planNodeType", fmt.Sprintf("%T", analyzed)).Debug("building exec iterator")
450-
iter, err := e.Analyzer.ExecBuilder.Build(ctx, analyzed, nil)
449+
ctx.GetLogger().WithField("planNodeType", fmt.Sprintf("%T", analyzed)).Debug("building exec iterator")
450+
iter, err := e.Analyzer.ExecBuilder.Build(ctx, analyzed, nil)
451451
if err != nil {
452-
ctx.GetLogger().WithError(err).Debug("exec builder returned error")
452+
ctx.GetLogger().WithError(err).Debug("exec builder returned error")
453453
err2 := clearAutocommitTransaction(ctx)
454454
if err2 != nil {
455455
return nil, nil, nil, errors.Wrap(err, "unable to clear autocommit transaction: "+err2.Error())
456456
}
457457
return nil, nil, nil, err
458458
}
459-
if iter == nil {
460-
ctx.GetLogger().Debug("exec builder returned nil iterator")
461-
} else {
462-
ctx.GetLogger().WithField("iterType", fmt.Sprintf("%T", iter)).Debug("built exec iterator")
463-
}
459+
if iter == nil {
460+
ctx.GetLogger().Debug("exec builder returned nil iterator")
461+
} else {
462+
ctx.GetLogger().WithField("iterType", fmt.Sprintf("%T", iter)).Debug("built exec iterator")
463+
}
464464

465465
var schema sql.Schema
466466
iter, schema, err = rowexec.FinalizeIters(ctx, analyzed, qFlags, iter)
@@ -499,21 +499,21 @@ func (e *Engine) PrepQueryPlanForExecution(ctx *sql.Context, _ string, plan sql.
499499
return nil, nil, nil, err
500500
}
501501

502-
ctx.GetLogger().WithField("planNodeType", fmt.Sprintf("%T", plan)).Debug("building exec iterator")
503-
iter, err := e.Analyzer.ExecBuilder.Build(ctx, plan, nil)
502+
ctx.GetLogger().WithField("planNodeType", fmt.Sprintf("%T", plan)).Debug("building exec iterator")
503+
iter, err := e.Analyzer.ExecBuilder.Build(ctx, plan, nil)
504504
if err != nil {
505-
ctx.GetLogger().WithError(err).Debug("exec builder returned error")
505+
ctx.GetLogger().WithError(err).Debug("exec builder returned error")
506506
err2 := clearAutocommitTransaction(ctx)
507507
if err2 != nil {
508508
return nil, nil, nil, errors.Wrap(err, "unable to clear autocommit transaction: "+err2.Error())
509509
}
510510
return nil, nil, nil, err
511511
}
512-
if iter == nil {
513-
ctx.GetLogger().Debug("exec builder returned nil iterator")
514-
} else {
515-
ctx.GetLogger().WithField("iterType", fmt.Sprintf("%T", iter)).Debug("built exec iterator")
516-
}
512+
if iter == nil {
513+
ctx.GetLogger().Debug("exec builder returned nil iterator")
514+
} else {
515+
ctx.GetLogger().WithField("iterType", fmt.Sprintf("%T", iter)).Debug("built exec iterator")
516+
}
517517

518518
var schema sql.Schema
519519
iter, schema, err = rowexec.FinalizeIters(ctx, plan, qFlags, iter)
@@ -856,21 +856,21 @@ func (e *Engine) executeEvent(ctx *sql.Context, dbName, createEventStatement, us
856856
definitionNode := createEventNode.DefinitionNode
857857

858858
// Build an iterator to execute the event body
859-
ctx.GetLogger().WithField("planNodeType", fmt.Sprintf("%T", definitionNode)).Debug("building exec iterator")
860-
iter, err := e.Analyzer.ExecBuilder.Build(ctx, definitionNode, nil)
859+
ctx.GetLogger().WithField("planNodeType", fmt.Sprintf("%T", definitionNode)).Debug("building exec iterator")
860+
iter, err := e.Analyzer.ExecBuilder.Build(ctx, definitionNode, nil)
861861
if err != nil {
862-
ctx.GetLogger().WithError(err).Debug("exec builder returned error")
862+
ctx.GetLogger().WithError(err).Debug("exec builder returned error")
863863
clearAutocommitErr := clearAutocommitTransaction(ctx)
864864
if clearAutocommitErr != nil {
865865
return clearAutocommitErr
866866
}
867867
return err
868868
}
869-
if iter == nil {
870-
ctx.GetLogger().Debug("exec builder returned nil iterator")
871-
} else {
872-
ctx.GetLogger().WithField("iterType", fmt.Sprintf("%T", iter)).Debug("built exec iterator")
873-
}
869+
if iter == nil {
870+
ctx.GetLogger().Debug("exec builder returned nil iterator")
871+
} else {
872+
ctx.GetLogger().WithField("iterType", fmt.Sprintf("%T", iter)).Debug("built exec iterator")
873+
}
874874

875875
iter, _, err = rowexec.FinalizeIters(ctx, definitionNode, nil, iter)
876876
if err != nil {

sql/rowexec/builder.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
package rowexec
1616

1717
import (
18-
"fmt"
19-
"runtime/trace"
18+
"fmt"
19+
"runtime/trace"
2020

21-
"github.com/dolthub/go-mysql-server/sql"
22-
"github.com/dolthub/go-mysql-server/sql/plan"
21+
"github.com/dolthub/go-mysql-server/sql"
22+
"github.com/dolthub/go-mysql-server/sql/plan"
2323
)
2424

2525
var DefaultBuilder = &BaseBuilder{}
@@ -38,25 +38,25 @@ type BaseBuilder struct {
3838

3939
func (b *BaseBuilder) Build(ctx *sql.Context, n sql.Node, r sql.Row) (sql.RowIter, error) {
4040
defer trace.StartRegion(ctx, "ExecBuilder.Build").End()
41-
logger := ctx.GetLogger().WithField("nodeType", fmt.Sprintf("%T", n))
42-
if b.override != nil {
43-
logger = logger.WithField("override", true)
44-
} else {
45-
logger = logger.WithField("override", false)
46-
}
47-
logger.Debug("building RowIter for node")
41+
logger := ctx.GetLogger().WithField("nodeType", fmt.Sprintf("%T", n))
42+
if b.override != nil {
43+
logger = logger.WithField("override", true)
44+
} else {
45+
logger = logger.WithField("override", false)
46+
}
47+
logger.Debug("building RowIter for node")
4848

49-
iter, err := b.buildNodeExec(ctx, n, r)
50-
if err != nil {
51-
logger.WithError(err).Debug("buildNodeExec returned error")
52-
return nil, err
53-
}
54-
if iter == nil {
55-
logger.Debug("buildNodeExec returned nil iterator")
56-
return nil, nil
57-
}
58-
logger.WithField("iterType", fmt.Sprintf("%T", iter)).Debug("built iterator for node")
59-
return iter, nil
49+
iter, err := b.buildNodeExec(ctx, n, r)
50+
if err != nil {
51+
logger.WithError(err).Debug("buildNodeExec returned error")
52+
return nil, err
53+
}
54+
if iter == nil {
55+
logger.Debug("buildNodeExec returned nil iterator")
56+
return nil, nil
57+
}
58+
logger.WithField("iterType", fmt.Sprintf("%T", iter)).Debug("built iterator for node")
59+
return iter, nil
6060
}
6161

6262
func NewOverrideBuilder(override sql.NodeExecBuilder) sql.NodeExecBuilder {

sql/rowexec/merge_join.go

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
package rowexec
1616

1717
import (
18-
"errors"
19-
"fmt"
20-
"io"
18+
"errors"
19+
"fmt"
20+
"io"
2121

22-
"github.com/dolthub/go-mysql-server/sql/plan"
22+
"github.com/dolthub/go-mysql-server/sql/plan"
2323

24-
"github.com/dolthub/go-mysql-server/sql"
25-
"github.com/dolthub/go-mysql-server/sql/expression"
24+
"github.com/dolthub/go-mysql-server/sql"
25+
"github.com/dolthub/go-mysql-server/sql/expression"
2626
)
2727

2828
// NewMergeJoin returns a node that performs a presorted merge join on
@@ -47,16 +47,16 @@ func newMergeJoinIter(ctx *sql.Context, b sql.NodeExecBuilder, j *plan.JoinNode,
4747
return nil, err
4848
}
4949

50-
ctx.GetLogger().WithFields(map[string]any{
51-
"joinOp": fmt.Sprintf("%v", j.Op),
52-
"isReversed": j.IsReversed,
53-
"scopeLen": j.ScopeLen,
54-
"leftSchemaLen": len(j.Left().Schema()),
55-
"rightSchemaLen": len(j.Right().Schema()),
56-
"filterIsNil": j.Filter == nil,
57-
"leftIterType": fmt.Sprintf("%T", l),
58-
"rightIterType": fmt.Sprintf("%T", r),
59-
}).Debug("constructed merge join child iterators")
50+
ctx.GetLogger().WithFields(map[string]any{
51+
"joinOp": fmt.Sprintf("%v", j.Op),
52+
"isReversed": j.IsReversed,
53+
"scopeLen": j.ScopeLen,
54+
"leftSchemaLen": len(j.Left().Schema()),
55+
"rightSchemaLen": len(j.Right().Schema()),
56+
"filterIsNil": j.Filter == nil,
57+
"leftIterType": fmt.Sprintf("%T", l),
58+
"rightIterType": fmt.Sprintf("%T", r),
59+
}).Debug("constructed merge join child iterators")
6060

6161
fullRow := make(sql.Row, len(row)+len(j.Left().Schema())+len(j.Right().Schema()))
6262
fullRow[0] = row
@@ -67,23 +67,23 @@ func newMergeJoinIter(ctx *sql.Context, b sql.NodeExecBuilder, j *plan.JoinNode,
6767
// a merge join's first filter provides direction information
6868
// for which iter to update next
6969
filters := expression.SplitConjunction(j.Filter)
70-
cmp, ok := filters[0].(expression.Comparer)
70+
cmp, ok := filters[0].(expression.Comparer)
7171
if !ok {
7272
if equality, ok := filters[0].(expression.Equality); ok {
7373
cmp, err = equality.ToComparer()
7474
if err != nil {
7575
return nil, err
7676
}
7777
} else {
78-
ctx.GetLogger().WithField("firstFilterType", fmt.Sprintf("%T", filters[0])).Debug("merge join expected comparer filter")
79-
return nil, sql.ErrMergeJoinExpectsComparerFilters.New(filters[0])
78+
ctx.GetLogger().WithField("firstFilterType", fmt.Sprintf("%T", filters[0])).Debug("merge join expected comparer filter")
79+
return nil, sql.ErrMergeJoinExpectsComparerFilters.New(filters[0])
8080
}
8181
}
8282

83-
if len(filters) == 0 {
84-
ctx.GetLogger().Debug("merge join constructed with zero filters")
85-
return nil, sql.ErrNoJoinFilters.New()
86-
}
83+
if len(filters) == 0 {
84+
ctx.GetLogger().Debug("merge join constructed with zero filters")
85+
return nil, sql.ErrNoJoinFilters.New()
86+
}
8787

8888
var iter sql.RowIter = &mergeJoinIter{
8989
left: l,
@@ -98,7 +98,7 @@ func newMergeJoinIter(ctx *sql.Context, b sql.NodeExecBuilder, j *plan.JoinNode,
9898
rightRowLen: len(j.Right().Schema()),
9999
isReversed: j.IsReversed,
100100
}
101-
ctx.GetLogger().WithField("iterType", fmt.Sprintf("%T", iter)).Debug("created merge join iter")
101+
ctx.GetLogger().WithField("iterType", fmt.Sprintf("%T", iter)).Debug("created merge join iter")
102102
return iter, nil
103103
}
104104

@@ -223,10 +223,10 @@ func (i *mergeJoinIter) Next(ctx *sql.Context) (sql.Row, error) {
223223
} else {
224224
nextState = msCompare
225225
}
226-
case msCompare:
227-
res, err = i.cmp.Compare(ctx, i.fullRow)
228-
if expression.ErrNilOperand.Is(err) {
229-
ctx.GetLogger().Debug("merge join comparer produced nil operand; rejecting null")
226+
case msCompare:
227+
res, err = i.cmp.Compare(ctx, i.fullRow)
228+
if expression.ErrNilOperand.Is(err) {
229+
ctx.GetLogger().Debug("merge join comparer produced nil operand; rejecting null")
230230
nextState = msRejectNull
231231
break
232232
} else if err != nil {
@@ -450,7 +450,7 @@ func (i *mergeJoinIter) initIters(ctx *sql.Context) error {
450450
}
451451
i.init = true
452452
i.resetMatchState()
453-
ctx.GetLogger().Debug("merge join iters initialized")
453+
ctx.GetLogger().Debug("merge join iters initialized")
454454
return nil
455455
}
456456

@@ -526,14 +526,14 @@ func (i *mergeJoinIter) incLeft(ctx *sql.Context) error {
526526
i.leftMatched = false
527527
var row sql.Row
528528
var err error
529-
if i.leftPeek != nil {
529+
if i.leftPeek != nil {
530530
row = i.leftPeek
531531
i.leftPeek = nil
532532
} else {
533533
row, err = i.left.Next(ctx)
534534
if errors.Is(err, io.EOF) {
535535
i.leftExhausted = true
536-
ctx.GetLogger().Trace("merge join left iterator exhausted")
536+
ctx.GetLogger().Trace("merge join left iterator exhausted")
537537
return nil
538538
} else if err != nil {
539539
return err
@@ -544,22 +544,22 @@ func (i *mergeJoinIter) incLeft(ctx *sql.Context) error {
544544
for j, v := range row {
545545
i.fullRow[off+j] = v
546546
}
547-
ctx.GetLogger().Trace("merge join advanced left iterator")
547+
ctx.GetLogger().Trace("merge join advanced left iterator")
548548
return nil
549549
}
550550

551551
// incRight updates |i.fullRow|'s right row
552552
func (i *mergeJoinIter) incRight(ctx *sql.Context) error {
553553
var row sql.Row
554554
var err error
555-
if i.rightPeek != nil {
555+
if i.rightPeek != nil {
556556
row = i.rightPeek
557557
i.rightPeek = nil
558558
} else {
559559
row, err = i.right.Next(ctx)
560560
if errors.Is(err, io.EOF) {
561561
i.rightExhausted = true
562-
ctx.GetLogger().Trace("merge join right iterator exhausted")
562+
ctx.GetLogger().Trace("merge join right iterator exhausted")
563563
return nil
564564
} else if err != nil {
565565
return err
@@ -570,7 +570,7 @@ func (i *mergeJoinIter) incRight(ctx *sql.Context) error {
570570
for j, v := range row {
571571
i.fullRow[off+j] = v
572572
}
573-
ctx.GetLogger().Trace("merge join advanced right iterator")
573+
ctx.GetLogger().Trace("merge join advanced right iterator")
574574
return nil
575575
}
576576

sql/rowexec/rel.go

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,26 @@
1515
package rowexec
1616

1717
import (
18-
"errors"
19-
"fmt"
20-
"io"
21-
"os"
22-
"path/filepath"
23-
"reflect"
24-
"strings"
25-
26-
"github.com/dolthub/jsonpath"
27-
"github.com/shopspring/decimal"
28-
"go.opentelemetry.io/otel/attribute"
29-
"go.opentelemetry.io/otel/trace"
30-
31-
"github.com/dolthub/go-mysql-server/sql"
32-
"github.com/dolthub/go-mysql-server/sql/expression"
33-
"github.com/dolthub/go-mysql-server/sql/expression/function/aggregation"
34-
"github.com/dolthub/go-mysql-server/sql/expression/function/json"
35-
"github.com/dolthub/go-mysql-server/sql/iters"
36-
"github.com/dolthub/go-mysql-server/sql/plan"
37-
"github.com/dolthub/go-mysql-server/sql/types"
18+
"errors"
19+
"fmt"
20+
"io"
21+
"os"
22+
"path/filepath"
23+
"reflect"
24+
"strings"
25+
26+
"github.com/dolthub/jsonpath"
27+
"github.com/shopspring/decimal"
28+
"go.opentelemetry.io/otel/attribute"
29+
"go.opentelemetry.io/otel/trace"
30+
31+
"github.com/dolthub/go-mysql-server/sql"
32+
"github.com/dolthub/go-mysql-server/sql/expression"
33+
"github.com/dolthub/go-mysql-server/sql/expression/function/aggregation"
34+
"github.com/dolthub/go-mysql-server/sql/expression/function/json"
35+
"github.com/dolthub/go-mysql-server/sql/iters"
36+
"github.com/dolthub/go-mysql-server/sql/plan"
37+
"github.com/dolthub/go-mysql-server/sql/types"
3838
)
3939

4040
func (b *BaseBuilder) buildTopN(ctx *sql.Context, n *plan.TopN, row sql.Row) (sql.RowIter, error) {
@@ -307,15 +307,15 @@ func (b *BaseBuilder) buildProject(ctx *sql.Context, n *plan.Project, row sql.Ro
307307
attribute.Int("projections", len(n.Projections)),
308308
))
309309

310-
i, err := b.buildNodeExec(ctx, n.Child, row)
310+
i, err := b.buildNodeExec(ctx, n.Child, row)
311311
if err != nil {
312312
span.End()
313313
return nil, err
314314
}
315315

316-
if i == nil {
317-
ctx.GetLogger().WithField("nodeType", "Project").Debug("child iterator is nil")
318-
}
316+
if i == nil {
317+
ctx.GetLogger().WithField("nodeType", "Project").Debug("child iterator is nil")
318+
}
319319

320320
return sql.NewSpanIter(span, &ProjectIter{
321321
projs: n.Projections,
@@ -479,14 +479,14 @@ func (b *BaseBuilder) buildLimit(ctx *sql.Context, n *plan.Limit, row sql.Row) (
479479
return nil, err
480480
}
481481

482-
childIter, err := b.buildNodeExec(ctx, n.Child, row)
482+
childIter, err := b.buildNodeExec(ctx, n.Child, row)
483483
if err != nil {
484484
span.End()
485485
return nil, err
486486
}
487-
if childIter == nil {
488-
ctx.GetLogger().WithField("nodeType", "Limit").Debug("child iterator is nil")
489-
}
487+
if childIter == nil {
488+
ctx.GetLogger().WithField("nodeType", "Limit").Debug("child iterator is nil")
489+
}
490490
return sql.NewSpanIter(span, &iters.LimitIter{
491491
CalcFoundRows: n.CalcFoundRows,
492492
Limit: limit,

0 commit comments

Comments
 (0)