Skip to content
Snippets Groups Projects
Unverified Commit dcfed520 authored by nnsgmsone's avatar nnsgmsone Committed by GitHub
Browse files

Add analyze information (#4070)

parent a1dc0e2d
No related branches found
No related tags found
No related merge requests found
Showing
with 54 additions and 43 deletions
......@@ -234,6 +234,15 @@ func (bat *Batch) Shuffle(sels []int64, m *mheap.Mheap) error {
return nil
}
func (bat *Batch) Size() int {
var size int
for _, vec := range bat.Vecs {
size += len(vec.Data)
}
return size
}
func (bat *Batch) Length() int {
return len(bat.Zs)
}
......
......@@ -73,7 +73,7 @@ func Prepare(proc *process.Process, arg interface{}) error {
return nil
}
func Call(proc *process.Process, arg interface{}) (bool, error) {
func Call(_ int, proc *process.Process, arg interface{}) (bool, error) {
ap := arg.(*Argument)
ctr := ap.ctr
for {
......
......@@ -235,7 +235,7 @@ func TestComplement(t *testing.T) {
tc.proc.Reg.MergeReceivers[1].Ch <- &batch.Batch{}
tc.proc.Reg.MergeReceivers[1].Ch <- nil
for {
if ok, err := Call(tc.proc, tc.arg); ok || err != nil {
if ok, err := Call(0, tc.proc, tc.arg); ok || err != nil {
break
}
tc.proc.Reg.InputBatch.Clean(tc.proc.Mp)
......@@ -282,7 +282,7 @@ func BenchmarkComplement(b *testing.B) {
tc.proc.Reg.MergeReceivers[1].Ch <- &batch.Batch{}
tc.proc.Reg.MergeReceivers[1].Ch <- nil
for {
if ok, err := Call(tc.proc, tc.arg); ok || err != nil {
if ok, err := Call(0, tc.proc, tc.arg); ok || err != nil {
break
}
tc.proc.Reg.InputBatch.Clean(tc.proc.Mp)
......
......@@ -29,7 +29,7 @@ func Prepare(_ *process.Process, _ interface{}) error {
return nil
}
func Call(proc *process.Process, arg interface{}) (bool, error) {
func Call(_ int, proc *process.Process, arg interface{}) (bool, error) {
ap := arg.(*Argument)
reg := ap.Reg
bat := proc.Reg.InputBatch
......
......@@ -80,11 +80,11 @@ func TestConnector(t *testing.T) {
}
}
}
_, _ = Call(tc.proc, tc.arg)
_, _ = Call(0, tc.proc, tc.arg)
tc.proc.Reg.InputBatch = &batch.Batch{}
_, _ = Call(tc.proc, tc.arg)
_, _ = Call(0, tc.proc, tc.arg)
tc.proc.Reg.InputBatch = nil
_, _ = Call(tc.proc, tc.arg)
_, _ = Call(0, tc.proc, tc.arg)
for {
bat := <-tc.arg.Reg.Ch
if bat == nil {
......
......@@ -16,9 +16,10 @@ package deletion
import (
"bytes"
"sync/atomic"
"github.com/matrixorigin/matrixone/pkg/container/batch"
"github.com/matrixorigin/matrixone/pkg/vm/process"
"sync/atomic"
)
func String(arg interface{}, buf *bytes.Buffer) {
......@@ -29,7 +30,7 @@ func Prepare(_ *process.Process, _ interface{}) error {
return nil
}
func Call(proc *process.Process, arg interface{}) (bool, error) {
func Call(_ int, proc *process.Process, arg interface{}) (bool, error) {
p := arg.(*Argument)
bat := proc.Reg.InputBatch
if bat == nil || len(bat.Zs) == 0 {
......
......@@ -32,7 +32,7 @@ func Prepare(_ *process.Process, arg interface{}) error {
return nil
}
func Call(proc *process.Process, arg interface{}) (bool, error) {
func Call(_ int, proc *process.Process, arg interface{}) (bool, error) {
ap := arg.(*Argument)
bat := proc.Reg.InputBatch
if bat == nil {
......
......@@ -81,11 +81,11 @@ func TestDispatch(t *testing.T) {
}
}
}
_, _ = Call(tc.proc, tc.arg)
_, _ = Call(0, tc.proc, tc.arg)
tc.proc.Reg.InputBatch = &batch.Batch{}
_, _ = Call(tc.proc, tc.arg)
_, _ = Call(0, tc.proc, tc.arg)
tc.proc.Reg.InputBatch = nil
_, _ = Call(tc.proc, tc.arg)
_, _ = Call(0, tc.proc, tc.arg)
for {
bat := <-tc.arg.Regs[0].Ch
if bat == nil {
......
......@@ -56,7 +56,7 @@ func Prepare(_ *process.Process, arg interface{}) error {
return nil
}
func Call(proc *process.Process, arg interface{}) (bool, error) {
func Call(_ int, proc *process.Process, arg interface{}) (bool, error) {
ap := arg.(*Argument)
if len(ap.Exprs) == 0 {
return ap.ctr.process(ap, proc)
......
......@@ -109,22 +109,22 @@ func TestGroup(t *testing.T) {
err := Prepare(tc.proc, tc.arg)
require.NoError(t, err)
tc.proc.Reg.InputBatch = newBatch(t, tc.flgs, tc.types, tc.proc, Rows)
_, err = Call(tc.proc, tc.arg)
_, err = Call(0, tc.proc, tc.arg)
require.NoError(t, err)
tc.proc.Reg.InputBatch = newBatch(t, tc.flgs, tc.types, tc.proc, Rows)
_, err = Call(tc.proc, tc.arg)
_, err = Call(0, tc.proc, tc.arg)
require.NoError(t, err)
tc.proc.Reg.InputBatch = &batch.Batch{}
_, err = Call(tc.proc, tc.arg)
_, err = Call(0, tc.proc, tc.arg)
require.NoError(t, err)
tc.proc.Reg.InputBatch = nil
_, err = Call(tc.proc, tc.arg)
_, err = Call(0, tc.proc, tc.arg)
require.NoError(t, err)
if tc.proc.Reg.InputBatch != nil {
tc.proc.Reg.InputBatch.Clean(tc.proc.Mp)
}
tc.proc.Reg.InputBatch = nil
_, err = Call(tc.proc, tc.arg)
_, err = Call(0, tc.proc, tc.arg)
require.NoError(t, err)
require.Equal(t, int64(0), mheap.Size(tc.proc.Mp))
}
......@@ -143,16 +143,16 @@ func BenchmarkGroup(b *testing.B) {
err := Prepare(tc.proc, tc.arg)
require.NoError(t, err)
tc.proc.Reg.InputBatch = newBatch(t, tc.flgs, tc.types, tc.proc, BenchmarkRows)
_, err = Call(tc.proc, tc.arg)
_, err = Call(0, tc.proc, tc.arg)
require.NoError(t, err)
tc.proc.Reg.InputBatch = newBatch(t, tc.flgs, tc.types, tc.proc, BenchmarkRows)
_, err = Call(tc.proc, tc.arg)
_, err = Call(0, tc.proc, tc.arg)
require.NoError(t, err)
tc.proc.Reg.InputBatch = &batch.Batch{}
_, err = Call(tc.proc, tc.arg)
_, err = Call(0, tc.proc, tc.arg)
require.NoError(t, err)
tc.proc.Reg.InputBatch = nil
_, err = Call(tc.proc, tc.arg)
_, err = Call(0, tc.proc, tc.arg)
require.NoError(t, err)
if tc.proc.Reg.InputBatch != nil {
tc.proc.Reg.InputBatch.Clean(tc.proc.Mp)
......
......@@ -17,6 +17,7 @@ package insert
import (
"bytes"
"fmt"
"github.com/matrixorigin/matrixone/pkg/container/nulls"
"github.com/matrixorigin/matrixone/pkg/container/types"
"github.com/matrixorigin/matrixone/pkg/container/vector"
......@@ -42,7 +43,7 @@ func Prepare(_ *process.Process, _ interface{}) error {
return nil
}
func Call(proc *process.Process, arg interface{}) (bool, error) {
func Call(_ int, proc *process.Process, arg interface{}) (bool, error) {
n := arg.(*Argument)
bat := proc.Reg.InputBatch
if bat == nil {
......
......@@ -66,7 +66,7 @@ func TestInsertOperator(t *testing.T) {
},
}
proc.Reg.InputBatch = batch1
_, err := Call(proc, &argument1)
_, err := Call(0, proc, &argument1)
require.NoError(t, err)
println(argument1.TargetTable.(*mockRelation).result.Vecs)
{
......@@ -104,6 +104,6 @@ func TestInsertOperator(t *testing.T) {
},
}
proc.Reg.InputBatch = batch2
_, err2 := Call(proc, &argument2)
_, err2 := Call(0, proc, &argument2)
require.Errorf(t, err2, "should return error when insert null into primary key column")
}
......@@ -83,7 +83,7 @@ func Prepare(proc *process.Process, arg interface{}) error {
return nil
}
func Call(proc *process.Process, arg interface{}) (bool, error) {
func Call(_ int, proc *process.Process, arg interface{}) (bool, error) {
ap := arg.(*Argument)
ctr := ap.ctr
for {
......
......@@ -236,7 +236,7 @@ func TestJoin(t *testing.T) {
tc.proc.Reg.MergeReceivers[1].Ch <- &batch.Batch{}
tc.proc.Reg.MergeReceivers[1].Ch <- nil
for {
if ok, err := Call(tc.proc, tc.arg); ok || err != nil {
if ok, err := Call(0, tc.proc, tc.arg); ok || err != nil {
break
}
tc.proc.Reg.InputBatch.Clean(tc.proc.Mp)
......@@ -283,7 +283,7 @@ func BenchmarkJoin(b *testing.B) {
tc.proc.Reg.MergeReceivers[1].Ch <- &batch.Batch{}
tc.proc.Reg.MergeReceivers[1].Ch <- nil
for {
if ok, err := Call(tc.proc, tc.arg); ok || err != nil {
if ok, err := Call(0, tc.proc, tc.arg); ok || err != nil {
break
}
tc.proc.Reg.InputBatch.Clean(tc.proc.Mp)
......
......@@ -83,7 +83,7 @@ func Prepare(proc *process.Process, arg interface{}) error {
return nil
}
func Call(proc *process.Process, arg interface{}) (bool, error) {
func Call(_ int, proc *process.Process, arg interface{}) (bool, error) {
ap := arg.(*Argument)
ctr := ap.ctr
for {
......
......@@ -236,7 +236,7 @@ func TestJoin(t *testing.T) {
tc.proc.Reg.MergeReceivers[1].Ch <- &batch.Batch{}
tc.proc.Reg.MergeReceivers[1].Ch <- nil
for {
if ok, err := Call(tc.proc, tc.arg); ok || err != nil {
if ok, err := Call(0, tc.proc, tc.arg); ok || err != nil {
break
}
tc.proc.Reg.InputBatch.Clean(tc.proc.Mp)
......@@ -283,7 +283,7 @@ func BenchmarkJoin(b *testing.B) {
tc.proc.Reg.MergeReceivers[1].Ch <- &batch.Batch{}
tc.proc.Reg.MergeReceivers[1].Ch <- nil
for {
if ok, err := Call(tc.proc, tc.arg); ok || err != nil {
if ok, err := Call(0, tc.proc, tc.arg); ok || err != nil {
break
}
tc.proc.Reg.InputBatch.Clean(tc.proc.Mp)
......
......@@ -32,7 +32,7 @@ func Prepare(_ *process.Process, _ interface{}) error {
}
// returning only the first n tuples from its input
func Call(proc *process.Process, arg interface{}) (bool, error) {
func Call(_ int, proc *process.Process, arg interface{}) (bool, error) {
bat := proc.Reg.InputBatch
if bat == nil {
return true, nil
......
......@@ -100,19 +100,19 @@ func TestLimit(t *testing.T) {
err := Prepare(tc.proc, tc.arg)
require.NoError(t, err)
tc.proc.Reg.InputBatch = newBatch(t, tc.types, tc.proc, Rows)
_, _ = Call(tc.proc, tc.arg)
_, _ = Call(0, tc.proc, tc.arg)
if tc.proc.Reg.InputBatch != nil {
tc.proc.Reg.InputBatch.Clean(tc.proc.Mp)
}
tc.proc.Reg.InputBatch = newBatch(t, tc.types, tc.proc, Rows)
_, _ = Call(tc.proc, tc.arg)
_, _ = Call(0, tc.proc, tc.arg)
if tc.proc.Reg.InputBatch != nil {
tc.proc.Reg.InputBatch.Clean(tc.proc.Mp)
}
tc.proc.Reg.InputBatch = &batch.Batch{}
_, _ = Call(tc.proc, tc.arg)
_, _ = Call(0, tc.proc, tc.arg)
tc.proc.Reg.InputBatch = nil
_, _ = Call(tc.proc, tc.arg)
_, _ = Call(0, tc.proc, tc.arg)
require.Equal(t, int64(0), mheap.Size(tc.proc.Mp))
}
}
......@@ -139,14 +139,14 @@ func BenchmarkLimit(b *testing.B) {
err := Prepare(tc.proc, tc.arg)
require.NoError(t, err)
tc.proc.Reg.InputBatch = newBatch(t, tc.types, tc.proc, BenchmarkRows)
_, _ = Call(tc.proc, tc.arg)
_, _ = Call(0, tc.proc, tc.arg)
if tc.proc.Reg.InputBatch != nil {
tc.proc.Reg.InputBatch.Clean(tc.proc.Mp)
}
tc.proc.Reg.InputBatch = &batch.Batch{}
_, _ = Call(tc.proc, tc.arg)
_, _ = Call(0, tc.proc, tc.arg)
tc.proc.Reg.InputBatch = nil
_, _ = Call(tc.proc, tc.arg)
_, _ = Call(0, tc.proc, tc.arg)
}
}
}
......
......@@ -34,7 +34,7 @@ func Prepare(proc *process.Process, arg interface{}) error {
return nil
}
func Call(proc *process.Process, arg interface{}) (bool, error) {
func Call(_ int, proc *process.Process, arg interface{}) (bool, error) {
ap := arg.(*Argument)
ctr := ap.ctr
for {
......
......@@ -87,7 +87,7 @@ func TestJoin(t *testing.T) {
tc.proc.Reg.MergeReceivers[1].Ch <- &batch.Batch{}
tc.proc.Reg.MergeReceivers[1].Ch <- nil
for {
if ok, err := Call(tc.proc, tc.arg); ok || err != nil {
if ok, err := Call(0, tc.proc, tc.arg); ok || err != nil {
break
}
tc.proc.Reg.InputBatch.Clean(tc.proc.Mp)
......@@ -118,7 +118,7 @@ func BenchmarkJoin(b *testing.B) {
tc.proc.Reg.MergeReceivers[1].Ch <- &batch.Batch{}
tc.proc.Reg.MergeReceivers[1].Ch <- nil
for {
if ok, err := Call(tc.proc, tc.arg); ok || err != nil {
if ok, err := Call(0, tc.proc, tc.arg); ok || err != nil {
break
}
tc.proc.Reg.InputBatch.Clean(tc.proc.Mp)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment