Repository: matrixorigin/matrixone
Pull request #4884 (2022-09-06 00:33:40)

process: add not nil fields to New params; use testutil.NewProc in tests
## What type of PR is this?

- [ ] API-change
- [ ] BUG
- [x] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue #

## What this PR does / why we need it:
process: add not nil fields to New params; use testutil.NewProc in tests


Patch:
diff --git a/pkg/frontend/mysql_cmd_executor.go b/pkg/frontend/mysql_cmd_executor.go
index 0b33a71a9..358a1ebb7 100644
--- a/pkg/frontend/mysql_cmd_executor.go
+++ b/pkg/frontend/mysql_cmd_executor.go
@@ -1658,7 +1658,12 @@ func (mce *MysqlCmdExecutor) doComQuery(requestCtx context.Context, sql string)
 	ses.SetSql(sql)
 	ses.ep.Outfile = false
 
-	proc := process.New(mheap.New(ses.GuestMmu))
+	proc := process.New(
+		requestCtx,
+		mheap.New(ses.GuestMmu),
+		ses.GetTxnHandler().txn,
+		ses.Pu.FileService,
+	)
 	proc.Id = mce.getNextProcessId()
 	proc.Lim.Size = ses.Pu.SV.ProcessLimitationSize
 	proc.Lim.BatchRows = ses.Pu.SV.ProcessLimitationBatchRows
@@ -1671,7 +1676,6 @@ func (mce *MysqlCmdExecutor) doComQuery(requestCtx context.Context, sql string)
 		Version:      serverVersion,
 		TimeZone:     ses.timeZone,
 	}
-	proc.FileService = ses.Pu.FileService
 
 	cws, err := GetComputationWrapper(ses.GetDatabaseName(),
 		sql,
diff --git a/pkg/sql/compile/cnserviceDriver.go b/pkg/sql/compile/cnserviceDriver.go
index d2f09ec66..b41c09c22 100644
--- a/pkg/sql/compile/cnserviceDriver.go
+++ b/pkg/sql/compile/cnserviceDriver.go
@@ -798,11 +798,18 @@ func convertToVmInstruction(opr *pipeline.Instruction, ctx *scopeContext) (vm.In
 }
 
 // newCompile init a new compile for remote run.
-func newCompile(ctx context.Context) *Compile {
+func newCompile(
+	ctx context.Context,
+) *Compile {
 	// not implement now, fill method should send by stream
 	c := &Compile{
-		ctx:  ctx,
-		proc: process.New(mheap.New(guest.New(1<<30, host.New(1<<20)))),
+		ctx: ctx,
+		proc: process.New(
+			ctx,
+			mheap.New(guest.New(1<<30, host.New(1<<20))),
+			nil, //TODO must set txn operator
+			nil, //TODO must set file service
+		),
 	}
 	//c.fill = func(a any, b *batch.Batch) error {
 	//	stream, err := CNClient.NewStream("target")
diff --git a/pkg/vm/process/process.go b/pkg/vm/process/process.go
index fc3ce4a52..74095f2bb 100644
--- a/pkg/vm/process/process.go
+++ b/pkg/vm/process/process.go
@@ -21,14 +21,24 @@ import (
 	"github.com/matrixorigin/matrixone/pkg/container/nulls"
 	"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/txn/client"
 	"github.com/matrixorigin/matrixone/pkg/vm/mheap"
 )
 
 // New creates a new Process.
 // A process stores the execution context.
-func New(m *mheap.Mheap) *Process {
+func New(
+	ctx context.Context,
+	m *mheap.Mheap,
+	txnOperator client.TxnOperator,
+	fileService fileservice.FileService,
+) *Process {
 	return &Process{
-		mp: m,
+		mp:          m,
+		Ctx:         ctx,
+		TxnOperator: txnOperator,
+		FileService: fileService,
 	}
 }
 


Test patch:
diff --git a/pkg/compare/compare_test.go b/pkg/compare/compare_test.go
index 48add6a00..dae12cf90 100644
--- a/pkg/compare/compare_test.go
+++ b/pkg/compare/compare_test.go
@@ -116,6 +116,6 @@ func newTestCase(desc bool, m *mheap.Mheap, typ types.Type) testCase {
 	return testCase{
 		desc: desc,
 		vecs: vecs,
-		proc: process.New(m),
+		proc: testutil.NewProcessWithMheap(m),
 	}
 }
diff --git a/pkg/sort/sort_test.go b/pkg/sort/sort_test.go
index 07bfb7f61..57e8b1784 100644
--- a/pkg/sort/sort_test.go
+++ b/pkg/sort/sort_test.go
@@ -209,7 +209,7 @@ func checkResult(t *testing.T, desc bool, vec *vector.Vector, os []int64) {
 func newTestCase(desc bool, m *mheap.Mheap, typ types.Type) testCase {
 	return testCase{
 		desc: desc,
-		proc: process.New(m),
+		proc: testutil.NewProcessWithMheap(m),
 		vec:  testutil.NewVector(Rows, typ, m, true, nil),
 	}
 }
diff --git a/pkg/sql/colexec/anti/join_test.go b/pkg/sql/colexec/anti/join_test.go
index 0b5bbc517..f02c1ae0e 100644
--- a/pkg/sql/colexec/anti/join_test.go
+++ b/pkg/sql/colexec/anti/join_test.go
@@ -180,7 +180,7 @@ func newExpr(pos int32, typ types.Type) *plan.Expr {
 }
 
 func newTestCase(m *mheap.Mheap, flgs []bool, ts []types.Type, rp []int32, cs [][]*plan.Expr) antiTestCase {
-	proc := process.New(m)
+	proc := testutil.NewProcessWithMheap(m)
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	proc.Reg.MergeReceivers[0] = &process.WaitRegister{
diff --git a/pkg/sql/colexec/connector/connector_test.go b/pkg/sql/colexec/connector/connector_test.go
index f6a555e15..83947367d 100644
--- a/pkg/sql/colexec/connector/connector_test.go
+++ b/pkg/sql/colexec/connector/connector_test.go
@@ -100,7 +100,7 @@ func TestConnector(t *testing.T) {
 }
 
 func newTestCase(gm *guest.Mmu) connectorTestCase {
-	proc := process.New(mheap.New(gm))
+	proc := testutil.NewProcessWithMheap(mheap.New(gm))
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	return connectorTestCase{
diff --git a/pkg/sql/colexec/dispatch/dispatch_test.go b/pkg/sql/colexec/dispatch/dispatch_test.go
index 18fdb48fd..27b48188b 100644
--- a/pkg/sql/colexec/dispatch/dispatch_test.go
+++ b/pkg/sql/colexec/dispatch/dispatch_test.go
@@ -101,7 +101,7 @@ func TestDispatch(t *testing.T) {
 }
 
 func newTestCase(gm *guest.Mmu, all bool) dispatchTestCase {
-	proc := process.New(mheap.New(gm))
+	proc := testutil.NewProcessWithMheap(mheap.New(gm))
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	reg := &process.WaitRegister{Ctx: ctx, Ch: make(chan *batch.Batch, 3)}
diff --git a/pkg/sql/colexec/group/group_test.go b/pkg/sql/colexec/group/group_test.go
index 7f60aac76..5e2109298 100644
--- a/pkg/sql/colexec/group/group_test.go
+++ b/pkg/sql/colexec/group/group_test.go
@@ -158,7 +158,7 @@ func newTestCase(m *mheap.Mheap, flgs []bool, ts []types.Type, exprs []*plan.Exp
 	return groupTestCase{
 		types: ts,
 		flgs:  flgs,
-		proc:  process.New(m),
+		proc:  testutil.NewProcessWithMheap(m),
 		arg: &Argument{
 			Aggs:  aggs,
 			Exprs: exprs,
diff --git a/pkg/sql/colexec/hashbuild/build_test.go b/pkg/sql/colexec/hashbuild/build_test.go
index 88734bfdf..c561eff42 100644
--- a/pkg/sql/colexec/hashbuild/build_test.go
+++ b/pkg/sql/colexec/hashbuild/build_test.go
@@ -132,7 +132,7 @@ func newExpr(pos int32, typ types.Type) *plan.Expr {
 }
 
 func newTestCase(m *mheap.Mheap, flgs []bool, ts []types.Type, cs []*plan.Expr) buildTestCase {
-	proc := process.New(m)
+	proc := testutil.NewProcessWithMheap(m)
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 1)
 	ctx, cancel := context.WithCancel(context.Background())
 	proc.Reg.MergeReceivers[0] = &process.WaitRegister{
diff --git a/pkg/sql/colexec/join/join_test.go b/pkg/sql/colexec/join/join_test.go
index d9ca0de22..7fae49d55 100644
--- a/pkg/sql/colexec/join/join_test.go
+++ b/pkg/sql/colexec/join/join_test.go
@@ -163,7 +163,7 @@ func newExpr(pos int32, typ types.Type) *plan.Expr {
 }
 
 func newTestCase(m *mheap.Mheap, flgs []bool, ts []types.Type, rp []colexec.ResultPos, cs [][]*plan.Expr) joinTestCase {
-	proc := process.New(m)
+	proc := testutil.NewProcessWithMheap(m)
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	proc.Reg.MergeReceivers[0] = &process.WaitRegister{
diff --git a/pkg/sql/colexec/left/join_test.go b/pkg/sql/colexec/left/join_test.go
index 1c5f4873a..24b7a0876 100644
--- a/pkg/sql/colexec/left/join_test.go
+++ b/pkg/sql/colexec/left/join_test.go
@@ -182,7 +182,7 @@ func newExpr(pos int32, typ types.Type) *plan.Expr {
 }
 
 func newTestCase(m *mheap.Mheap, flgs []bool, ts []types.Type, rp []colexec.ResultPos, cs [][]*plan.Expr) joinTestCase {
-	proc := process.New(m)
+	proc := testutil.NewProcessWithMheap(m)
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	proc.Reg.MergeReceivers[0] = &process.WaitRegister{
diff --git a/pkg/sql/colexec/limit/limit_test.go b/pkg/sql/colexec/limit/limit_test.go
index 56f6dcb3a..f95446266 100644
--- a/pkg/sql/colexec/limit/limit_test.go
+++ b/pkg/sql/colexec/limit/limit_test.go
@@ -49,7 +49,7 @@ func init() {
 	gm := guest.New(1<<30, hm)
 	tcs = []limitTestCase{
 		{
-			proc: process.New(mheap.New(gm)),
+			proc: testutil.NewProcessWithMheap(mheap.New(gm)),
 			types: []types.Type{
 				{Oid: types.T_int8},
 			},
@@ -59,7 +59,7 @@ func init() {
 			},
 		},
 		{
-			proc: process.New(mheap.New(gm)),
+			proc: testutil.NewProcessWithMheap(mheap.New(gm)),
 			types: []types.Type{
 				{Oid: types.T_int8},
 			},
@@ -69,7 +69,7 @@ func init() {
 			},
 		},
 		{
-			proc: process.New(mheap.New(gm)),
+			proc: testutil.NewProcessWithMheap(mheap.New(gm)),
 			types: []types.Type{
 				{Oid: types.T_int8},
 			},
@@ -123,7 +123,7 @@ func BenchmarkLimit(b *testing.B) {
 		gm := guest.New(1<<30, hm)
 		tcs = []limitTestCase{
 			{
-				proc: process.New(mheap.New(gm)),
+				proc: testutil.NewProcessWithMheap(mheap.New(gm)),
 				types: []types.Type{
 					{Oid: types.T_int8},
 				},
diff --git a/pkg/sql/colexec/loopanti/join_test.go b/pkg/sql/colexec/loopanti/join_test.go
index 31d963d86..76604f323 100644
--- a/pkg/sql/colexec/loopanti/join_test.go
+++ b/pkg/sql/colexec/loopanti/join_test.go
@@ -146,7 +146,7 @@ func BenchmarkJoin(b *testing.B) {
 }
 
 func newTestCase(m *mheap.Mheap, flgs []bool, ts []types.Type, rp []int32) joinTestCase {
-	proc := process.New(m)
+	proc := testutil.NewProcessWithMheap(m)
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	proc.Reg.MergeReceivers[0] = &process.WaitRegister{
diff --git a/pkg/sql/colexec/loopjoin/join_test.go b/pkg/sql/colexec/loopjoin/join_test.go
index 0f2279519..31fed68a2 100644
--- a/pkg/sql/colexec/loopjoin/join_test.go
+++ b/pkg/sql/colexec/loopjoin/join_test.go
@@ -127,7 +127,7 @@ func BenchmarkJoin(b *testing.B) {
 }
 
 func newTestCase(m *mheap.Mheap, flgs []bool, ts []types.Type, rp []colexec.ResultPos) joinTestCase {
-	proc := process.New(m)
+	proc := testutil.NewProcessWithMheap(m)
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	proc.Reg.MergeReceivers[0] = &process.WaitRegister{
diff --git a/pkg/sql/colexec/loopleft/join_test.go b/pkg/sql/colexec/loopleft/join_test.go
index f7e13f7b2..6ac78f49b 100644
--- a/pkg/sql/colexec/loopleft/join_test.go
+++ b/pkg/sql/colexec/loopleft/join_test.go
@@ -147,7 +147,7 @@ func BenchmarkJoin(b *testing.B) {
 }
 
 func newTestCase(m *mheap.Mheap, flgs []bool, ts []types.Type, rp []colexec.ResultPos) joinTestCase {
-	proc := process.New(m)
+	proc := testutil.NewProcessWithMheap(m)
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	proc.Reg.MergeReceivers[0] = &process.WaitRegister{
diff --git a/pkg/sql/colexec/loopsemi/join_test.go b/pkg/sql/colexec/loopsemi/join_test.go
index ccd260b56..306fec512 100644
--- a/pkg/sql/colexec/loopsemi/join_test.go
+++ b/pkg/sql/colexec/loopsemi/join_test.go
@@ -127,7 +127,7 @@ func BenchmarkJoin(b *testing.B) {
 }
 
 func newTestCase(m *mheap.Mheap, flgs []bool, ts []types.Type, rp []int32) joinTestCase {
-	proc := process.New(m)
+	proc := testutil.NewProcessWithMheap(m)
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	proc.Reg.MergeReceivers[0] = &process.WaitRegister{
diff --git a/pkg/sql/colexec/loopsingle/join_test.go b/pkg/sql/colexec/loopsingle/join_test.go
index 67849a743..fb5776583 100644
--- a/pkg/sql/colexec/loopsingle/join_test.go
+++ b/pkg/sql/colexec/loopsingle/join_test.go
@@ -147,7 +147,7 @@ func BenchmarkJoin(b *testing.B) {
 }
 
 func newTestCase(m *mheap.Mheap, flgs []bool, ts []types.Type, rp []colexec.ResultPos) joinTestCase {
-	proc := process.New(m)
+	proc := testutil.NewProcessWithMheap(m)
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	proc.Reg.MergeReceivers[0] = &process.WaitRegister{
diff --git a/pkg/sql/colexec/mark/join_test.go b/pkg/sql/colexec/mark/join_test.go
index beba27242..6f92daf6f 100644
--- a/pkg/sql/colexec/mark/join_test.go
+++ b/pkg/sql/colexec/mark/join_test.go
@@ -192,7 +192,7 @@ func newExpr(pos int32, typ types.Type) *plan.Expr {
 }
 
 func newTestCase(m *mheap.Mheap, flgs []bool, ts []types.Type, rp []int32, cs [][]*plan.Expr) markTestCase {
-	proc := process.New(m)
+	proc := testutil.NewProcessWithMheap(m)
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	proc.Reg.MergeReceivers[0] = &process.WaitRegister{
diff --git a/pkg/sql/colexec/merge/merge_test.go b/pkg/sql/colexec/merge/merge_test.go
index 41573077f..0cd129e4f 100644
--- a/pkg/sql/colexec/merge/merge_test.go
+++ b/pkg/sql/colexec/merge/merge_test.go
@@ -101,7 +101,7 @@ func TestMerge(t *testing.T) {
 }
 
 func newTestCase(m *mheap.Mheap) mergeTestCase {
-	proc := process.New(m)
+	proc := testutil.NewProcessWithMheap(m)
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	proc.Reg.MergeReceivers[0] = &process.WaitRegister{
diff --git a/pkg/sql/colexec/mergegroup/group_test.go b/pkg/sql/colexec/mergegroup/group_test.go
index 450f655e8..49ac03304 100644
--- a/pkg/sql/colexec/mergegroup/group_test.go
+++ b/pkg/sql/colexec/mergegroup/group_test.go
@@ -163,7 +163,7 @@ func BenchmarkGroup(b *testing.B) {
 }
 
 func newTestCase(m *mheap.Mheap, flgs []bool, needEval bool, ts []types.Type) groupTestCase {
-	proc := process.New(m)
+	proc := testutil.NewProcessWithMheap(m)
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	proc.Reg.MergeReceivers[0] = &process.WaitRegister{
diff --git a/pkg/sql/colexec/mergelimit/limit_test.go b/pkg/sql/colexec/mergelimit/limit_test.go
index b24466b97..96a6a8d87 100644
--- a/pkg/sql/colexec/mergelimit/limit_test.go
+++ b/pkg/sql/colexec/mergelimit/limit_test.go
@@ -147,7 +147,7 @@ func BenchmarkLimit(b *testing.B) {
 }
 
 func newTestCase(m *mheap.Mheap, limit uint64) limitTestCase {
-	proc := process.New(m)
+	proc := testutil.NewProcessWithMheap(m)
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	proc.Reg.MergeReceivers[0] = &process.WaitRegister{
diff --git a/pkg/sql/colexec/mergeoffset/offset_test.go b/pkg/sql/colexec/mergeoffset/offset_test.go
index 1fb363956..0d3dc0071 100644
--- a/pkg/sql/colexec/mergeoffset/offset_test.go
+++ b/pkg/sql/colexec/mergeoffset/offset_test.go
@@ -148,7 +148,7 @@ func BenchmarkOffset(b *testing.B) {
 }
 
 func newTestCase(m *mheap.Mheap, offset uint64) offsetTestCase {
-	proc := process.New(m)
+	proc := testutil.NewProcessWithMheap(m)
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	proc.Reg.MergeReceivers[0] = &process.WaitRegister{
diff --git a/pkg/sql/colexec/mergeorder/order_test.go b/pkg/sql/colexec/mergeorder/order_test.go
index b851da0e4..09cd4d866 100644
--- a/pkg/sql/colexec/mergeorder/order_test.go
+++ b/pkg/sql/colexec/mergeorder/order_test.go
@@ -144,7 +144,7 @@ func BenchmarkOrder(b *testing.B) {
 }
 
 func newTestCase(m *mheap.Mheap, ds []bool, ts []types.Type, fs []colexec.Field) orderTestCase {
-	proc := process.New(m)
+	proc := testutil.NewProcessWithMheap(m)
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	proc.Reg.MergeReceivers[0] = &process.WaitRegister{
diff --git a/pkg/sql/colexec/mergetop/top_test.go b/pkg/sql/colexec/mergetop/top_test.go
index e7a36a379..a42f5e425 100644
--- a/pkg/sql/colexec/mergetop/top_test.go
+++ b/pkg/sql/colexec/mergetop/top_test.go
@@ -145,7 +145,7 @@ func BenchmarkTop(b *testing.B) {
 }
 
 func newTestCase(m *mheap.Mheap, ds []bool, ts []types.Type, limit int64, fs []colexec.Field) topTestCase {
-	proc := process.New(m)
+	proc := testutil.NewProcessWithMheap(m)
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	proc.Reg.MergeReceivers[0] = &process.WaitRegister{
diff --git a/pkg/sql/colexec/offset/offset_test.go b/pkg/sql/colexec/offset/offset_test.go
index bd241ba52..bb79ed2b7 100644
--- a/pkg/sql/colexec/offset/offset_test.go
+++ b/pkg/sql/colexec/offset/offset_test.go
@@ -49,7 +49,7 @@ func init() {
 	gm := guest.New(1<<30, hm)
 	tcs = []offsetTestCase{
 		{
-			proc: process.New(mheap.New(gm)),
+			proc: testutil.NewProcessWithMheap(mheap.New(gm)),
 			types: []types.Type{
 				{Oid: types.T_int8},
 			},
@@ -59,7 +59,7 @@ func init() {
 			},
 		},
 		{
-			proc: process.New(mheap.New(gm)),
+			proc: testutil.NewProcessWithMheap(mheap.New(gm)),
 			types: []types.Type{
 				{Oid: types.T_int8},
 			},
@@ -69,7 +69,7 @@ func init() {
 			},
 		},
 		{
-			proc: process.New(mheap.New(gm)),
+			proc: testutil.NewProcessWithMheap(mheap.New(gm)),
 			types: []types.Type{
 				{Oid: types.T_int8},
 			},
@@ -123,7 +123,7 @@ func BenchmarkOffset(b *testing.B) {
 		gm := guest.New(1<<30, hm)
 		tcs = []offsetTestCase{
 			{
-				proc: process.New(mheap.New(gm)),
+				proc: testutil.NewProcessWithMheap(mheap.New(gm)),
 				types: []types.Type{
 					{Oid: types.T_int8},
 				},
diff --git a/pkg/sql/colexec/order/order_test.go b/pkg/sql/colexec/order/order_test.go
index 0d1807aae..69796b090 100644
--- a/pkg/sql/colexec/order/order_test.go
+++ b/pkg/sql/colexec/order/order_test.go
@@ -126,7 +126,7 @@ func BenchmarkOrder(b *testing.B) {
 func newTestCase(m *mheap.Mheap, ts []types.Type, fs []colexec.Field) orderTestCase {
 	return orderTestCase{
 		types: ts,
-		proc:  process.New(m),
+		proc:  testutil.NewProcessWithMheap(m),
 		arg: &Argument{
 			Fs: fs,
 		},
diff --git a/pkg/sql/colexec/output/output_test.go b/pkg/sql/colexec/output/output_test.go
index a1d889d11..26be28c14 100644
--- a/pkg/sql/colexec/output/output_test.go
+++ b/pkg/sql/colexec/output/output_test.go
@@ -52,7 +52,7 @@ func init() {
 	gm := guest.New(1<<30, hm)
 	tcs = []outputTestCase{
 		{
-			proc: process.New(mheap.New(gm)),
+			proc: testutil.NewProcessWithMheap(mheap.New(gm)),
 			types: []types.Type{
 				{Oid: types.T_int8},
 			},
diff --git a/pkg/sql/colexec/product/product_test.go b/pkg/sql/colexec/product/product_test.go
index e3fc03056..416b441fb 100644
--- a/pkg/sql/colexec/product/product_test.go
+++ b/pkg/sql/colexec/product/product_test.go
@@ -126,7 +126,7 @@ func BenchmarkProduct(b *testing.B) {
 }
 
 func newTestCase(m *mheap.Mheap, flgs []bool, ts []types.Type, rp []colexec.ResultPos) productTestCase {
-	proc := process.New(m)
+	proc := testutil.NewProcessWithMheap(m)
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	proc.Reg.MergeReceivers[0] = &process.WaitRegister{
diff --git a/pkg/sql/colexec/projection/projection_test.go b/pkg/sql/colexec/projection/projection_test.go
index 94b8d6655..55b814de6 100644
--- a/pkg/sql/colexec/projection/projection_test.go
+++ b/pkg/sql/colexec/projection/projection_test.go
@@ -49,7 +49,7 @@ func init() {
 	gm := guest.New(1<<30, hm)
 	tcs = []projectionTestCase{
 		{
-			proc: process.New(mheap.New(gm)),
+			proc: testutil.NewProcessWithMheap(mheap.New(gm)),
 			types: []types.Type{
 				{Oid: types.T_int8},
 			},
diff --git a/pkg/sql/colexec/semi/join_test.go b/pkg/sql/colexec/semi/join_test.go
index 899038315..76ecdca39 100644
--- a/pkg/sql/colexec/semi/join_test.go
+++ b/pkg/sql/colexec/semi/join_test.go
@@ -162,7 +162,7 @@ func newExpr(pos int32, typ types.Type) *plan.Expr {
 }
 
 func newTestCase(m *mheap.Mheap, flgs []bool, ts []types.Type, rp []int32, cs [][]*plan.Expr) joinTestCase {
-	proc := process.New(m)
+	proc := testutil.NewProcessWithMheap(m)
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	proc.Reg.MergeReceivers[0] = &process.WaitRegister{
diff --git a/pkg/sql/colexec/single/join_test.go b/pkg/sql/colexec/single/join_test.go
index 60a129b76..1162c27e6 100644
--- a/pkg/sql/colexec/single/join_test.go
+++ b/pkg/sql/colexec/single/join_test.go
@@ -172,7 +172,7 @@ func newExpr(pos int32, typ types.Type) *plan.Expr {
 }
 
 func newTestCase(m *mheap.Mheap, flgs []bool, ts []types.Type, rp []colexec.ResultPos, cs [][]*plan.Expr) joinTestCase {
-	proc := process.New(m)
+	proc := testutil.NewProcessWithMheap(m)
 	proc.Reg.MergeReceivers = make([]*process.WaitRegister, 2)
 	ctx, cancel := context.WithCancel(context.Background())
 	proc.Reg.MergeReceivers[0] = &process.WaitRegister{
diff --git a/pkg/sql/colexec/top/top_test.go b/pkg/sql/colexec/top/top_test.go
index 49bdf3ba0..0e9f5a4b6 100644
--- a/pkg/sql/colexec/top/top_test.go
+++ b/pkg/sql/colexec/top/top_test.go
@@ -121,7 +121,7 @@ func BenchmarkTop(b *testing.B) {
 func newTestCase(m *mheap.Mheap, ts []types.Type, limit int64, fs []colexec.Field) topTestCase {
 	return topTestCase{
 		types: ts,
-		proc:  process.New(m),
+		proc:  testutil.NewProcessWithMheap(m),
 		arg: &Argument{
 			Fs:    fs,
 			Limit: limit,
diff --git a/pkg/sql/plan/function/builtin/binary/date_format_test.go b/pkg/sql/plan/function/builtin/binary/date_format_test.go
index b8e8c880d..6056b984e 100644
--- a/pkg/sql/plan/function/builtin/binary/date_format_test.go
+++ b/pkg/sql/plan/function/builtin/binary/date_format_test.go
@@ -20,10 +20,6 @@ import (
 	"github.com/matrixorigin/matrixone/pkg/container/types"
 	"github.com/matrixorigin/matrixone/pkg/container/vector"
 	"github.com/matrixorigin/matrixone/pkg/testutil"
-	"github.com/matrixorigin/matrixone/pkg/vm/mheap"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/guest"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/host"
-	"github.com/matrixorigin/matrixone/pkg/vm/process"
 	"github.com/smartystreets/goconvey/convey"
 	"github.com/stretchr/testify/require"
 )
@@ -540,12 +536,6 @@ func TestDateFormat(t *testing.T) {
 
 // Single row constant input parameter test date_format function
 func TestDateFormatWithScalar(t *testing.T) {
-	makeProcess := func() *process.Process {
-		hm := host.New(1 << 40)
-		gm := guest.New(1<<40, hm)
-		return process.New(mheap.New(gm))
-	}
-
 	// Construct vector parameter of date_format() function
 	makeDateFormatVectors := func(date string, format string) []*vector.Vector {
 		vec := make([]*vector.Vector, 2)
@@ -661,7 +651,7 @@ func TestDateFormatWithScalar(t *testing.T) {
 		},
 	}
 
-	proc := makeProcess()
+	proc := testutil.NewProc()
 	for _, c := range cases {
 		t.Run(c.name, func(t *testing.T) {
 			inputVecs := makeDateFormatVectors(c.datestr, c.format)
diff --git a/pkg/sql/plan/function/builtin/binary/endswith_test.go b/pkg/sql/plan/function/builtin/binary/endswith_test.go
index e4612ad0c..f9b303549 100644
--- a/pkg/sql/plan/function/builtin/binary/endswith_test.go
+++ b/pkg/sql/plan/function/builtin/binary/endswith_test.go
@@ -21,10 +21,6 @@ import (
 
 	"github.com/matrixorigin/matrixone/pkg/container/vector"
 	"github.com/matrixorigin/matrixone/pkg/testutil"
-	"github.com/matrixorigin/matrixone/pkg/vm/mheap"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/guest"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/host"
-	"github.com/matrixorigin/matrixone/pkg/vm/process"
 	"github.com/smartystreets/goconvey/convey"
 )
 
@@ -34,7 +30,7 @@ func Test_EndsWith(t *testing.T) {
 		var charVecBase2 = []string{"-", "+", "1", ""}
 		var nsp1, nsp2 []uint64
 		var origVecs = make([]*vector.Vector, 2)
-		var proc = process.New(mheap.New(&guest.Mmu{Mmu: host.New(100000), Limit: 100000}))
+		var proc = testutil.NewProc()
 		n1, n2 := len(charVecBase), len(charVecBase2)
 		inputVec := make([]string, n1*n2)
 		inputVec2 := make([]string, len(inputVec))
diff --git a/pkg/sql/plan/function/builtin/binary/power_test.go b/pkg/sql/plan/function/builtin/binary/power_test.go
index 923c25b57..0b0911f71 100644
--- a/pkg/sql/plan/function/builtin/binary/power_test.go
+++ b/pkg/sql/plan/function/builtin/binary/power_test.go
@@ -17,9 +17,7 @@ package binary
 import (
 	"testing"
 
-	"github.com/matrixorigin/matrixone/pkg/vm/mheap"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/guest"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/host"
+	"github.com/matrixorigin/matrixone/pkg/testutil"
 
 	"github.com/matrixorigin/matrixone/pkg/container/types"
 	"github.com/matrixorigin/matrixone/pkg/container/vector"
@@ -49,9 +47,7 @@ func TestPower(t *testing.T) {
 }
 
 func powerFloat64[T constraints.Integer | constraints.Float](t *testing.T, typ types.T, src T, src2 T, res float64) {
-	hm := host.New(1 << 40)
-	gm := guest.New(1<<40, hm)
-	procs := process.New(mheap.New(gm))
+	procs := testutil.NewProc()
 	cases := []struct {
 		name       string
 		vecs       []*vector.Vector
diff --git a/pkg/sql/plan/function/builtin/binary/startswith_test.go b/pkg/sql/plan/function/builtin/binary/startswith_test.go
index 45dc05c99..f77637ef5 100644
--- a/pkg/sql/plan/function/builtin/binary/startswith_test.go
+++ b/pkg/sql/plan/function/builtin/binary/startswith_test.go
@@ -21,10 +21,6 @@ import (
 
 	"github.com/matrixorigin/matrixone/pkg/container/vector"
 	"github.com/matrixorigin/matrixone/pkg/testutil"
-	"github.com/matrixorigin/matrixone/pkg/vm/mheap"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/guest"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/host"
-	"github.com/matrixorigin/matrixone/pkg/vm/process"
 	"github.com/smartystreets/goconvey/convey"
 )
 
@@ -34,7 +30,7 @@ func Test_StartsWith(t *testing.T) {
 		var charVecBase2 = []string{"-", "+", "1", ""}
 		var nsp1, nsp2 []uint64
 		var origVecs = make([]*vector.Vector, 2)
-		var proc = process.New(mheap.New(&guest.Mmu{Mmu: host.New(100000), Limit: 100000}))
+		var proc = testutil.NewProc()
 		n1, n2 := len(charVecBase), len(charVecBase2)
 		inputVec := make([]string, n1*n2)
 		inputVec2 := make([]string, len(inputVec))
diff --git a/pkg/sql/plan/function/builtin/multi/ceil_test.go b/pkg/sql/plan/function/builtin/multi/ceil_test.go
index af98429fd..8c6e3ce29 100644
--- a/pkg/sql/plan/function/builtin/multi/ceil_test.go
+++ b/pkg/sql/plan/function/builtin/multi/ceil_test.go
@@ -22,10 +22,6 @@ import (
 
 	"github.com/matrixorigin/matrixone/pkg/container/vector"
 	"github.com/matrixorigin/matrixone/pkg/testutil"
-	"github.com/matrixorigin/matrixone/pkg/vm/mheap"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/guest"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/host"
-	"github.com/matrixorigin/matrixone/pkg/vm/process"
 	"github.com/smartystreets/goconvey/convey"
 )
 
@@ -34,7 +30,7 @@ func Test_CeilUint64(t *testing.T) {
 		var uint64VecBase = []uint64{1, 4, 8, 16, 32, math.MaxUint64, 0}
 		var nsp1 = []uint64{6}
 		var origVecs = make([]*vector.Vector, 1)
-		var proc = process.New(mheap.New(&guest.Mmu{Mmu: host.New(100000), Limit: 100000}))
+		var proc = testutil.NewProc()
 		origVecs[0] = testutil.MakeUint64Vector(uint64VecBase, nsp1)
 		vec, err := CeilUint64(origVecs, proc)
 		if err != nil {
@@ -72,7 +68,7 @@ func Test_CeilInt64(t *testing.T) {
 		var int64VecBase = []int64{math.MinInt64 + 1, math.MinInt64 + 2, -100, -1, 0, 1, 4, 8, 16, 32, 64, math.MaxInt64, 0}
 		var nsp1 = []uint64{12}
 		var origVecs = make([]*vector.Vector, 1)
-		var proc = process.New(mheap.New(&guest.Mmu{Mmu: host.New(100000), Limit: 100000}))
+		var proc = testutil.NewProc()
 		origVecs[0] = testutil.MakeInt64Vector(int64VecBase, nsp1)
 		vec, err := CeilInt64(origVecs, proc)
 		if err != nil {
@@ -110,7 +106,7 @@ func Test_CeilFloat64(t *testing.T) {
 			1.5, 4.4, 8.5, 16.32, 32.345, 64.09, math.MaxInt64, math.MaxFloat64, 0}
 		var nsp1 = []uint64{uint64(len(float64VecBase) - 1)}
 		var origVecs = make([]*vector.Vector, 1)
-		var proc = process.New(mheap.New(&guest.Mmu{Mmu: host.New(100000), Limit: 100000}))
+		var proc = testutil.NewProc()
 		origVecs[0] = testutil.MakeFloat64Vector(float64VecBase, nsp1)
 		vec, err := CeilFloat64(origVecs, proc)
 		if err != nil {
diff --git a/pkg/sql/plan/function/builtin/multi/date_add_test.go b/pkg/sql/plan/function/builtin/multi/date_add_test.go
index 31fe5dabe..bd236d408 100644
--- a/pkg/sql/plan/function/builtin/multi/date_add_test.go
+++ b/pkg/sql/plan/function/builtin/multi/date_add_test.go
@@ -19,6 +19,7 @@ import (
 
 	"github.com/matrixorigin/matrixone/pkg/container/types"
 	"github.com/matrixorigin/matrixone/pkg/container/vector"
+	"github.com/matrixorigin/matrixone/pkg/testutil"
 	"github.com/matrixorigin/matrixone/pkg/vm/process"
 	"github.com/stretchr/testify/require"
 )
@@ -33,7 +34,7 @@ func TestDateAdd(t *testing.T) {
 		{
 			name: "TEST01",
 			vecs: makeDateAddVectors("2022-01-01", true, 1, types.Day),
-			proc: makeProcess(),
+			proc: testutil.NewProc(),
 			want: "2022-01-02",
 		},
 	}
@@ -60,7 +61,7 @@ func TestDatetimeAdd(t *testing.T) {
 		{
 			name: "TEST01",
 			vecs: makeDatetimeAddVectors("2022-01-01 00:00:00", true, 1, types.Day),
-			proc: makeProcess(),
+			proc: testutil.NewProc(),
 			want: "2022-01-02 00:00:00",
 		},
 	}
@@ -88,28 +89,28 @@ func TestDateStringAdd(t *testing.T) {
 		{
 			name: "TEST01",
 			vecs: makeDateStringAddVectors("2022-01-01", true, 1, types.Day),
-			proc: makeProcess(),
+			proc: testutil.NewProc(),
 			want: "2022-01-02 00:00:00",
 			err:  nil,
 		},
 		{
 			name: "TEST02",
 			vecs: makeDateStringAddVectors("2022-01-01 00:00:00", true, 1, types.Day),
-			proc: makeProcess(),
+			proc: testutil.NewProc(),
 			want: "2022-01-02 00:00:00",
 			err:  nil,
 		},
 		{
 			name: "TEST03",
 			vecs: makeDateStringAddVectors("2022-01-01", true, 1, types.Second),
-			proc: makeProcess(),
+			proc: testutil.NewProc(),
 			want: "2022-01-01 00:00:01",
 			err:  nil,
 		},
 		{
 			name: "TEST04",
 			vecs: makeDateStringAddVectors("xxxx", true, 1, types.Second),
-			proc: makeProcess(),
+			proc: testutil.NewProc(),
 			want: "0001-01-01 00:00:00",
 			err:  types.ErrIncorrectDatetimeValue,
 		},
diff --git a/pkg/sql/plan/function/builtin/multi/date_sub_test.go b/pkg/sql/plan/function/builtin/multi/date_sub_test.go
index ed5fefa04..d2e5bea6b 100644
--- a/pkg/sql/plan/function/builtin/multi/date_sub_test.go
+++ b/pkg/sql/plan/function/builtin/multi/date_sub_test.go
@@ -19,6 +19,7 @@ import (
 
 	"github.com/matrixorigin/matrixone/pkg/container/types"
 	"github.com/matrixorigin/matrixone/pkg/container/vector"
+	"github.com/matrixorigin/matrixone/pkg/testutil"
 	"github.com/matrixorigin/matrixone/pkg/vm/process"
 	"github.com/stretchr/testify/require"
 )
@@ -33,7 +34,7 @@ func TestDateSub(t *testing.T) {
 		{
 			name: "TEST01",
 			vecs: makeDateSubVectors("2022-01-02", true, 1, types.Day),
-			proc: makeProcess(),
+			proc: testutil.NewProc(),
 			want: "2022-01-01",
 		},
 	}
@@ -60,7 +61,7 @@ func TestDatetimeSub(t *testing.T) {
 		{
 			name: "TEST01",
 			vecs: makeDatetimeSubVectors("2022-01-02 00:00:00", true, 1, types.Day),
-			proc: makeProcess(),
+			proc: testutil.NewProc(),
 			want: "2022-01-01 00:00:00",
 		},
 	}
@@ -88,28 +89,28 @@ func TestDateStringSub(t *testing.T) {
 		{
 			name: "TEST01",
 			vecs: makeDateStringSubVectors("2022-01-02", true, 1, types.Day),
-			proc: makeProcess(),
+			proc: testutil.NewProc(),
 			want: "2022-01-01 00:00:00",
 			err:  nil,
 		},
 		{
 			name: "TEST02",
 			vecs: makeDateStringSubVectors("2022-01-02 00:00:00", true, 1, types.Day),
-			proc: makeProcess(),
+			proc: testutil.NewProc(),
 			want: "2022-01-01 00:00:00",
 			err:  nil,
 		},
 		{
 			name: "TEST03",
 			vecs: makeDateStringSubVectors("2022-01-01", true, 1, types.Second),
-			proc: makeProcess(),
+			proc: testutil.NewProc(),
 			want: "2021-12-31 23:59:59",
 			err:  nil,
 		},
 		{
 			name: "TEST04",
 			vecs: makeDateStringSubVectors("xxxx", true, 1, types.Second),
-			proc: makeProcess(),
+			proc: testutil.NewProc(),
 			want: "0001-01-01 00:00:00",
 			err:  types.ErrIncorrectDatetimeValue,
 		},
diff --git a/pkg/sql/plan/function/builtin/multi/floor_test.go b/pkg/sql/plan/function/builtin/multi/floor_test.go
index cb32bba1d..59115738e 100644
--- a/pkg/sql/plan/function/builtin/multi/floor_test.go
+++ b/pkg/sql/plan/function/builtin/multi/floor_test.go
@@ -22,10 +22,6 @@ import (
 
 	"github.com/matrixorigin/matrixone/pkg/container/vector"
 	"github.com/matrixorigin/matrixone/pkg/testutil"
-	"github.com/matrixorigin/matrixone/pkg/vm/mheap"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/guest"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/host"
-	"github.com/matrixorigin/matrixone/pkg/vm/process"
 	"github.com/smartystreets/goconvey/convey"
 )
 
@@ -34,7 +30,7 @@ func Test_FloorUint64(t *testing.T) {
 		var uint64VecBase = []uint64{1, 4, 8, 16, 32, math.MaxUint64, 0}
 		var nsp1 = []uint64{6}
 		var origVecs = make([]*vector.Vector, 1)
-		var proc = process.New(mheap.New(&guest.Mmu{Mmu: host.New(100000), Limit: 100000}))
+		var proc = testutil.NewProc()
 		origVecs[0] = testutil.MakeUint64Vector(uint64VecBase, nsp1)
 		vec, err := FloorUInt64(origVecs, proc)
 		if err != nil {
@@ -72,7 +68,7 @@ func Test_FloorInt64(t *testing.T) {
 		var int64VecBase = []int64{math.MinInt64 + 1, math.MinInt64 + 2, -100, -1, 0, 1, 4, 8, 16, 32, 64, math.MaxInt64, 0}
 		var nsp1 = []uint64{12}
 		var origVecs = make([]*vector.Vector, 1)
-		var proc = process.New(mheap.New(&guest.Mmu{Mmu: host.New(100000), Limit: 100000}))
+		var proc = testutil.NewProc()
 		origVecs[0] = testutil.MakeInt64Vector(int64VecBase, nsp1)
 		vec, err := FloorInt64(origVecs, proc)
 		if err != nil {
@@ -110,7 +106,7 @@ func Test_FloorFloat64(t *testing.T) {
 			1.5, 4.4, 8.5, 16.32, 32.345, 64.09, math.MaxInt64, math.MaxFloat64, 0}
 		var nsp1 = []uint64{uint64(len(float64VecBase) - 1)}
 		var origVecs = make([]*vector.Vector, 1)
-		var proc = process.New(mheap.New(&guest.Mmu{Mmu: host.New(100000), Limit: 100000}))
+		var proc = testutil.NewProc()
 		origVecs[0] = testutil.MakeFloat64Vector(float64VecBase, nsp1)
 		vec, err := FloorFloat64(origVecs, proc)
 		if err != nil {
diff --git a/pkg/sql/plan/function/builtin/multi/round_test.go b/pkg/sql/plan/function/builtin/multi/round_test.go
index fd53d08a7..4a54aa0af 100644
--- a/pkg/sql/plan/function/builtin/multi/round_test.go
+++ b/pkg/sql/plan/function/builtin/multi/round_test.go
@@ -22,10 +22,6 @@ import (
 
 	"github.com/matrixorigin/matrixone/pkg/container/vector"
 	"github.com/matrixorigin/matrixone/pkg/testutil"
-	"github.com/matrixorigin/matrixone/pkg/vm/mheap"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/guest"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/host"
-	"github.com/matrixorigin/matrixone/pkg/vm/process"
 	"github.com/smartystreets/goconvey/convey"
 )
 
@@ -34,7 +30,7 @@ func Test_RoundUint64(t *testing.T) {
 		var uint64VecBase = []uint64{1, 4, 8, 16, 32, math.MaxUint64, 0}
 		var nsp1 = []uint64{6}
 		var origVecs = make([]*vector.Vector, 1)
-		var proc = process.New(mheap.New(&guest.Mmu{Mmu: host.New(100000), Limit: 100000}))
+		var proc = testutil.NewProc()
 		origVecs[0] = testutil.MakeUint64Vector(uint64VecBase, nsp1)
 		vec, err := RoundUint64(origVecs, proc)
 		if err != nil {
@@ -72,7 +68,7 @@ func Test_RoundInt64(t *testing.T) {
 		var int64VecBase = []int64{math.MinInt64 + 1, math.MinInt64 + 2, -100, -1, 0, 1, 4, 8, 16, 32, 64, math.MaxInt64, 0}
 		var nsp1 = []uint64{12}
 		var origVecs = make([]*vector.Vector, 1)
-		var proc = process.New(mheap.New(&guest.Mmu{Mmu: host.New(100000), Limit: 100000}))
+		var proc = testutil.NewProc()
 		origVecs[0] = testutil.MakeInt64Vector(int64VecBase, nsp1)
 		vec, err := RoundInt64(origVecs, proc)
 		if err != nil {
@@ -110,7 +106,7 @@ func Test_RoundFloat64(t *testing.T) {
 			1.5, 4.4, 8.5, 16.32, 32.345, 64.09, math.MaxInt64, math.MaxFloat64, 0}
 		var nsp1 = []uint64{uint64(len(float64VecBase) - 1)}
 		var origVecs = make([]*vector.Vector, 1)
-		var proc = process.New(mheap.New(&guest.Mmu{Mmu: host.New(100000), Limit: 100000}))
+		var proc = testutil.NewProc()
 		origVecs[0] = testutil.MakeFloat64Vector(float64VecBase, nsp1)
 		vec, err := RoundFloat64(origVecs, proc)
 		if err != nil {
@@ -149,7 +145,7 @@ func Test_RoundFloat64AndInt64(t *testing.T) {
 		var int64VecBase = []int64{-4, -3, -2, -1, 0, 1, 2, 3, 4, 5}
 		var nsp1 = []uint64{3}
 		var origVecs = make([]*vector.Vector, 2)
-		var proc = process.New(mheap.New(&guest.Mmu{Mmu: host.New(100000), Limit: 100000}))
+		var proc = testutil.NewProc()
 		var compVecVec = [][]float64{{-0, 0, 0, 0}, {-0, 0, 0, 0}, {-0, 0, 0, 0}, {-0, 0, 0, 0}, {-1, 0, 1, 0},
 			{-1.2, 0, 1.2, 0}, {-1.23, 0, 1.23, 0}, {-1.235, 0, 1.235, 0}, {-1.2346, 0, 1.2346, 0}, {-1.23457, 0, 1.23457, 0}}
 
diff --git a/pkg/sql/plan/function/builtin/multi/rpad_test.go b/pkg/sql/plan/function/builtin/multi/rpad_test.go
index cd439b2e1..68a90fa22 100644
--- a/pkg/sql/plan/function/builtin/multi/rpad_test.go
+++ b/pkg/sql/plan/function/builtin/multi/rpad_test.go
@@ -23,10 +23,6 @@ import (
 
 	"github.com/matrixorigin/matrixone/pkg/container/vector"
 	"github.com/matrixorigin/matrixone/pkg/testutil"
-	"github.com/matrixorigin/matrixone/pkg/vm/mheap"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/guest"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/host"
-	"github.com/matrixorigin/matrixone/pkg/vm/process"
 	"github.com/smartystreets/goconvey/convey"
 )
 
@@ -43,7 +39,7 @@ var charVecBase2 = []string{"a", "12", ""}
 var compVec []string
 var compNsp = []int64{0, 1, 2, 5, 8, 11, 12, 13, 14, 15, 16, 17, 20, 23, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44}
 var origVecs = make([]*vector.Vector, 3)
-var proc = process.New(mheap.New(&guest.Mmu{Mmu: host.New(100000), Limit: 100000}))
+var proc = testutil.NewProc()
 
 func Test_varchar1(t *testing.T) {
 	convey.Convey("Test rpad varchar int64 and int64 succ", t, func() {
diff --git a/pkg/sql/plan/function/builtin/multi/substr_test.go b/pkg/sql/plan/function/builtin/multi/substr_test.go
index 45ec5ee7e..c14ed32aa 100644
--- a/pkg/sql/plan/function/builtin/multi/substr_test.go
+++ b/pkg/sql/plan/function/builtin/multi/substr_test.go
@@ -19,15 +19,13 @@ import (
 
 	"github.com/matrixorigin/matrixone/pkg/container/types"
 	"github.com/matrixorigin/matrixone/pkg/container/vector"
-	"github.com/matrixorigin/matrixone/pkg/vm/mheap"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/guest"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/host"
+	"github.com/matrixorigin/matrixone/pkg/testutil"
 	"github.com/matrixorigin/matrixone/pkg/vm/process"
 	"github.com/stretchr/testify/require"
 )
 
 func TestSubStr(t *testing.T) {
-	procs := makeProcess()
+	procs := testutil.NewProc()
 	cases := []struct {
 		name       string
 		vecs       []*vector.Vector
@@ -232,7 +230,7 @@ func TestSubStr(t *testing.T) {
 }
 
 func TestSubStrUTF(t *testing.T) {
-	procs := makeProcess()
+	procs := testutil.NewProc()
 	cases := []struct {
 		name       string
 		vecs       []*vector.Vector
@@ -436,12 +434,6 @@ func TestSubStrUTF(t *testing.T) {
 	}
 }
 
-func makeProcess() *process.Process {
-	hm := host.New(1 << 40)
-	gm := guest.New(1<<40, hm)
-	return process.New(mheap.New(gm))
-}
-
 // Construct vector parameter of substring function
 func makeSubStrVectors(src string, start int64, length int64, withLength bool) []*vector.Vector {
 	vec := make([]*vector.Vector, 2)
diff --git a/pkg/sql/plan/function/builtin/multi/utctimestamp_test.go b/pkg/sql/plan/function/builtin/multi/utctimestamp_test.go
index 89f5a268d..5f69d8d05 100644
--- a/pkg/sql/plan/function/builtin/multi/utctimestamp_test.go
+++ b/pkg/sql/plan/function/builtin/multi/utctimestamp_test.go
@@ -15,21 +15,13 @@
 package multi
 
 import (
-	"github.com/matrixorigin/matrixone/pkg/vm/mheap"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/guest"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/host"
-	"github.com/matrixorigin/matrixone/pkg/vm/process"
 	"testing"
+
+	"github.com/matrixorigin/matrixone/pkg/testutil"
 )
 
 func TestUTCTimestamp(t *testing.T) {
-	proc := func() *process.Process {
-		hm := host.New(1 << 40)
-		gm := guest.New(1<<40, hm)
-		return process.New(mheap.New(gm))
-	}
-
-	_, err := UTCTimestamp(nil, proc())
+	_, err := UTCTimestamp(nil, testutil.NewProc())
 	if err != nil {
 		t.Fatal(err)
 	}
diff --git a/pkg/sql/plan/function/builtin/unary/abs_test.go b/pkg/sql/plan/function/builtin/unary/abs_test.go
index 875f01eb1..2553c18d0 100644
--- a/pkg/sql/plan/function/builtin/unary/abs_test.go
+++ b/pkg/sql/plan/function/builtin/unary/abs_test.go
@@ -21,10 +21,6 @@ import (
 
 	"github.com/matrixorigin/matrixone/pkg/container/vector"
 	"github.com/matrixorigin/matrixone/pkg/testutil"
-	"github.com/matrixorigin/matrixone/pkg/vm/mheap"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/guest"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/host"
-	"github.com/matrixorigin/matrixone/pkg/vm/process"
 	"github.com/smartystreets/goconvey/convey"
 )
 
@@ -33,7 +29,7 @@ func Test_AbsUint64(t *testing.T) {
 		var uint64VecBase = []uint64{1, 0}
 		var nsp1 = []uint64{2}
 		var origVecs = make([]*vector.Vector, 1)
-		var proc = process.New(mheap.New(&guest.Mmu{Mmu: host.New(100000), Limit: 100000}))
+		var proc = testutil.NewProc()
 		origVecs[0] = testutil.MakeUint64Vector(uint64VecBase, nsp1)
 		vec, err := AbsUInt64(origVecs, proc)
 		if err != nil {
diff --git a/pkg/sql/plan/function/builtin/unary/ltrim_test.go b/pkg/sql/plan/function/builtin/unary/ltrim_test.go
index d173437ff..0864b03ec 100644
--- a/pkg/sql/plan/function/builtin/unary/ltrim_test.go
+++ b/pkg/sql/plan/function/builtin/unary/ltrim_test.go
@@ -20,10 +20,6 @@ import (
 
 	"github.com/matrixorigin/matrixone/pkg/container/vector"
 	"github.com/matrixorigin/matrixone/pkg/testutil"
-	"github.com/matrixorigin/matrixone/pkg/vm/mheap"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/guest"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/host"
-	"github.com/matrixorigin/matrixone/pkg/vm/process"
 	"github.com/smartystreets/goconvey/convey"
 )
 
@@ -32,7 +28,7 @@ func Test_Ltrim(t *testing.T) {
 		var charVecBase = []string{" 123", "  123", "123 ", " 8 ", " 8 a ", ""}
 		var nsp1 = []uint64{5}
 		var origVecs = make([]*vector.Vector, 1)
-		var proc = process.New(mheap.New(&guest.Mmu{Mmu: host.New(100000), Limit: 100000}))
+		var proc = testutil.NewProc()
 		origVecs[0] = testutil.MakeCharVector(charVecBase, nsp1)
 		vec, err := Ltrim(origVecs, proc)
 		if err != nil {
diff --git a/pkg/sql/plan/function/builtin/unary/space_test.go b/pkg/sql/plan/function/builtin/unary/space_test.go
index 8c96a52af..9d7086af5 100644
--- a/pkg/sql/plan/function/builtin/unary/space_test.go
+++ b/pkg/sql/plan/function/builtin/unary/space_test.go
@@ -20,21 +20,10 @@ import (
 	"github.com/matrixorigin/matrixone/pkg/container/nulls"
 	"github.com/matrixorigin/matrixone/pkg/container/types"
 	"github.com/matrixorigin/matrixone/pkg/container/vector"
-	"github.com/matrixorigin/matrixone/pkg/vm/mheap"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/guest"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/host"
-	"github.com/matrixorigin/matrixone/pkg/vm/process"
+	"github.com/matrixorigin/matrixone/pkg/testutil"
 	"github.com/stretchr/testify/require"
 )
 
-func NewTestProc() *process.Process {
-	mmu := host.New(1024 * 1024)
-	gm := guest.New(1024*1024, mmu)
-	mp := mheap.New(gm)
-	proc := process.New(mp)
-	return proc
-}
-
 func makeInt64Vector(values []int64, nsp []uint64) *vector.Vector {
 	ns := nulls.Build(len(values), nsp...)
 	vec := vector.NewWithFixed(types.T_int64.ToType(), values, ns, nil)
@@ -55,7 +44,7 @@ func makeFloat64Vector(values []float64, nsp []uint64) *vector.Vector {
 
 func TestSpaceUint64(t *testing.T) {
 	inputVector := makeUint64Vector([]uint64{1, 2, 3, 0, 8000}, []uint64{4})
-	proc := NewTestProc()
+	proc := testutil.NewProc()
 	output, err := SpaceNumber[uint64]([]*vector.Vector{inputVector}, proc)
 	require.NoError(t, err)
 	require.Equal(t, output.GetString(0), " ")
@@ -67,7 +56,7 @@ func TestSpaceUint64(t *testing.T) {
 
 func TestSpaceInt64(t *testing.T) {
 	inputVector := makeInt64Vector([]int64{1, 2, 3, 0, -1, 8000}, []uint64{4})
-	proc := NewTestProc()
+	proc := testutil.NewProc()
 	output, err := SpaceNumber[int64]([]*vector.Vector{inputVector}, proc)
 	require.NoError(t, err)
 	require.Equal(t, output.GetString(0), " ")
@@ -80,7 +69,7 @@ func TestSpaceInt64(t *testing.T) {
 
 func TestSpaceFloat64(t *testing.T) {
 	inputVector := makeFloat64Vector([]float64{1.4, 1.6, 3.3, 0, -1, 8000}, []uint64{4})
-	proc := NewTestProc()
+	proc := testutil.NewProc()
 	output, err := SpaceNumber[float64]([]*vector.Vector{inputVector}, proc)
 	require.NoError(t, err)
 	require.Equal(t, output.GetString(0), " ")
diff --git a/pkg/sql/plan/function/operator/cast_test.go b/pkg/sql/plan/function/operator/cast_test.go
index 2f131b589..4a551d0fd 100644
--- a/pkg/sql/plan/function/operator/cast_test.go
+++ b/pkg/sql/plan/function/operator/cast_test.go
@@ -51,7 +51,7 @@ func TestCastStringToJson(t *testing.T) {
 			wantScalar: wantScalar,
 		}
 	}
-	procs := makeProcess()
+	procs := testutil.NewProc()
 	cases := []caseStruct{
 		makeCase("Test01", `{"a":1,"b":2}`, true, procs, types.T_json, true),
 		makeCase("Test02", `{"a":1,"b":2}`, false, procs, types.T_json, false),
@@ -76,7 +76,7 @@ func TestCastSameType(t *testing.T) {
 		return vectors
 	}
 
-	procs := makeProcess()
+	procs := testutil.NewProc()
 	cases := []struct {
 		name       string
 		vecs       []*vector.Vector
@@ -246,7 +246,7 @@ func TestCastSameType2(t *testing.T) {
 		return vectors
 	}
 
-	procs := makeProcess()
+	procs := testutil.NewProc()
 	//types.Date | types.Datetime | types.Timestamp
 	cases := []struct {
 		name       string
@@ -329,7 +329,7 @@ func TestCastLeftToRight(t *testing.T) {
 		return vectors
 	}
 
-	procs := makeProcess()
+	procs := testutil.NewProc()
 	cases := []struct {
 		name       string
 		vecs       []*vector.Vector
@@ -1062,7 +1062,7 @@ func TestCastSpecials1Int(t *testing.T) {
 		return vectors
 	}
 
-	procs := makeProcess()
+	procs := testutil.NewProc()
 	cases := []struct {
 		name       string
 		vecs       []*vector.Vector
@@ -1374,7 +1374,7 @@ func TestCastSpecials1Float(t *testing.T) {
 		return vectors
 	}
 
-	procs := makeProcess()
+	procs := testutil.NewProc()
 	cases := []struct {
 		name       string
 		vecs       []*vector.Vector
@@ -1490,7 +1490,7 @@ func TestCastSpecials2Float(t *testing.T) {
 		return vectors
 	}
 
-	procs := makeProcess()
+	procs := testutil.NewProc()
 	cases := []struct {
 		name       string
 		vecs       []*vector.Vector
@@ -1613,7 +1613,7 @@ func TestCastSpecials3(t *testing.T) {
 		return vectors
 	}
 
-	procs := makeProcess()
+	procs := testutil.NewProc()
 	cases := []struct {
 		name       string
 		vecs       []*vector.Vector
@@ -1739,7 +1739,7 @@ func TestCastSpecial4(t *testing.T) {
 	}
 	resType := types.T_decimal128.ToType()
 	decimal128 := types.Decimal128FromInt32(123)
-	procs := makeProcess()
+	procs := testutil.NewProc()
 	cases := []struct {
 		name       string
 		vecs       []*vector.Vector
@@ -2190,7 +2190,7 @@ func TestCastFloatAsDecimal(t *testing.T) {
 		{
 			name:      "TEST01",
 			vecs:      makeTempVectors([]float32{123.0}, leftType, rightType),
-			proc:      makeProcess(),
+			proc:      testutil.NewProc(),
 			wantBytes: []types.Decimal64{types.Decimal64FromFloat64(123.0)},
 		},
 	}
@@ -2222,7 +2222,7 @@ func TestCastDecimalAsString(t *testing.T) {
 		{
 			name: "TEST01",
 			vecs: makeTempVectors([]types.Decimal64{types.Decimal64FromInt32(1230)}, leftType, rightType),
-			proc: makeProcess(),
+			proc: testutil.NewProc(),
 			wantBytes: [][]byte{
 				{0x31, 0x32, 0x33, 0x30},
 			},
@@ -2298,7 +2298,7 @@ func TestCastDecimal64AsDecimal128(t *testing.T) {
 	d64_33333300 := types.Decimal64FromInt32(333333000)
 	d128_33333300 := types.Decimal128FromInt32(333333000)
 
-	procs := makeProcess()
+	procs := testutil.NewProc()
 	cases := []struct {
 		name       string
 		vecs       []*vector.Vector
@@ -2357,7 +2357,7 @@ func TestCastDecimal64AsDecimal64(t *testing.T) {
 	//decimal(10, 4)
 	destType := types.Type{Oid: types.T_decimal64, Size: 8, Width: 10, Scale: 4}
 
-	procs := makeProcess()
+	procs := testutil.NewProc()
 	cases := []struct {
 		name       string
 		vecs       []*vector.Vector
@@ -2414,7 +2414,7 @@ func TestCastDecimal128AsDecimal128(t *testing.T) {
 	leftType := types.Type{Oid: types.T_decimal128, Size: 16, Width: 20, Scale: 5}
 	destType := types.Type{Oid: types.T_decimal128, Size: 16, Width: 20, Scale: 5}
 
-	procs := makeProcess()
+	procs := testutil.NewProc()
 	cases := []struct {
 		name       string
 		vecs       []*vector.Vector
@@ -3042,7 +3042,7 @@ func TestCastNullAsAllType(t *testing.T) {
 		return vectors
 	}
 
-	procs := makeProcess()
+	procs := testutil.NewProc()
 	cases := []struct {
 		name       string
 		vecs       []*vector.Vector
@@ -4214,7 +4214,7 @@ func TestCastBoolAsString(t *testing.T) {
 		return vectors
 	}
 
-	procs := makeProcess()
+	procs := testutil.NewProc()
 	cases := []struct {
 		name       string
 		vecs       []*vector.Vector
@@ -4282,7 +4282,7 @@ func TestCastDateAsDatetimeAndString(t *testing.T) {
 		return vectors
 	}
 
-	procs := makeProcess()
+	procs := testutil.NewProc()
 	cases := []struct {
 		name       string
 		vecs       []*vector.Vector
@@ -4354,7 +4354,7 @@ func TestCastDatetimeAsDateAndString(t *testing.T) {
 		return vectors
 	}
 
-	procs := makeProcess()
+	procs := testutil.NewProc()
 	cases := []struct {
 		name       string
 		vecs       []*vector.Vector
diff --git a/pkg/sql/plan/function/operator/like_test.go b/pkg/sql/plan/function/operator/like_test.go
index 2a20c68bc..8bcaaf4d7 100644
--- a/pkg/sql/plan/function/operator/like_test.go
+++ b/pkg/sql/plan/function/operator/like_test.go
@@ -19,9 +19,8 @@ import (
 
 	"github.com/matrixorigin/matrixone/pkg/container/types"
 	"github.com/matrixorigin/matrixone/pkg/container/vector"
+	"github.com/matrixorigin/matrixone/pkg/testutil"
 	"github.com/matrixorigin/matrixone/pkg/vm/mheap"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/guest"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/host"
 	"github.com/matrixorigin/matrixone/pkg/vm/process"
 	"github.com/stretchr/testify/require"
 )
@@ -36,43 +35,43 @@ func TestLikeVarchar(t *testing.T) {
 		{
 			name:      "TEST01",
 			vecs:      makeLikeVectors("RUNOOB.COM", "%COM", true, true),
-			proc:      process.New(mheap.New(nil)),
+			proc:      testutil.NewProcessWithMheap(mheap.New(nil)),
 			wantBytes: []bool{true},
 		},
 		{
 			name:      "TEST02",
 			vecs:      makeLikeVectors("aaa", "aaa", true, true),
-			proc:      process.New(mheap.New(nil)),
+			proc:      testutil.NewProcessWithMheap(mheap.New(nil)),
 			wantBytes: []bool{true},
 		},
 		{
 			name:      "TEST03",
 			vecs:      makeLikeVectors("123", "1%", true, true),
-			proc:      process.New(mheap.New(nil)),
+			proc:      testutil.NewProcessWithMheap(mheap.New(nil)),
 			wantBytes: []bool{true},
 		},
 		{
 			name:      "TEST04",
 			vecs:      makeLikeVectors("SALESMAN", "%SAL%", true, true),
-			proc:      process.New(mheap.New(nil)),
+			proc:      testutil.NewProcessWithMheap(mheap.New(nil)),
 			wantBytes: []bool{true},
 		},
 		{
 			name:      "TEST05",
 			vecs:      makeLikeVectors("MANAGER@@@", "MAN_", true, true),
-			proc:      process.New(mheap.New(nil)),
+			proc:      testutil.NewProcessWithMheap(mheap.New(nil)),
 			wantBytes: []bool{false},
 		},
 		{
 			name:      "TEST06",
 			vecs:      makeLikeVectors("MANAGER@@@", "_", true, true),
-			proc:      process.New(mheap.New(nil)),
+			proc:      testutil.NewProcessWithMheap(mheap.New(nil)),
 			wantBytes: []bool{false},
 		},
 		{
 			name:      "TEST07",
 			vecs:      makeLikeVectors("hello@world", "hello_world", true, true),
-			proc:      process.New(mheap.New(nil)),
+			proc:      testutil.NewProcessWithMheap(mheap.New(nil)),
 			wantBytes: []bool{true},
 		},
 	}
@@ -89,7 +88,7 @@ func TestLikeVarchar(t *testing.T) {
 }
 
 func TestLikeVarchar2(t *testing.T) {
-	procs := makeProcess()
+	procs := testutil.NewProc()
 	cases := []struct {
 		name       string
 		vecs       []*vector.Vector
@@ -160,12 +159,6 @@ func TestLikeVarchar2(t *testing.T) {
 	}
 }
 
-func makeProcess() *process.Process {
-	hm := host.New(1 << 40)
-	gm := guest.New(1<<40, hm)
-	return process.New(mheap.New(gm))
-}
-
 func makeStrVec(s string, isConst bool, n int) *vector.Vector {
 	if isConst {
 		return vector.NewConstString(types.T_varchar.ToType(), n, s)
diff --git a/pkg/testutil/util_make.go b/pkg/testutil/util_make.go
index b0ce1f6eb..ef63ef4ad 100644
--- a/pkg/testutil/util_make.go
+++ b/pkg/testutil/util_make.go
@@ -21,10 +21,6 @@ import (
 	"github.com/matrixorigin/matrixone/pkg/container/nulls"
 	"github.com/matrixorigin/matrixone/pkg/container/types"
 	"github.com/matrixorigin/matrixone/pkg/container/vector"
-	"github.com/matrixorigin/matrixone/pkg/vm/mheap"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/guest"
-	"github.com/matrixorigin/matrixone/pkg/vm/mmu/host"
-	"github.com/matrixorigin/matrixone/pkg/vm/process"
 	"golang.org/x/exp/constraints"
 )
 
@@ -314,13 +310,6 @@ type vecType interface {
 	constraints.Integer | constraints.Float | bool
 }
 
-func NewProc() *process.Process {
-	proc := process.New(mheap.New(guest.New(1<<20, host.New(1<<20))))
-	proc.SessionInfo.TimeZone = time.Local
-	proc.FileService = NewFS()
-	return proc
-}
-
 func makeVector[T vecType](values []T, nsp []uint64, typ types.Type) *vector.Vector {
 	vec := vector.New(typ)
 	vec.Data = types.EncodeFixedSlice(values, typ.TypeSize())
diff --git a/pkg/testutil/util_new.go b/pkg/testutil/util_new.go
index 90bfbc031..1bc904334 100644
--- a/pkg/testutil/util_new.go
+++ b/pkg/testutil/util_new.go
@@ -15,6 +15,7 @@
 package testutil
 
 import (
+	"context"
 	"fmt"
 	"math/rand"
 	"strconv"
@@ -38,17 +39,26 @@ func NewMheap() *mheap.Mheap {
 }
 
 func NewProcess() *process.Process {
-	hm := host.New(1 << 30)
-	gm := guest.New(1<<30, hm)
-	proc := process.New(mheap.New(gm))
+	return NewProcessWithMheap(NewMheap())
+}
+
+func NewProcessWithMheap(heap *mheap.Mheap) *process.Process {
+	proc := process.New(
+		context.Background(),
+		heap,
+		nil,
+		NewFS(),
+	)
 	proc.Lim.Size = 1 << 20
 	proc.Lim.BatchRows = 1 << 20
 	proc.Lim.BatchSize = 1 << 20
 	proc.Lim.ReaderSize = 1 << 20
-	proc.FileService = NewFS()
+	proc.SessionInfo.TimeZone = time.Local
 	return proc
 }
 
+var NewProc = NewProcess
+
 func NewFS() *fileservice.FileServices {
 	local, err := fileservice.NewMemoryFS("local")
 	if err != nil {