Skip to content

Commit d94fdff

Browse files
committed
rename pkg/sql/plan to pkg/sql/planner and pkg/sql/function
1 parent 5e1f7fd commit d94fdff

474 files changed

Lines changed: 3531 additions & 3660 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CODEOWNERS

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,12 @@
152152
/pkg/sql @aunjgr
153153
/pkg/sql/colexec @ouyuanning @aunjgr
154154
/pkg/sql/compile @ouyuanning @aunjgr
155+
/pkg/sql/function @ouyuanning @aunjgr
155156
/pkg/sql/models @aptend
156157
/pkg/sql/parsers @iamlinjunhong
157-
/pkg/sql/plan @ouyuanning @aunjgr
158-
/pkg/sql/plan/function @ouyuanning @aunjgr
159-
/pkg/sql/plan/explain @ouyuanning @aunjgr
160-
/pkg/sql/plan/tools @gouhongshen
158+
/pkg/sql/planner @ouyuanning @aunjgr
159+
/pkg/sql/planner/explain @ouyuanning @aunjgr
160+
/pkg/sql/planner/tools @gouhongshen
161161
/pkg/sql/colexec/indexjoin @aunjgr
162162
/pkg/sql/colexec/indexbuild @aunjgr
163163
/pkg/sql/colexec/intersect @aunjgr

pkg/backup/tae.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,19 @@ import (
2929
"sync"
3030
"time"
3131

32-
"github.com/matrixorigin/matrixone/pkg/objectio/ioutil"
33-
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/db/gc/v3"
34-
3532
"github.com/matrixorigin/matrixone/pkg/common/moerr"
3633
"github.com/matrixorigin/matrixone/pkg/common/runtime"
3734
"github.com/matrixorigin/matrixone/pkg/container/types"
3835
"github.com/matrixorigin/matrixone/pkg/container/vector"
3936
"github.com/matrixorigin/matrixone/pkg/fileservice"
4037
"github.com/matrixorigin/matrixone/pkg/logutil"
4138
"github.com/matrixorigin/matrixone/pkg/objectio"
42-
"github.com/matrixorigin/matrixone/pkg/sql/plan/function/ctl"
39+
"github.com/matrixorigin/matrixone/pkg/objectio/ioutil"
40+
"github.com/matrixorigin/matrixone/pkg/sql/function/ctl"
4341
"github.com/matrixorigin/matrixone/pkg/util/executor"
4442
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/common"
4543
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/db/checkpoint"
44+
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/db/gc/v3"
4645
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/logtail"
4746
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/tasks"
4847
)

pkg/cdc/sinker_v2.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"github.com/matrixorigin/matrixone/pkg/logutil"
2828
"github.com/matrixorigin/matrixone/pkg/objectio"
2929
"github.com/matrixorigin/matrixone/pkg/pb/plan"
30-
plan2 "github.com/matrixorigin/matrixone/pkg/sql/plan"
30+
"github.com/matrixorigin/matrixone/pkg/sql/planner"
3131
v2 "github.com/matrixorigin/matrixone/pkg/util/metric/v2"
3232
"go.uber.org/zap"
3333
)
@@ -190,7 +190,7 @@ var CreateMysqlSinker2 = func(
190190
return nil, moerr.NewInternalErrorNoCtx("external table is not supported")
191191
}
192192

193-
createSql, _, err = plan2.ConstructCreateTableSQL(nil, &newTableDef, nil, true, nil)
193+
createSql, _, err = planner.ConstructCreateTableSQL(nil, &newTableDef, nil, true, nil)
194194
if err != nil {
195195
executor.Close()
196196
return nil, err

pkg/cdc/sinker_v2_sql_builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"github.com/matrixorigin/matrixone/pkg/common/moerr"
2323
"github.com/matrixorigin/matrixone/pkg/container/batch"
2424
"github.com/matrixorigin/matrixone/pkg/container/types"
25-
"github.com/matrixorigin/matrixone/pkg/sql/plan"
25+
"github.com/matrixorigin/matrixone/pkg/pb/plan"
2626
)
2727

