-
Notifications
You must be signed in to change notification settings - Fork 0
/
select_executor.go
50 lines (43 loc) · 1.06 KB
/
select_executor.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* NeoDB
*
* Copyright 2018 The Radon Authors.
* Copyright 2021-2030 The NeoDB Authors.
* Code is licensed under the GPLv3.
*
*/
package executor
import (
"github.com/sealdb/neodb/backend"
"github.com/sealdb/neodb/executor/engine"
"github.com/sealdb/neodb/planner"
"github.com/sealdb/neodb/xcontext"
"github.com/sealdb/mysqlstack/xlog"
)
var (
_ Executor = &SelectExecutor{}
)
// SelectExecutor represents select executor
type SelectExecutor struct {
log *xlog.Log
plan planner.Plan
txn backend.Transaction
}
// NewSelectExecutor creates the new select executor.
func NewSelectExecutor(log *xlog.Log, plan planner.Plan, txn backend.Transaction) *SelectExecutor {
return &SelectExecutor{
log: log,
plan: plan,
txn: txn,
}
}
// Execute used to execute the executor.
func (executor *SelectExecutor) Execute(ctx *xcontext.ResultContext) error {
log := executor.log
plan := executor.plan.(*planner.SelectPlan)
planEngine := engine.BuildEngine(log, plan.Root, executor.txn)
if err := planEngine.Execute(ctx); err != nil {
return err
}
return nil
}