Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@
/pkg/sql @aunjgr
/pkg/sql/colexec @ouyuanning @aunjgr
/pkg/sql/compile @ouyuanning @aunjgr
/pkg/sql/function @ouyuanning @aunjgr
/pkg/sql/models @aptend
/pkg/sql/parsers @iamlinjunhong
/pkg/sql/plan @ouyuanning @aunjgr
/pkg/sql/plan/function @ouyuanning @aunjgr
/pkg/sql/plan/explain @ouyuanning @aunjgr
/pkg/sql/plan/tools @gouhongshen
/pkg/sql/planner @ouyuanning @aunjgr
/pkg/sql/planner/explain @ouyuanning @aunjgr
/pkg/sql/planner/tools @gouhongshen
/pkg/sql/colexec/indexjoin @aunjgr
/pkg/sql/colexec/indexbuild @aunjgr
/pkg/sql/colexec/intersect @aunjgr
Expand Down
7 changes: 3 additions & 4 deletions pkg/backup/tae.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,19 @@ import (
"sync"
"time"

"github.com/matrixorigin/matrixone/pkg/objectio/ioutil"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/db/gc/v3"

"github.com/matrixorigin/matrixone/pkg/common/moerr"
"github.com/matrixorigin/matrixone/pkg/common/runtime"
"github.com/matrixorigin/matrixone/pkg/container/types"
"github.com/matrixorigin/matrixone/pkg/container/vector"
"github.com/matrixorigin/matrixone/pkg/fileservice"
"github.com/matrixorigin/matrixone/pkg/logutil"
"github.com/matrixorigin/matrixone/pkg/objectio"
"github.com/matrixorigin/matrixone/pkg/sql/plan/function/ctl"
"github.com/matrixorigin/matrixone/pkg/objectio/ioutil"
"github.com/matrixorigin/matrixone/pkg/sql/function/ctl"
"github.com/matrixorigin/matrixone/pkg/util/executor"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/common"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/db/checkpoint"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/db/gc/v3"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/logtail"
"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/tasks"
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/cdc/sinker_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/matrixorigin/matrixone/pkg/logutil"
"github.com/matrixorigin/matrixone/pkg/objectio"
"github.com/matrixorigin/matrixone/pkg/pb/plan"
plan2 "github.com/matrixorigin/matrixone/pkg/sql/plan"
"github.com/matrixorigin/matrixone/pkg/sql/planner"
v2 "github.com/matrixorigin/matrixone/pkg/util/metric/v2"
"go.uber.org/zap"
)
Expand Down Expand Up @@ -190,7 +190,7 @@ var CreateMysqlSinker2 = func(
return nil, moerr.NewInternalErrorNoCtx("external table is not supported")
}

createSql, _, err = plan2.ConstructCreateTableSQL(nil, &newTableDef, nil, true, nil)
createSql, _, err = planner.ConstructCreateTableSQL(nil, &newTableDef, nil, true, nil)
if err != nil {
executor.Close()
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/cdc/sinker_v2_sql_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/matrixorigin/matrixone/pkg/common/moerr"
"github.com/matrixorigin/matrixone/pkg/container/batch"
"github.com/matrixorigin/matrixone/pkg/container/types"
"github.com/matrixorigin/matrixone/pkg/sql/plan"
"github.com/matrixorigin/matrixone/pkg/pb/plan"
)

// CDCStatementBuilder constructs SQL statements for CDC sink operations.
Expand Down
2 changes: 1 addition & 1 deletion pkg/cnservice/server_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
"github.com/matrixorigin/matrixone/pkg/perfcounter"
"github.com/matrixorigin/matrixone/pkg/queryservice"
qclient "github.com/matrixorigin/matrixone/pkg/queryservice/client"
"github.com/matrixorigin/matrixone/pkg/sql/plan/function/ctl"
"github.com/matrixorigin/matrixone/pkg/sql/function/ctl"
"github.com/matrixorigin/matrixone/pkg/txn/client"
"github.com/matrixorigin/matrixone/pkg/util/fault"
"github.com/matrixorigin/matrixone/pkg/vm/engine/disttae"
Expand Down
9 changes: 4 additions & 5 deletions pkg/cnservice/server_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import (
"unsafe"

"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"

"github.com/matrixorigin/matrixone/pkg/common/moerr"
"github.com/matrixorigin/matrixone/pkg/container/types"
"github.com/matrixorigin/matrixone/pkg/defines"
Expand All @@ -51,6 +49,7 @@ import (
"github.com/matrixorigin/matrixone/pkg/txn/client"
"github.com/matrixorigin/matrixone/pkg/util/trace"
"github.com/matrixorigin/matrixone/pkg/vm/engine"
"github.com/stretchr/testify/require"
)

var dummyBadRequestErr = moerr.NewInternalError(context.TODO(), "bad request")
Expand Down Expand Up @@ -734,7 +733,7 @@ func Test_service_handleCtlReader(t *testing.T) {
fields: fields{},
args: args{
ctx: ctx,
// more details in pkg/sql/plan/function/ctl/reader.go::handleCtlReader
// more details in pkg/sql/function/ctl/reader.go::handleCtlReader
req: &query.Request{CtlReaderRequest: &query.CtlReaderRequest{
Cmd: "enable",
Cfg: "force_shuffle",
Expand Down Expand Up @@ -821,7 +820,7 @@ func Test_service_handleRunTask(t *testing.T) {
fields: fields{},
args: args{
ctx: ctx,
// more details in pkg/sql/plan/function/ctl/reader.go::handleCtlReader
// more details in pkg/sql/function/ctl/reader.go::handleCtlReader
req: &query.Request{RunTask: &query.RunTaskRequest{
TaskCode: -1,
}},
Expand All @@ -837,7 +836,7 @@ func Test_service_handleRunTask(t *testing.T) {
},
args: args{
ctx: ctx,
// more details in pkg/sql/plan/function/ctl/reader.go::handleCtlReader
// more details in pkg/sql/function/ctl/reader.go::handleCtlReader
req: &query.Request{RunTask: &query.RunTaskRequest{
TaskCode: 1,
}},
Expand Down
2 changes: 1 addition & 1 deletion pkg/common/moerr/cause.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ var (
CauseGetProcByUuid = NewInternalError(context.Background(), "GetProcByUuid")
CauseGenInsertMOIndexesSql = NewInternalError(context.Background(), "genInsertMOIndexesSql")
CauseGenInsertMOIndexesSql2 = NewInternalError(context.Background(), "genInsertMOIndexesSql 2")
//pkg/sql/plan/function/ctl
//pkg/sql/function/ctl
CauseHandleCoreDump = NewInternalError(context.Background(), "handleCoreDump")
CauseHandleSyncCommit = NewInternalError(context.Background(), "handleSyncCommit")
CauseHandleRemoveRemoteLockTable = NewInternalError(context.Background(), "handleRemoveRemoteLockTable")
Expand Down
2 changes: 1 addition & 1 deletion pkg/container/vector/functionTools.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/matrixorigin/matrixone/pkg/container/bytejson"
"github.com/matrixorigin/matrixone/pkg/container/nulls"
"github.com/matrixorigin/matrixone/pkg/container/types"
functionUtil "github.com/matrixorigin/matrixone/pkg/sql/plan/function/functionUtil"
functionUtil "github.com/matrixorigin/matrixone/pkg/sql/function/functionUtil"
)

// FunctionParameterWrapper is generated from a vector.
Expand Down
23 changes: 11 additions & 12 deletions pkg/frontend/authenticate.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ import (
"sync/atomic"
"time"

"github.com/tidwall/btree"
"golang.org/x/sync/errgroup"

"github.com/matrixorigin/matrixone/pkg/catalog"
"github.com/matrixorigin/matrixone/pkg/clusterservice"
"github.com/matrixorigin/matrixone/pkg/common/moerr"
Expand All @@ -49,12 +46,12 @@ import (
"github.com/matrixorigin/matrixone/pkg/pb/query"
"github.com/matrixorigin/matrixone/pkg/pb/task"
"github.com/matrixorigin/matrixone/pkg/queryservice"
"github.com/matrixorigin/matrixone/pkg/sql/function"
"github.com/matrixorigin/matrixone/pkg/sql/parsers"
"github.com/matrixorigin/matrixone/pkg/sql/parsers/dialect"
"github.com/matrixorigin/matrixone/pkg/sql/parsers/dialect/mysql"
"github.com/matrixorigin/matrixone/pkg/sql/parsers/tree"
plan2 "github.com/matrixorigin/matrixone/pkg/sql/plan"
"github.com/matrixorigin/matrixone/pkg/sql/plan/function"
"github.com/matrixorigin/matrixone/pkg/sql/planner"
"github.com/matrixorigin/matrixone/pkg/sql/util"
"github.com/matrixorigin/matrixone/pkg/stage"
"github.com/matrixorigin/matrixone/pkg/stage/stageutil"
Expand All @@ -65,6 +62,8 @@ import (
"github.com/matrixorigin/matrixone/pkg/util/trace"
"github.com/matrixorigin/matrixone/pkg/util/trace/impl/motrace"
"github.com/matrixorigin/matrixone/pkg/util/trace/impl/motrace/statistic"
"github.com/tidwall/btree"
"golang.org/x/sync/errgroup"
)

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

// extractPrivilegeTipsFromPlan extracts the privilege tips from the plan
func extractPrivilegeTipsFromPlan(p *plan2.Plan) privilegeTipsArray {
func extractPrivilegeTipsFromPlan(p *plan.Plan) privilegeTipsArray {
//NOTE: the pts may be nil when the plan does operate any table.
var pts privilegeTipsArray
appendPt := func(pt privilegeTips) {
Expand Down Expand Up @@ -7167,7 +7166,7 @@ func checkRoleWhetherDatabaseOwner(ctx context.Context, ses *Session, dbName str
func authenticateUserCanExecuteStatementWithObjectTypeDatabaseAndTable(ctx context.Context,
ses *Session,
stmt tree.Statement,
p *plan2.Plan) (bool, statistic.StatsArray, error) {
p *plan.Plan) (bool, statistic.StatsArray, error) {
var stats statistic.StatsArray
stats.Reset()

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

// format return type
fmtctx = tree.NewFmtCtx(dialect.MYSQL, tree.WithQuoteString(true))
retTypeStr, err = plan2.GetFunctionTypeStrFromAst(cf.ReturnType.Type)
retTypeStr, err = planner.GetFunctionTypeStrFromAst(cf.ReturnType.Type)
if err != nil {
return err
}
Expand All @@ -8730,7 +8729,7 @@ func InitFunction(ses *Session, execCtx *ExecCtx, tenant *TenantInfo, cf *tree.C
argList[i] = &function.Arg{}
argList[i].Name = cf.Args[i].GetName(fmtctx)
fmtctx.Reset()
typ, err := plan2.GetFunctionArgTypeStrFromAst(cf.Args[i])
typ, err := planner.GetFunctionArgTypeStrFromAst(cf.Args[i])
if err != nil {
return err
}
Expand Down Expand Up @@ -8924,14 +8923,14 @@ func InitProcedure(ctx context.Context, ses *Session, tenant *TenantInfo, cp *tr
}
initMoProcedure = fmt.Sprintf(updateMoStoredProcedureFormat,
string(argsJson),
cp.Lang, plan2.EscapeFormat(cp.Body), dbName,
cp.Lang, planner.EscapeFormat(cp.Body), dbName,
tenant.GetUser(), types.CurrentTimestamp().String2(time.UTC, 0), "PROCEDURE", "DEFINER", "", "utf8mb4", "utf8mb4_0900_ai_ci", "utf8mb4_0900_ai_ci",
int32(id))
} else {
initMoProcedure = fmt.Sprintf(initMoStoredProcedureFormat,
string(cp.Name.Name.ObjectName),
string(argsJson),
cp.Lang, plan2.EscapeFormat(cp.Body), dbName,
cp.Lang, planner.EscapeFormat(cp.Body), dbName,
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")
}
err = bh.Exec(ctx, initMoProcedure)
Expand Down
8 changes: 4 additions & 4 deletions pkg/frontend/authenticate2.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/matrixorigin/matrixone/pkg/catalog"
"github.com/matrixorigin/matrixone/pkg/pb/plan"
plan2 "github.com/matrixorigin/matrixone/pkg/sql/plan"
"github.com/matrixorigin/matrixone/pkg/sql/planner"
)

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

// hasMoCtrl checks whether the plan has mo_ctrl
func hasMoCtrl(p *plan2.Plan) bool {
func hasMoCtrl(p *plan.Plan) bool {
if p != nil && p.GetQuery() != nil { //select,insert select, update, delete
q := p.GetQuery()
if q.StmtType == plan.Query_INSERT || q.StmtType == plan.Query_SELECT {
Expand All @@ -239,7 +239,7 @@ func hasMoCtrl(p *plan2.Plan) bool {
// select mo_ctrl ...
// insert into ... select mo_ctrl ...
for _, proj := range node.ProjectList {
if plan2.HasMoCtrl(proj) {
if planner.HasMoCtrl(proj) {
return true
}
}
Expand All @@ -253,7 +253,7 @@ func hasMoCtrl(p *plan2.Plan) bool {
// isTargetSysWhiteList checks if ALL DML target tables are in the whitelist.
// Returns true only when all target tables are in the whitelist.
// Returns false if any target table is not in the whitelist, or if there are no DML target tables.
func isTargetSysWhiteList(p *plan2.Plan) bool {
func isTargetSysWhiteList(p *plan.Plan) bool {
if p == nil || p.GetQuery() == nil {
return false
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/frontend/authenticate2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"github.com/stretchr/testify/assert"

"github.com/matrixorigin/matrixone/pkg/catalog"
"github.com/matrixorigin/matrixone/pkg/pb/plan"
plan3 "github.com/matrixorigin/matrixone/pkg/pb/plan"
plan2 "github.com/matrixorigin/matrixone/pkg/sql/plan"
)

func Test_verifyAccountCanOperateClusterTable(t *testing.T) {
Expand Down Expand Up @@ -199,12 +199,12 @@ func Test_hasMoCtrl(t *testing.T) {
ret = hasMoCtrl(nil)
assert.False(t, ret)

ret = hasMoCtrl(&plan2.Plan{})
ret = hasMoCtrl(&plan.Plan{})
assert.False(t, ret)

ret = hasMoCtrl(&plan2.Plan{
Plan: &plan2.Plan_Query{
Query: &plan2.Query{
ret = hasMoCtrl(&plan.Plan{
Plan: &plan.Plan_Query{
Query: &plan.Query{
StmtType: plan3.Query_SELECT,
Nodes: []*plan3.Node{
{
Expand Down
53 changes: 26 additions & 27 deletions pkg/frontend/authenticate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import (
"github.com/matrixorigin/matrixone/pkg/pb/txn"
"github.com/matrixorigin/matrixone/pkg/queryservice"
"github.com/matrixorigin/matrixone/pkg/sql/parsers/tree"
plan2 "github.com/matrixorigin/matrixone/pkg/sql/plan"
"github.com/matrixorigin/matrixone/pkg/stage"
"github.com/matrixorigin/matrixone/pkg/testutil"
"github.com/matrixorigin/matrixone/pkg/util/trace/impl/motrace/statistic"
Expand Down Expand Up @@ -3430,31 +3429,31 @@ func Test_determineDropTable(t *testing.T) {
func Test_determineDML(t *testing.T) {
type arg struct {
stmt tree.Statement
p *plan2.Plan
p *plan.Plan
}

args := []arg{
{
stmt: &tree.Select{},
p: &plan2.Plan{
Plan: &plan2.Plan_Query{
Query: &plan2.Query{
Nodes: []*plan2.Node{
{NodeType: plan.Node_TABLE_SCAN, ObjRef: &plan2.ObjectRef{SchemaName: "t", ObjName: "a"}},
{NodeType: plan.Node_TABLE_SCAN, ObjRef: &plan2.ObjectRef{SchemaName: "s", ObjName: "b"}},
p: &plan.Plan{
Plan: &plan.Plan_Query{
Query: &plan.Query{
Nodes: []*plan.Node{
{NodeType: plan.Node_TABLE_SCAN, ObjRef: &plan.ObjectRef{SchemaName: "t", ObjName: "a"}},
{NodeType: plan.Node_TABLE_SCAN, ObjRef: &plan.ObjectRef{SchemaName: "s", ObjName: "b"}},
},
},
},
},
},
{
stmt: &tree.Update{},
p: &plan2.Plan{
Plan: &plan2.Plan_Query{
Query: &plan2.Query{
Nodes: []*plan2.Node{
{NodeType: plan.Node_TABLE_SCAN, ObjRef: &plan2.ObjectRef{SchemaName: "t", ObjName: "a"}},
{NodeType: plan.Node_TABLE_SCAN, ObjRef: &plan2.ObjectRef{SchemaName: "s", ObjName: "b"}},
p: &plan.Plan{
Plan: &plan.Plan_Query{
Query: &plan.Query{
Nodes: []*plan.Node{
{NodeType: plan.Node_TABLE_SCAN, ObjRef: &plan.ObjectRef{SchemaName: "t", ObjName: "a"}},
{NodeType: plan.Node_TABLE_SCAN, ObjRef: &plan.ObjectRef{SchemaName: "s", ObjName: "b"}},
{NodeType: plan.Node_INSERT},
},
},
Expand All @@ -3463,12 +3462,12 @@ func Test_determineDML(t *testing.T) {
},
{
stmt: &tree.Delete{},
p: &plan2.Plan{
Plan: &plan2.Plan_Query{
Query: &plan2.Query{
Nodes: []*plan2.Node{
{NodeType: plan.Node_TABLE_SCAN, ObjRef: &plan2.ObjectRef{SchemaName: "t", ObjName: "a"}},
{NodeType: plan.Node_TABLE_SCAN, ObjRef: &plan2.ObjectRef{SchemaName: "s", ObjName: "b"}},
p: &plan.Plan{
Plan: &plan.Plan_Query{
Query: &plan.Query{
Nodes: []*plan.Node{
{NodeType: plan.Node_TABLE_SCAN, ObjRef: &plan.ObjectRef{SchemaName: "t", ObjName: "a"}},
{NodeType: plan.Node_TABLE_SCAN, ObjRef: &plan.ObjectRef{SchemaName: "s", ObjName: "b"}},
{NodeType: plan.Node_DELETE},
},
},
Expand All @@ -3477,13 +3476,13 @@ func Test_determineDML(t *testing.T) {
},
{ //insert into select
stmt: &tree.Insert{},
p: &plan2.Plan{
Plan: &plan2.Plan_Query{
Query: &plan2.Query{
Nodes: []*plan2.Node{
{NodeType: plan.Node_TABLE_SCAN, ObjRef: &plan2.ObjectRef{SchemaName: "t", ObjName: "a"}},
{NodeType: plan.Node_TABLE_SCAN, ObjRef: &plan2.ObjectRef{SchemaName: "s", ObjName: "b"}},
{NodeType: plan.Node_INSERT, ObjRef: &plan2.ObjectRef{SchemaName: "s", ObjName: "b"}},
p: &plan.Plan{
Plan: &plan.Plan_Query{
Query: &plan.Query{
Nodes: []*plan.Node{
{NodeType: plan.Node_TABLE_SCAN, ObjRef: &plan.ObjectRef{SchemaName: "t", ObjName: "a"}},
{NodeType: plan.Node_TABLE_SCAN, ObjRef: &plan.ObjectRef{SchemaName: "s", ObjName: "b"}},
{NodeType: plan.Node_INSERT, ObjRef: &plan.ObjectRef{SchemaName: "s", ObjName: "b"}},
},
},
},
Expand Down
Loading
Loading