2828
// CDCStatementBuilder constructs SQL statements for CDC sink operations.

pkg/cnservice/server_query.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import (
3737
"github.com/matrixorigin/matrixone/pkg/perfcounter"
3838
"github.com/matrixorigin/matrixone/pkg/queryservice"
3939
qclient "github.com/matrixorigin/matrixone/pkg/queryservice/client"
40-
"github.com/matrixorigin/matrixone/pkg/sql/plan/function/ctl"
40+
"github.com/matrixorigin/matrixone/pkg/sql/function/ctl"
4141
"github.com/matrixorigin/matrixone/pkg/txn/client"
4242
"github.com/matrixorigin/matrixone/pkg/util/fault"
4343
"github.com/matrixorigin/matrixone/pkg/vm/engine/disttae"

pkg/cnservice/server_query_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ func Test_service_handleCtlReader(t *testing.T) {
734734
fields: fields{},
735735
args: args{
736736
ctx: ctx,
737-
// more details in pkg/sql/plan/function/ctl/reader.go::handleCtlReader
737+
// more details in pkg/sql/function/ctl/reader.go::handleCtlReader
738738
req: &query.Request{CtlReaderRequest: &query.CtlReaderRequest{
739739
Cmd: "enable",
740740
Cfg: "force_shuffle",
@@ -821,7 +821,7 @@ func Test_service_handleRunTask(t *testing.T) {
821821
fields: fields{},
822822
args: args{
823823
ctx: ctx,
824-
// more details in pkg/sql/plan/function/ctl/reader.go::handleCtlReader
824+
// more details in pkg/sql/function/ctl/reader.go::handleCtlReader
825825
req: &query.Request{RunTask: &query.RunTaskRequest{
826826
TaskCode: -1,
827827
}},
@@ -837,7 +837,7 @@ func Test_service_handleRunTask(t *testing.T) {
837837
},
838838
args: args{
839839
ctx: ctx,
840-
// more details in pkg/sql/plan/function/ctl/reader.go::handleCtlReader
840+
// more details in pkg/sql/function/ctl/reader.go::handleCtlReader
841841
req: &query.Request{RunTask: &query.RunTaskRequest{
842842
TaskCode: 1,
843843
}},

pkg/common/moerr/cause.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ var (
161161
CauseGetProcByUuid = NewInternalError(context.Background(), "GetProcByUuid")
162162
CauseGenInsertMOIndexesSql = NewInternalError(context.Background(), "genInsertMOIndexesSql")
163163
CauseGenInsertMOIndexesSql2 = NewInternalError(context.Background(), "genInsertMOIndexesSql 2")
164-
//pkg/sql/plan/function/ctl
164+
//pkg/sql/function/ctl
165165
CauseHandleCoreDump = NewInternalError(context.Background(), "handleCoreDump")
166166
CauseHandleSyncCommit = NewInternalError(context.Background(), "handleSyncCommit")
167167
CauseHandleRemoveRemoteLockTable = NewInternalError(context.Background(), "handleRemoveRemoteLockTable")

pkg/container/vector/functionTools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"github.com/matrixorigin/matrixone/pkg/container/bytejson"
2323
"github.com/matrixorigin/matrixone/pkg/container/nulls"
2424
"github.com/matrixorigin/matrixone/pkg/container/types"
25-
functionUtil "github.com/matrixorigin/matrixone/pkg/sql/plan/function/functionUtil"
25+
functionUtil "github.com/matrixorigin/matrixone/pkg/sql/function/functionUtil"
2626
)
2727

2828
// FunctionParameterWrapper is generated from a vector.

pkg/frontend/authenticate.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ import (
3030
"sync/atomic"
3131
"time"
3232

33-
"github.com/tidwall/btree"
34-
"golang.org/x/sync/errgroup"
35-
3633
"github.com/matrixorigin/matrixone/pkg/catalog"
3734
"github.com/matrixorigin/matrixone/pkg/clusterservice"
3835
"github.com/matrixorigin/matrixone/pkg/common/moerr"
@@ -49,12 +46,12 @@ import (
4946
"github.com/matrixorigin/matrixone/pkg/pb/query"
5047
"github.com/matrixorigin/matrixone/pkg/pb/task"
5148
"github.com/matrixorigin/matrixone/pkg/queryservice"
49+
"github.com/matrixorigin/matrixone/pkg/sql/function"
5250
"github.com/matrixorigin/matrixone/pkg/sql/parsers"
5351
"github.com/matrixorigin/matrixone/pkg/sql/parsers/dialect"
5452
"github.com/matrixorigin/matrixone/pkg/sql/parsers/dialect/mysql"
5553
"github.com/matrixorigin/matrixone/pkg/sql/parsers/tree"
56-
plan2 "github.com/matrixorigin/matrixone/pkg/sql/plan"
57-
"github.com/matrixorigin/matrixone/pkg/sql/plan/function"
54+
"github.com/matrixorigin/matrixone/pkg/sql/planner"
5855
"github.com/matrixorigin/matrixone/pkg/sql/util"
5956
"github.com/matrixorigin/matrixone/pkg/stage"
6057
"github.com/matrixorigin/matrixone/pkg/stage/stageutil"
@@ -65,6 +62,8 @@ import (
6562
"github.com/matrixorigin/matrixone/pkg/util/trace"
6663
"github.com/matrixorigin/matrixone/pkg/util/trace/impl/motrace"
6764
"github.com/matrixorigin/matrixone/pkg/util/trace/impl/motrace/statistic"
65+
"github.com/tidwall/btree"
66+
"golang.org/x/sync/errgroup"
6867
)
6968

7069
type TenantInfo struct {
@@ -4559,7 +4558,7 @@ func doDropFunction(ctx context.Context, ses *Session, df *tree.DropFunction, rm
45594558
if execResultArrayHasData(erArray) {
45604559
receivedArgsType := make([]string, len(df.Args))
45614560
for i, arg := range df.Args {
4562-
typ, err := plan2.GetFunctionArgTypeStrFromAst(arg)
4561+
typ, err := planner.GetFunctionArgTypeStrFromAst(arg)
45634562
if err != nil {
45644563
return err
45654564
}
@@ -6043,7 +6042,7 @@ func (pota privilegeTipsArray) String() string {
60436042
}
60446043

60456044
// extractPrivilegeTipsFromPlan extracts the privilege tips from the plan
6046-
func extractPrivilegeTipsFromPlan(p *plan2.Plan) privilegeTipsArray {
6045+
func extractPrivilegeTipsFromPlan(p *plan.Plan) privilegeTipsArray {
60476046
//NOTE: the pts may be nil when the plan does operate any table.
60486047
var pts privilegeTipsArray
60496048
appendPt := func(pt privilegeTips) {
@@ -7167,7 +7166,7 @@ func checkRoleWhetherDatabaseOwner(ctx context.Context, ses *Session, dbName str
71677166
func authenticateUserCanExecuteStatementWithObjectTypeDatabaseAndTable(ctx context.Context,
71687167
ses *Session,
71697168
stmt tree.Statement,
7170-
p *plan2.Plan) (bool, statistic.StatsArray, error) {
7169+
p *plan.Plan) (bool, statistic.StatsArray, error) {
71717170
var stats statistic.StatsArray
71727171
stats.Reset()
71737172

@@ -8718,7 +8717,7 @@ func InitFunction(ses *Session, execCtx *ExecCtx, tenant *TenantInfo, cf *tree.C
87188717

87198718
// format return type
87208719
fmtctx = tree.NewFmtCtx(dialect.MYSQL, tree.WithQuoteString(true))
8721-
retTypeStr, err = plan2.GetFunctionTypeStrFromAst(cf.ReturnType.Type)
8720+
retTypeStr, err = planner.GetFunctionTypeStrFromAst(cf.ReturnType.Type)
87228721
if err != nil {
87238722
return err
87248723
}
@@ -8730,7 +8729,7 @@ func InitFunction(ses *Session, execCtx *ExecCtx, tenant *TenantInfo, cf *tree.C
87308729
argList[i] = &function.Arg{}
87318730
argList[i].Name = cf.Args[i].GetName(fmtctx)
87328731
fmtctx.Reset()
8733-
typ, err := plan2.GetFunctionArgTypeStrFromAst(cf.Args[i])
8732+
typ, err := planner.GetFunctionArgTypeStrFromAst(cf.Args[i])
87348733
if err != nil {
87358734
return err
87368735
}
@@ -8924,14 +8923,14 @@ func InitProcedure(ctx context.Context, ses *Session, tenant *TenantInfo, cp *tr
89248923
}
89258924
initMoProcedure = fmt.Sprintf(updateMoStoredProcedureFormat,
89268925
string(argsJson),
8927-
cp.Lang, plan2.EscapeFormat(cp.Body), dbName,
8926+
cp.Lang, planner.EscapeFormat(cp.Body), dbName,
89288927
tenant.GetUser(), types.CurrentTimestamp().String2(time.UTC, 0), "PROCEDURE", "DEFINER", "", "utf8mb4", "utf8mb4_0900_ai_ci", "utf8mb4_0900_ai_ci",
89298928
int32(id))
89308929
} else {
89318930
initMoProcedure = fmt.Sprintf(initMoStoredProcedureFormat,
89328931
string(cp.Name.Name.ObjectName),
89338932
string(argsJson),
8934-
cp.Lang, plan2.EscapeFormat(cp.Body), dbName,
8933+
cp.Lang, planner.EscapeFormat(cp.Body), dbName,
89358934
tenant.GetUser(), types.CurrentTimestamp().String2(time.UTC, 0), types.CurrentTimestamp().String2(time.UTC, 0), "PROCEDURE", "DEFINER", "", "utf8mb4", "utf8mb4_0900_ai_ci", "utf8mb4_0900_ai_ci")
89368935
}
89378936
err = bh.Exec(ctx, initMoProcedure)

pkg/frontend/authenticate2.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919

2020
"github.com/matrixorigin/matrixone/pkg/catalog"
2121
"github.com/matrixorigin/matrixone/pkg/pb/plan"
22-
plan2 "github.com/matrixorigin/matrixone/pkg/sql/plan"
22+
"github.com/matrixorigin/matrixone/pkg/sql/planner"
2323
)
2424

2525
// verifyAccountCanOperateClusterTable determines the account can operate
@@ -229,7 +229,7 @@ var privilegeCacheIsEnabled = func(ctx context.Context, ses *Session) (bool, err
229229
}
230230

231231
// hasMoCtrl checks whether the plan has mo_ctrl
232-
func hasMoCtrl(p *plan2.Plan) bool {
232+
func hasMoCtrl(p *plan.Plan) bool {
233233
if p != nil && p.GetQuery() != nil { //select,insert select, update, delete
234234
q := p.GetQuery()
235235
if q.StmtType == plan.Query_INSERT || q.StmtType == plan.Query_SELECT {
@@ -239,7 +239,7 @@ func hasMoCtrl(p *plan2.Plan) bool {
239239
// select mo_ctrl ...
240240
// insert into ... select mo_ctrl ...
241241
for _, proj := range node.ProjectList {
242-
if plan2.HasMoCtrl(proj) {
242+
if planner.HasMoCtrl(proj) {
243243
return true
244244
}
245245
}
@@ -253,7 +253,7 @@ func hasMoCtrl(p *plan2.Plan) bool {
253253
// isTargetSysWhiteList checks if ALL DML target tables are in the whitelist.
254254
// Returns true only when all target tables are in the whitelist.
255255
// Returns false if any target table is not in the whitelist, or if there are no DML target tables.
256-
func isTargetSysWhiteList(p *plan2.Plan) bool {
256+
func isTargetSysWhiteList(p *plan.Plan) bool {
257257
if p == nil || p.GetQuery() == nil {
258258
return false
259259
}

0 commit comments

Comments
 (0)