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

Support noequi join condition in hash join (#4555)

This pr is used to speed up performance-related things like join conditions like r.a = s.b and r.a > s.b, most typically tpch's q21.

Approved by: @yingfeng, @aunjgr
parent 972b86fa
No related branches found
No related tags found
No related merge requests found
Showing
with 245 additions and 113 deletions
...@@ -25,16 +25,18 @@ import ( ...@@ -25,16 +25,18 @@ import (
func NewUnaryAgg[T1, T2 any](priv any, isCount bool, ityp, otyp types.Type, grows func(int), func NewUnaryAgg[T1, T2 any](priv any, isCount bool, ityp, otyp types.Type, grows func(int),
eval func([]T2) []T2, merge func(int64, int64, T2, T2, bool, bool, any) (T2, bool), eval func([]T2) []T2, merge func(int64, int64, T2, T2, bool, bool, any) (T2, bool),
fill func(int64, T1, T2, int64, bool, bool) (T2, bool)) Agg[*UnaryAgg[T1, T2]] { fill func(int64, T1, T2, int64, bool, bool) (T2, bool),
batchFill func(any, any, int64, int64, []uint64, []int64, *nulls.Nulls) error) Agg[*UnaryAgg[T1, T2]] {
return &UnaryAgg[T1, T2]{ return &UnaryAgg[T1, T2]{
priv: priv, priv: priv,
otyp: otyp, otyp: otyp,
eval: eval, eval: eval,
fill: fill, fill: fill,
merge: merge, merge: merge,
grows: grows, grows: grows,
isCount: isCount, batchFill: batchFill,
ityps: []types.Type{ityp}, isCount: isCount,
ityps: []types.Type{ityp},
} }
} }
...@@ -140,6 +142,24 @@ func (a *UnaryAgg[T1, T2]) BatchFill(start int64, os []uint8, vps []uint64, zs [ ...@@ -140,6 +142,24 @@ func (a *UnaryAgg[T1, T2]) BatchFill(start int64, os []uint8, vps []uint64, zs [
return nil return nil
} }
vs := vector.GetColumn[T1](vec) vs := vector.GetColumn[T1](vec)
if a.batchFill != nil {
if err := a.batchFill(a.vs, vs, start, int64(len(os)), vps, zs, vec.GetNulls()); err != nil {
return err
}
nsp := vec.GetNulls()
if nsp.Any() {
for i := range os {
if !nsp.Contains(uint64(i) + uint64(start)) {
a.es[vps[i]-1] = false
}
}
} else {
for i := range os {
a.es[vps[i]-1] = false
}
}
return nil
}
for i := range os { for i := range os {
hasNull := vec.GetNulls().Contains(uint64(i) + uint64(start)) hasNull := vec.GetNulls().Contains(uint64(i) + uint64(start))
if vps[i] == 0 { if vps[i] == 0 {
......
...@@ -44,7 +44,7 @@ func TestAnyvalue(t *testing.T) { ...@@ -44,7 +44,7 @@ func TestAnyvalue(t *testing.T) {
vec2 := testutil.NewVector(Rows, testTyp, m, false, vs2) vec2 := testutil.NewVector(Rows, testTyp, m, false, vs2)
{ {
// test single agg with Grow & Fill function // test single agg with Grow & Fill function
agg := agg.NewUnaryAgg(a, true, testTyp, testTyp, a.Grows, a.Eval, a.Merge, a.Fill) agg := agg.NewUnaryAgg(a, true, testTyp, testTyp, a.Grows, a.Eval, a.Merge, a.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -57,13 +57,13 @@ func TestAnyvalue(t *testing.T) { ...@@ -57,13 +57,13 @@ func TestAnyvalue(t *testing.T) {
} }
{ {
// test two agg with Merge function // test two agg with Merge function
agg0 := agg.NewUnaryAgg(a2, true, testTyp, testTyp, a2.Grows, a2.Eval, a2.Merge, a2.Fill) agg0 := agg.NewUnaryAgg(a2, true, testTyp, testTyp, a2.Grows, a2.Eval, a2.Merge, a2.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(a3, true, testTyp, testTyp, a3.Grows, a3.Eval, a3.Merge, a3.Fill) agg1 := agg.NewUnaryAgg(a3, true, testTyp, testTyp, a3.Grows, a3.Eval, a3.Merge, a3.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -100,7 +100,7 @@ func TestDecimalAnyva(t *testing.T) { ...@@ -100,7 +100,7 @@ func TestDecimalAnyva(t *testing.T) {
vec2 := testutil.MakeDecimal128Vector(input2, nil, testTyp) vec2 := testutil.MakeDecimal128Vector(input2, nil, testTyp)
{ {
// test single agg with Grow & Fill function // test single agg with Grow & Fill function
agg := agg.NewUnaryAgg(da, true, testTyp, testTyp, da.Grows, da.Eval, da.Merge, da.Fill) agg := agg.NewUnaryAgg(da, true, testTyp, testTyp, da.Grows, da.Eval, da.Merge, da.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -113,13 +113,13 @@ func TestDecimalAnyva(t *testing.T) { ...@@ -113,13 +113,13 @@ func TestDecimalAnyva(t *testing.T) {
} }
{ {
// test two agg with Merge function // test two agg with Merge function
agg0 := agg.NewUnaryAgg(da2, true, testTyp, testTyp, da2.Grows, da2.Eval, da2.Merge, da2.Fill) agg0 := agg.NewUnaryAgg(da2, true, testTyp, testTyp, da2.Grows, da2.Eval, da2.Merge, da2.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(da3, true, testTyp, testTyp, da3.Grows, da3.Eval, da3.Merge, da3.Fill) agg1 := agg.NewUnaryAgg(da3, true, testTyp, testTyp, da3.Grows, da3.Eval, da3.Merge, da3.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
......
...@@ -41,7 +41,7 @@ func TestApproxcdCount(t *testing.T) { ...@@ -41,7 +41,7 @@ func TestApproxcdCount(t *testing.T) {
vec2 := testutil.NewVector(Rows, testTyp, m, false, vs2) vec2 := testutil.NewVector(Rows, testTyp, m, false, vs2)
{ {
a := NewApproxc[int8]() a := NewApproxc[int8]()
agg := agg.NewUnaryAgg(a, true, testTyp, retTyp, a.Grows, a.Eval, a.Merge, a.Fill) agg := agg.NewUnaryAgg(a, true, testTyp, retTyp, a.Grows, a.Eval, a.Merge, a.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -55,13 +55,13 @@ func TestApproxcdCount(t *testing.T) { ...@@ -55,13 +55,13 @@ func TestApproxcdCount(t *testing.T) {
{ {
a1 := NewApproxc[int8]() a1 := NewApproxc[int8]()
a2 := NewApproxc[int8]() a2 := NewApproxc[int8]()
agg0 := agg.NewUnaryAgg(a1, true, testTyp, retTyp, a1.Grows, a1.Eval, a1.Merge, a1.Fill) agg0 := agg.NewUnaryAgg(a1, true, testTyp, retTyp, a1.Grows, a1.Eval, a1.Merge, a1.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(a2, true, testTyp, retTyp, a2.Grows, a2.Eval, a2.Merge, a2.Fill) agg1 := agg.NewUnaryAgg(a2, true, testTyp, retTyp, a2.Grows, a2.Eval, a2.Merge, a2.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
......
...@@ -15,7 +15,9 @@ ...@@ -15,7 +15,9 @@
package avg package avg
import ( import (
"github.com/matrixorigin/matrixone/pkg/container/nulls"
"github.com/matrixorigin/matrixone/pkg/container/types" "github.com/matrixorigin/matrixone/pkg/container/types"
"github.com/matrixorigin/matrixone/pkg/vectorize/sum"
) )
func ReturnType(typs []types.Type) types.Type { func ReturnType(typs []types.Type) types.Type {
...@@ -112,6 +114,19 @@ func (a *Decimal64Avg) Merge(xIndex int64, yIndex int64, x types.Decimal128, y t ...@@ -112,6 +114,19 @@ func (a *Decimal64Avg) Merge(xIndex int64, yIndex int64, x types.Decimal128, y t
return x, xEmpty return x, xEmpty
} }
func (a *Decimal64Avg) BatchFill(rs, vs any, start, count int64, vps []uint64, zs []int64, nsp *nulls.Nulls) error {
if err := sum.Decimal64Sum128(rs.([]types.Decimal128), vs.([]types.Decimal64), start, count, vps, zs, nsp); err != nil {
return err
}
for i := int64(0); i < count; i++ {
if nsp.Contains(uint64(i + start)) {
continue
}
j := vps[i] - 1
a.cnts[j] += zs[j]
}
return nil
}
func NewD128Avg() *Decimal128Avg { func NewD128Avg() *Decimal128Avg {
return &Decimal128Avg{} return &Decimal128Avg{}
} }
...@@ -149,3 +164,17 @@ func (a *Decimal128Avg) Merge(xIndex int64, yIndex int64, x types.Decimal128, y ...@@ -149,3 +164,17 @@ func (a *Decimal128Avg) Merge(xIndex int64, yIndex int64, x types.Decimal128, y
return x, xEmpty return x, xEmpty
} }
func (a *Decimal128Avg) BatchFill(rs, vs any, start, count int64, vps []uint64, zs []int64, nsp *nulls.Nulls) error {
if err := sum.Decimal128Sum(rs.([]types.Decimal128), vs.([]types.Decimal128), start, count, vps, zs, nsp); err != nil {
return err
}
for i := int64(0); i < count; i++ {
if nsp.Contains(uint64(i + start)) {
continue
}
j := vps[i] - 1
a.cnts[j] += zs[j]
}
return nil
}
...@@ -47,7 +47,7 @@ func TestAvg(t *testing.T) { ...@@ -47,7 +47,7 @@ func TestAvg(t *testing.T) {
expected2 := []float64{14.5} expected2 := []float64{14.5}
{ {
// test single agg with Grow & Fill function // test single agg with Grow & Fill function
agg := agg.NewUnaryAgg(a1, true, testTyp, retTyp, a1.Grows, a1.Eval, a1.Merge, a1.Fill) agg := agg.NewUnaryAgg(a1, true, testTyp, retTyp, a1.Grows, a1.Eval, a1.Merge, a1.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -60,13 +60,13 @@ func TestAvg(t *testing.T) { ...@@ -60,13 +60,13 @@ func TestAvg(t *testing.T) {
} }
{ {
// test two agg with Merge function // test two agg with Merge function
agg0 := agg.NewUnaryAgg(a2, true, testTyp, retTyp, a2.Grows, a2.Eval, a2.Merge, a2.Fill) agg0 := agg.NewUnaryAgg(a2, true, testTyp, retTyp, a2.Grows, a2.Eval, a2.Merge, a2.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec1}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec1})
} }
agg1 := agg.NewUnaryAgg(a3, true, testTyp, retTyp, a3.Grows, a3.Eval, a3.Merge, a3.Fill) agg1 := agg.NewUnaryAgg(a3, true, testTyp, retTyp, a3.Grows, a3.Eval, a3.Merge, a3.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -103,7 +103,7 @@ func TestDecimal128Avg(t *testing.T) { ...@@ -103,7 +103,7 @@ func TestDecimal128Avg(t *testing.T) {
vec2 := testutil.MakeDecimal128Vector(input2, nil, testTyp) vec2 := testutil.MakeDecimal128Vector(input2, nil, testTyp)
{ {
// test single agg with Grow & Fill function // test single agg with Grow & Fill function
agg := agg.NewUnaryAgg(a1, true, testTyp, testTyp, a1.Grows, a1.Eval, a1.Merge, a1.Fill) agg := agg.NewUnaryAgg(a1, true, testTyp, testTyp, a1.Grows, a1.Eval, a1.Merge, a1.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -116,13 +116,13 @@ func TestDecimal128Avg(t *testing.T) { ...@@ -116,13 +116,13 @@ func TestDecimal128Avg(t *testing.T) {
} }
{ {
// test two agg with Merge function // test two agg with Merge function
agg0 := agg.NewUnaryAgg(a2, true, testTyp, testTyp, a2.Grows, a2.Eval, a2.Merge, a2.Fill) agg0 := agg.NewUnaryAgg(a2, true, testTyp, testTyp, a2.Grows, a2.Eval, a2.Merge, a2.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(a3, true, testTyp, testTyp, a3.Grows, a3.Eval, a3.Merge, a3.Fill) agg1 := agg.NewUnaryAgg(a3, true, testTyp, testTyp, a3.Grows, a3.Eval, a3.Merge, a3.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
......
...@@ -36,7 +36,7 @@ func TestBitAnd(t *testing.T) { ...@@ -36,7 +36,7 @@ func TestBitAnd(t *testing.T) {
m := mheap.New(guest.New(1<<30, host.New(1<<30))) m := mheap.New(guest.New(1<<30, host.New(1<<30)))
vec := testutil.NewVector(Rows, types.New(types.T_int8, 0, 0, 0), m, false, nil) vec := testutil.NewVector(Rows, types.New(types.T_int8, 0, 0, 0), m, false, nil)
{ {
agg := agg.NewUnaryAgg(ba, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_uint64, 0, 0, 0), ba.Grows, ba.Eval, ba.Merge, ba.Fill) agg := agg.NewUnaryAgg(ba, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_uint64, 0, 0, 0), ba.Grows, ba.Eval, ba.Merge, ba.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -48,13 +48,13 @@ func TestBitAnd(t *testing.T) { ...@@ -48,13 +48,13 @@ func TestBitAnd(t *testing.T) {
v.Free(m) v.Free(m)
} }
{ {
agg0 := agg.NewUnaryAgg(ba, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_uint64, 0, 0, 0), ba.Grows, ba.Eval, ba.Merge, ba.Fill) agg0 := agg.NewUnaryAgg(ba, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_uint64, 0, 0, 0), ba.Grows, ba.Eval, ba.Merge, ba.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(ba, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_uint64, 0, 0, 0), ba.Grows, ba.Eval, ba.Merge, ba.Fill) agg1 := agg.NewUnaryAgg(ba, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_uint64, 0, 0, 0), ba.Grows, ba.Eval, ba.Merge, ba.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
......
...@@ -36,7 +36,7 @@ func TestBitOr(t *testing.T) { ...@@ -36,7 +36,7 @@ func TestBitOr(t *testing.T) {
m := mheap.New(guest.New(1<<30, host.New(1<<30))) m := mheap.New(guest.New(1<<30, host.New(1<<30)))
vec := testutil.NewVector(Rows, types.New(types.T_int8, 0, 0, 0), m, false, nil) vec := testutil.NewVector(Rows, types.New(types.T_int8, 0, 0, 0), m, false, nil)
{ {
agg := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), bo.Grows, bo.Eval, bo.Merge, bo.Fill) agg := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), bo.Grows, bo.Eval, bo.Merge, bo.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -49,7 +49,7 @@ func TestBitOr(t *testing.T) { ...@@ -49,7 +49,7 @@ func TestBitOr(t *testing.T) {
} }
{ {
vec0 := testutil.NewVector(2, types.New(types.T_int8, 0, 0, 0), m, false, []int8{2, 2}) vec0 := testutil.NewVector(2, types.New(types.T_int8, 0, 0, 0), m, false, []int8{2, 2})
agg := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), bo.Grows, bo.Eval, bo.Merge, bo.Fill) agg := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), bo.Grows, bo.Eval, bo.Merge, bo.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
agg.Fill(0, int64(0), 2, []*vector.Vector{vec0}) agg.Fill(0, int64(0), 2, []*vector.Vector{vec0})
...@@ -61,13 +61,13 @@ func TestBitOr(t *testing.T) { ...@@ -61,13 +61,13 @@ func TestBitOr(t *testing.T) {
vec0.Free(m) vec0.Free(m)
} }
{ {
agg0 := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), bo.Grows, bo.Eval, bo.Merge, bo.Fill) agg0 := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), bo.Grows, bo.Eval, bo.Merge, bo.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), bo.Grows, bo.Eval, bo.Merge, bo.Fill) agg1 := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), bo.Grows, bo.Eval, bo.Merge, bo.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
......
...@@ -36,7 +36,7 @@ func TestBitXor(t *testing.T) { ...@@ -36,7 +36,7 @@ func TestBitXor(t *testing.T) {
m := mheap.New(guest.New(1<<30, host.New(1<<30))) m := mheap.New(guest.New(1<<30, host.New(1<<30)))
vec := testutil.NewVector(Rows, types.New(types.T_int8, 0, 0, 0), m, false, nil) vec := testutil.NewVector(Rows, types.New(types.T_int8, 0, 0, 0), m, false, nil)
{ {
agg := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), bx.Grows, bx.Eval, bx.Merge, bx.Fill) agg := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), bx.Grows, bx.Eval, bx.Merge, bx.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -49,7 +49,7 @@ func TestBitXor(t *testing.T) { ...@@ -49,7 +49,7 @@ func TestBitXor(t *testing.T) {
} }
{ {
vec0 := testutil.NewVector(2, types.New(types.T_int8, 0, 0, 0), m, false, []int8{2, 2}) vec0 := testutil.NewVector(2, types.New(types.T_int8, 0, 0, 0), m, false, []int8{2, 2})
agg := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), bx.Grows, bx.Eval, bx.Merge, bx.Fill) agg := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), bx.Grows, bx.Eval, bx.Merge, bx.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
agg.Fill(0, int64(0), 2, []*vector.Vector{vec0}) agg.Fill(0, int64(0), 2, []*vector.Vector{vec0})
...@@ -62,7 +62,7 @@ func TestBitXor(t *testing.T) { ...@@ -62,7 +62,7 @@ func TestBitXor(t *testing.T) {
} }
{ {
vec0 := testutil.NewVector(3, types.New(types.T_int8, 0, 0, 0), m, false, []int8{1, 2, 2}) vec0 := testutil.NewVector(3, types.New(types.T_int8, 0, 0, 0), m, false, []int8{1, 2, 2})
agg := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), bx.Grows, bx.Eval, bx.Merge, bx.Fill) agg := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), bx.Grows, bx.Eval, bx.Merge, bx.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
agg.Fill(0, int64(0), 1, []*vector.Vector{vec0}) agg.Fill(0, int64(0), 1, []*vector.Vector{vec0})
...@@ -75,13 +75,13 @@ func TestBitXor(t *testing.T) { ...@@ -75,13 +75,13 @@ func TestBitXor(t *testing.T) {
vec0.Free(m) vec0.Free(m)
} }
{ {
agg0 := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), bx.Grows, bx.Eval, bx.Merge, bx.Fill) agg0 := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), bx.Grows, bx.Eval, bx.Merge, bx.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), bx.Grows, bx.Eval, bx.Merge, bx.Fill) agg1 := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), bx.Grows, bx.Eval, bx.Merge, bx.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
......
...@@ -36,7 +36,7 @@ func TestCount(t *testing.T) { ...@@ -36,7 +36,7 @@ func TestCount(t *testing.T) {
m := mheap.New(guest.New(1<<30, host.New(1<<30))) m := mheap.New(guest.New(1<<30, host.New(1<<30)))
vec := testutil.NewVector(Rows, types.New(types.T_int8, 0, 0, 0), m, true, nil) vec := testutil.NewVector(Rows, types.New(types.T_int8, 0, 0, 0), m, true, nil)
{ {
agg := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), c.Grows, c.Eval, c.Merge, c.Fill) agg := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), c.Grows, c.Eval, c.Merge, c.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -48,13 +48,13 @@ func TestCount(t *testing.T) { ...@@ -48,13 +48,13 @@ func TestCount(t *testing.T) {
v.Free(m) v.Free(m)
} }
{ {
agg0 := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), c.Grows, c.Eval, c.Merge, c.Fill) agg0 := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), c.Grows, c.Eval, c.Merge, c.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), c.Grows, c.Eval, c.Merge, c.Fill) agg1 := agg.NewUnaryAgg(nil, true, types.New(types.T_int8, 0, 0, 0), types.New(types.T_int64, 0, 0, 0), c.Grows, c.Eval, c.Merge, c.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
......
...@@ -43,7 +43,7 @@ func TestMax(t *testing.T) { ...@@ -43,7 +43,7 @@ func TestMax(t *testing.T) {
vec2 := testutil.NewVector(Rows, testTyp, m, false, vs2) vec2 := testutil.NewVector(Rows, testTyp, m, false, vs2)
{ {
// test single agg with Grow & Fill function // test single agg with Grow & Fill function
agg := agg.NewUnaryAgg(nil, true, testTyp, testTyp, mx.Grows, mx.Eval, mx.Merge, mx.Fill) agg := agg.NewUnaryAgg(nil, true, testTyp, testTyp, mx.Grows, mx.Eval, mx.Merge, mx.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -56,13 +56,13 @@ func TestMax(t *testing.T) { ...@@ -56,13 +56,13 @@ func TestMax(t *testing.T) {
} }
{ {
// test two agg with Merge function // test two agg with Merge function
agg0 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, mx.Grows, mx.Eval, mx.Merge, mx.Fill) agg0 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, mx.Grows, mx.Eval, mx.Merge, mx.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, mx.Grows, mx.Eval, mx.Merge, mx.Fill) agg1 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, mx.Grows, mx.Eval, mx.Merge, mx.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -97,7 +97,7 @@ func TestDecimalMax(t *testing.T) { ...@@ -97,7 +97,7 @@ func TestDecimalMax(t *testing.T) {
vec2 := testutil.MakeDecimal128Vector(input2, nil, testTyp) vec2 := testutil.MakeDecimal128Vector(input2, nil, testTyp)
{ {
// test single agg with Grow & Fill function // test single agg with Grow & Fill function
agg := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmx.Grows, dmx.Eval, dmx.Merge, dmx.Fill) agg := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmx.Grows, dmx.Eval, dmx.Merge, dmx.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -110,13 +110,13 @@ func TestDecimalMax(t *testing.T) { ...@@ -110,13 +110,13 @@ func TestDecimalMax(t *testing.T) {
} }
{ {
// test two agg with Merge function // test two agg with Merge function
agg0 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmx.Grows, dmx.Eval, dmx.Merge, dmx.Fill) agg0 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmx.Grows, dmx.Eval, dmx.Merge, dmx.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmx.Grows, dmx.Eval, dmx.Merge, dmx.Fill) agg1 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmx.Grows, dmx.Eval, dmx.Merge, dmx.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -151,7 +151,7 @@ func TestBoollMax(t *testing.T) { ...@@ -151,7 +151,7 @@ func TestBoollMax(t *testing.T) {
vec2 := testutil.MakeBoolVector(input2) vec2 := testutil.MakeBoolVector(input2)
{ {
// test single agg with Grow & Fill function // test single agg with Grow & Fill function
agg := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmx.Grows, dmx.Eval, dmx.Merge, dmx.Fill) agg := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmx.Grows, dmx.Eval, dmx.Merge, dmx.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -164,13 +164,13 @@ func TestBoollMax(t *testing.T) { ...@@ -164,13 +164,13 @@ func TestBoollMax(t *testing.T) {
} }
{ {
// test two agg with Merge function // test two agg with Merge function
agg0 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmx.Grows, dmx.Eval, dmx.Merge, dmx.Fill) agg0 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmx.Grows, dmx.Eval, dmx.Merge, dmx.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmx.Grows, dmx.Eval, dmx.Merge, dmx.Fill) agg1 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmx.Grows, dmx.Eval, dmx.Merge, dmx.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -205,7 +205,7 @@ func TestStrlMax(t *testing.T) { ...@@ -205,7 +205,7 @@ func TestStrlMax(t *testing.T) {
vec2 := testutil.MakeVarcharVector(input2, nil) vec2 := testutil.MakeVarcharVector(input2, nil)
{ {
// test single agg with Grow & Fill function // test single agg with Grow & Fill function
agg := agg.NewUnaryAgg(nil, true, testTyp, testTyp, smx.Grows, smx.Eval, smx.Merge, smx.Fill) agg := agg.NewUnaryAgg(nil, true, testTyp, testTyp, smx.Grows, smx.Eval, smx.Merge, smx.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -218,13 +218,13 @@ func TestStrlMax(t *testing.T) { ...@@ -218,13 +218,13 @@ func TestStrlMax(t *testing.T) {
} }
{ {
// test two agg with Merge function // test two agg with Merge function
agg0 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, smx.Grows, smx.Eval, smx.Merge, smx.Fill) agg0 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, smx.Grows, smx.Eval, smx.Merge, smx.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, smx.Grows, smx.Eval, smx.Merge, smx.Fill) agg1 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, smx.Grows, smx.Eval, smx.Merge, smx.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
......
...@@ -44,7 +44,7 @@ func TestMin(t *testing.T) { ...@@ -44,7 +44,7 @@ func TestMin(t *testing.T) {
vec2 := testutil.NewVector(Rows, testTyp, m, false, vs2) vec2 := testutil.NewVector(Rows, testTyp, m, false, vs2)
{ {
// test single agg with Grow & Fill function // test single agg with Grow & Fill function
agg := agg.NewUnaryAgg(nil, true, testTyp, testTyp, mn.Grows, mn.Eval, mn.Merge, mn.Fill) agg := agg.NewUnaryAgg(nil, true, testTyp, testTyp, mn.Grows, mn.Eval, mn.Merge, mn.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -57,13 +57,13 @@ func TestMin(t *testing.T) { ...@@ -57,13 +57,13 @@ func TestMin(t *testing.T) {
} }
{ {
// test two agg with Merge function // test two agg with Merge function
agg0 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, mn2.Grows, mn2.Eval, mn2.Merge, mn2.Fill) agg0 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, mn2.Grows, mn2.Eval, mn2.Merge, mn2.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, mn3.Grows, mn3.Eval, mn3.Merge, mn3.Fill) agg1 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, mn3.Grows, mn3.Eval, mn3.Merge, mn3.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -98,7 +98,7 @@ func TestDecimalMin(t *testing.T) { ...@@ -98,7 +98,7 @@ func TestDecimalMin(t *testing.T) {
vec2 := testutil.MakeDecimal128Vector(input2, nil, testTyp) vec2 := testutil.MakeDecimal128Vector(input2, nil, testTyp)
{ {
// test single agg with Grow & Fill function // test single agg with Grow & Fill function
agg := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmn.Grows, dmn.Eval, dmn.Merge, dmn.Fill) agg := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmn.Grows, dmn.Eval, dmn.Merge, dmn.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -111,13 +111,13 @@ func TestDecimalMin(t *testing.T) { ...@@ -111,13 +111,13 @@ func TestDecimalMin(t *testing.T) {
} }
{ {
// test two agg with Merge function // test two agg with Merge function
agg0 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmn.Grows, dmn.Eval, dmn.Merge, dmn.Fill) agg0 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmn.Grows, dmn.Eval, dmn.Merge, dmn.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmn.Grows, dmn.Eval, dmn.Merge, dmn.Fill) agg1 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmn.Grows, dmn.Eval, dmn.Merge, dmn.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -152,7 +152,7 @@ func TestBoollMin(t *testing.T) { ...@@ -152,7 +152,7 @@ func TestBoollMin(t *testing.T) {
vec2 := testutil.MakeBoolVector(input2) vec2 := testutil.MakeBoolVector(input2)
{ {
// test single agg with Grow & Fill function // test single agg with Grow & Fill function
agg := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmn.Grows, dmn.Eval, dmn.Merge, dmn.Fill) agg := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmn.Grows, dmn.Eval, dmn.Merge, dmn.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -165,13 +165,13 @@ func TestBoollMin(t *testing.T) { ...@@ -165,13 +165,13 @@ func TestBoollMin(t *testing.T) {
} }
{ {
// test two agg with Merge function // test two agg with Merge function
agg0 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmn.Grows, dmn.Eval, dmn.Merge, dmn.Fill) agg0 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmn.Grows, dmn.Eval, dmn.Merge, dmn.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmn.Grows, dmn.Eval, dmn.Merge, dmn.Fill) agg1 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, dmn.Grows, dmn.Eval, dmn.Merge, dmn.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -206,7 +206,7 @@ func TestStrlMin(t *testing.T) { ...@@ -206,7 +206,7 @@ func TestStrlMin(t *testing.T) {
vec2 := testutil.MakeVarcharVector(input2, nil) vec2 := testutil.MakeVarcharVector(input2, nil)
{ {
// test single agg with Grow & Fill function // test single agg with Grow & Fill function
agg := agg.NewUnaryAgg(nil, true, testTyp, testTyp, smn.Grows, smn.Eval, smn.Merge, smn.Fill) agg := agg.NewUnaryAgg(nil, true, testTyp, testTyp, smn.Grows, smn.Eval, smn.Merge, smn.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -219,13 +219,13 @@ func TestStrlMin(t *testing.T) { ...@@ -219,13 +219,13 @@ func TestStrlMin(t *testing.T) {
} }
{ {
// test two agg with Merge function // test two agg with Merge function
agg0 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, smn.Grows, smn.Eval, smn.Merge, smn.Fill) agg0 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, smn.Grows, smn.Eval, smn.Merge, smn.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, smn.Grows, smn.Eval, smn.Merge, smn.Fill) agg1 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, smn.Grows, smn.Eval, smn.Merge, smn.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
......
...@@ -39,7 +39,7 @@ func TestStddevpop(t *testing.T) { ...@@ -39,7 +39,7 @@ func TestStddevpop(t *testing.T) {
m := mheap.New(guest.New(1<<30, host.New(1<<30))) m := mheap.New(guest.New(1<<30, host.New(1<<30)))
vec := testutil.NewVector(Rows, inputType, m, false, nil) vec := testutil.NewVector(Rows, inputType, m, false, nil)
{ {
agg := agg.NewUnaryAgg(sdp1, true, inputType, types.New(types.T_float64, 0, 0, 0), sdp1.Grows, sdp1.Eval, sdp1.Merge, sdp1.Fill) agg := agg.NewUnaryAgg(sdp1, true, inputType, types.New(types.T_float64, 0, 0, 0), sdp1.Grows, sdp1.Eval, sdp1.Merge, sdp1.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -51,13 +51,13 @@ func TestStddevpop(t *testing.T) { ...@@ -51,13 +51,13 @@ func TestStddevpop(t *testing.T) {
v.Free(m) v.Free(m)
} }
{ {
agg0 := agg.NewUnaryAgg(sdp2, true, inputType, types.New(types.T_float64, 0, 0, 0), sdp2.Grows, sdp2.Eval, sdp2.Merge, sdp2.Fill) agg0 := agg.NewUnaryAgg(sdp2, true, inputType, types.New(types.T_float64, 0, 0, 0), sdp2.Grows, sdp2.Eval, sdp2.Merge, sdp2.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(sdp3, true, inputType, types.New(types.T_float64, 0, 0, 0), sdp3.Grows, sdp3.Eval, sdp3.Merge, sdp3.Fill) agg1 := agg.NewUnaryAgg(sdp3, true, inputType, types.New(types.T_float64, 0, 0, 0), sdp3.Grows, sdp3.Eval, sdp3.Merge, sdp3.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
......
...@@ -17,7 +17,9 @@ package sum ...@@ -17,7 +17,9 @@ package sum
import ( import (
"fmt" "fmt"
"github.com/matrixorigin/matrixone/pkg/container/nulls"
"github.com/matrixorigin/matrixone/pkg/container/types" "github.com/matrixorigin/matrixone/pkg/container/types"
"github.com/matrixorigin/matrixone/pkg/vectorize/sum"
) )
func ReturnType(typs []types.Type) types.Type { func ReturnType(typs []types.Type) types.Type {
...@@ -93,6 +95,10 @@ func (s *Decimal64Sum) Merge(_ int64, _ int64, x types.Decimal64, y types.Decima ...@@ -93,6 +95,10 @@ func (s *Decimal64Sum) Merge(_ int64, _ int64, x types.Decimal64, y types.Decima
return x, xEmpty return x, xEmpty
} }
func (s *Decimal64Sum) BatchFill(rs, vs any, start, count int64, vps []uint64, zs []int64, nsp *nulls.Nulls) error {
return sum.Decimal64Sum(rs.([]types.Decimal64), vs.([]types.Decimal64), start, count, vps, zs, nsp)
}
func NewD128Sum() *Decimal128Sum { func NewD128Sum() *Decimal128Sum {
return &Decimal128Sum{} return &Decimal128Sum{}
} }
...@@ -120,3 +126,7 @@ func (s *Decimal128Sum) Merge(_ int64, _ int64, x types.Decimal128, y types.Deci ...@@ -120,3 +126,7 @@ func (s *Decimal128Sum) Merge(_ int64, _ int64, x types.Decimal128, y types.Deci
} }
return x, xEmpty return x, xEmpty
} }
func (s *Decimal128Sum) BatchFill(rs, vs any, start, count int64, vps []uint64, zs []int64, nsp *nulls.Nulls) error {
return sum.Decimal128Sum(rs.([]types.Decimal128), vs.([]types.Decimal128), start, count, vps, zs, nsp)
}
...@@ -41,7 +41,7 @@ func TestSum(t *testing.T) { ...@@ -41,7 +41,7 @@ func TestSum(t *testing.T) {
expected := []int64{45} expected := []int64{45}
{ {
// test single agg with Grow & Fill function // test single agg with Grow & Fill function
agg := agg.NewUnaryAgg(nil, true, testTyp, types.New(types.T_int64, 0, 0, 0), s.Grows, s.Eval, s.Merge, s.Fill) agg := agg.NewUnaryAgg(nil, true, testTyp, types.New(types.T_int64, 0, 0, 0), s.Grows, s.Eval, s.Merge, s.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -54,13 +54,13 @@ func TestSum(t *testing.T) { ...@@ -54,13 +54,13 @@ func TestSum(t *testing.T) {
} }
{ {
// test two agg with Merge function // test two agg with Merge function
agg0 := agg.NewUnaryAgg(nil, true, testTyp, types.New(types.T_int64, 0, 0, 0), s.Grows, s.Eval, s.Merge, s.Fill) agg0 := agg.NewUnaryAgg(nil, true, testTyp, types.New(types.T_int64, 0, 0, 0), s.Grows, s.Eval, s.Merge, s.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(nil, true, testTyp, types.New(types.T_int64, 0, 0, 0), s.Grows, s.Eval, s.Merge, s.Fill) agg1 := agg.NewUnaryAgg(nil, true, testTyp, types.New(types.T_int64, 0, 0, 0), s.Grows, s.Eval, s.Merge, s.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -92,7 +92,7 @@ func TestDecimal128Sum(t *testing.T) { ...@@ -92,7 +92,7 @@ func TestDecimal128Sum(t *testing.T) {
vec := testutil.MakeDecimal128Vector(input1, nil, testTyp) vec := testutil.MakeDecimal128Vector(input1, nil, testTyp)
{ {
// test single agg with Grow & Fill function // test single agg with Grow & Fill function
agg := agg.NewUnaryAgg(nil, true, testTyp, testTyp, ds.Grows, ds.Eval, ds.Merge, ds.Fill) agg := agg.NewUnaryAgg(nil, true, testTyp, testTyp, ds.Grows, ds.Eval, ds.Merge, ds.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -105,13 +105,13 @@ func TestDecimal128Sum(t *testing.T) { ...@@ -105,13 +105,13 @@ func TestDecimal128Sum(t *testing.T) {
} }
{ {
// test two agg with Merge function // test two agg with Merge function
agg0 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, ds.Grows, ds.Eval, ds.Merge, ds.Fill) agg0 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, ds.Grows, ds.Eval, ds.Merge, ds.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, ds.Grows, ds.Eval, ds.Merge, ds.Fill) agg1 := agg.NewUnaryAgg(nil, true, testTyp, testTyp, ds.Grows, ds.Eval, ds.Merge, ds.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
......
...@@ -16,6 +16,7 @@ package agg ...@@ -16,6 +16,7 @@ package agg
import ( import (
"github.com/matrixorigin/matrixone/pkg/common/hashmap" "github.com/matrixorigin/matrixone/pkg/common/hashmap"
"github.com/matrixorigin/matrixone/pkg/container/nulls"
"github.com/matrixorigin/matrixone/pkg/container/types" "github.com/matrixorigin/matrixone/pkg/container/types"
"github.com/matrixorigin/matrixone/pkg/container/vector" "github.com/matrixorigin/matrixone/pkg/container/vector"
"github.com/matrixorigin/matrixone/pkg/vm/mheap" "github.com/matrixorigin/matrixone/pkg/vm/mheap"
...@@ -116,6 +117,9 @@ type UnaryAgg[T1, T2 any] struct { ...@@ -116,6 +117,9 @@ type UnaryAgg[T1, T2 any] struct {
// fifth represents whether it is a new group // fifth represents whether it is a new group
// sixth represents whether the value to be fed is null // sixth represents whether the value to be fed is null
fill func(int64, T1, T2, int64, bool, bool) (T2, bool) fill func(int64, T1, T2, int64, bool, bool) (T2, bool)
// Optional optimisation function for functions where cgo is used in a single pass.
batchFill func(any, any, int64, int64, []uint64, []int64, *nulls.Nulls) error
} }
// UnaryDistAgg generic aggregation function with one input vector and with distinct // UnaryDistAgg generic aggregation function with one input vector and with distinct
......
...@@ -39,7 +39,7 @@ func TestVariance(t *testing.T) { ...@@ -39,7 +39,7 @@ func TestVariance(t *testing.T) {
m := mheap.New(guest.New(1<<30, host.New(1<<30))) m := mheap.New(guest.New(1<<30, host.New(1<<30)))
vec := testutil.NewVector(Rows, inputType, m, false, nil) vec := testutil.NewVector(Rows, inputType, m, false, nil)
{ {
agg := agg.NewUnaryAgg(variance1, true, inputType, types.New(types.T_float64, 0, 0, 0), variance1.Grows, variance1.Eval, variance1.Merge, variance1.Fill) agg := agg.NewUnaryAgg(variance1, true, inputType, types.New(types.T_float64, 0, 0, 0), variance1.Grows, variance1.Eval, variance1.Merge, variance1.Fill, nil)
err := agg.Grows(1, m) err := agg.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
...@@ -51,13 +51,13 @@ func TestVariance(t *testing.T) { ...@@ -51,13 +51,13 @@ func TestVariance(t *testing.T) {
v.Free(m) v.Free(m)
} }
{ {
agg0 := agg.NewUnaryAgg(variance2, true, inputType, types.New(types.T_float64, 0, 0, 0), variance2.Grows, variance2.Eval, variance2.Merge, variance2.Fill) agg0 := agg.NewUnaryAgg(variance2, true, inputType, types.New(types.T_float64, 0, 0, 0), variance2.Grows, variance2.Eval, variance2.Merge, variance2.Fill, nil)
err := agg0.Grows(1, m) err := agg0.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
agg0.Fill(0, int64(i), 1, []*vector.Vector{vec}) agg0.Fill(0, int64(i), 1, []*vector.Vector{vec})
} }
agg1 := agg.NewUnaryAgg(variance3, true, inputType, types.New(types.T_float64, 0, 0, 0), variance3.Grows, variance3.Eval, variance3.Merge, variance3.Fill) agg1 := agg.NewUnaryAgg(variance3, true, inputType, types.New(types.T_float64, 0, 0, 0), variance3.Grows, variance3.Eval, variance3.Merge, variance3.Fill, nil)
err = agg1.Grows(1, m) err = agg1.Grows(1, m)
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < Rows; i++ { for i := 0; i < Rows; i++ {
......
...@@ -213,13 +213,13 @@ func NewAvg(typ types.Type, dist bool) agg.Agg[any] { ...@@ -213,13 +213,13 @@ func NewAvg(typ types.Type, dist bool) agg.Agg[any] {
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, avg.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, avg.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, avg.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, avg.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, aggPriv.BatchFill)
case types.T_decimal128: case types.T_decimal128:
aggPriv := avg.NewD128Avg() aggPriv := avg.NewD128Avg()
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, avg.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, avg.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, avg.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, avg.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, aggPriv.BatchFill)
} }
panic(fmt.Errorf("unsupport type '%s' for avg", typ)) panic(fmt.Errorf("unsupport type '%s' for avg", typ))
} }
...@@ -251,13 +251,13 @@ func NewSum(typ types.Type, dist bool) agg.Agg[any] { ...@@ -251,13 +251,13 @@ func NewSum(typ types.Type, dist bool) agg.Agg[any] {
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, sum.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, sum.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, sum.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, sum.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, aggPriv.BatchFill)
case types.T_decimal128: case types.T_decimal128:
aggPriv := sum.NewD128Sum() aggPriv := sum.NewD128Sum()
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, sum.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, sum.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, sum.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, sum.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, aggPriv.BatchFill)
} }
panic(fmt.Errorf("unsupport type '%s' for sum", typ)) panic(fmt.Errorf("unsupport type '%s' for sum", typ))
} }
...@@ -269,7 +269,7 @@ func NewMax(typ types.Type, dist bool) agg.Agg[any] { ...@@ -269,7 +269,7 @@ func NewMax(typ types.Type, dist bool) agg.Agg[any] {
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
case types.T_int8: case types.T_int8:
return newGenericMax[int8](typ, dist) return newGenericMax[int8](typ, dist)
case types.T_int16: case types.T_int16:
...@@ -295,19 +295,19 @@ func NewMax(typ types.Type, dist bool) agg.Agg[any] { ...@@ -295,19 +295,19 @@ func NewMax(typ types.Type, dist bool) agg.Agg[any] {
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
case types.T_varchar: case types.T_varchar:
aggPriv := max.NewStrMax() aggPriv := max.NewStrMax()
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
case types.T_blob: case types.T_blob:
aggPriv := max.NewStrMax() aggPriv := max.NewStrMax()
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
case types.T_date: case types.T_date:
return newGenericMax[types.Date](typ, dist) return newGenericMax[types.Date](typ, dist)
case types.T_datetime: case types.T_datetime:
...@@ -319,13 +319,13 @@ func NewMax(typ types.Type, dist bool) agg.Agg[any] { ...@@ -319,13 +319,13 @@ func NewMax(typ types.Type, dist bool) agg.Agg[any] {
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
case types.T_decimal128: case types.T_decimal128:
aggPriv := max.NewD128Max() aggPriv := max.NewD128Max()
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
} }
panic(fmt.Errorf("unsupport type '%s' for anyvalue", typ)) panic(fmt.Errorf("unsupport type '%s' for anyvalue", typ))
} }
...@@ -337,7 +337,7 @@ func NewMin(typ types.Type, dist bool) agg.Agg[any] { ...@@ -337,7 +337,7 @@ func NewMin(typ types.Type, dist bool) agg.Agg[any] {
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
case types.T_int8: case types.T_int8:
return newGenericMin[int8](typ, dist) return newGenericMin[int8](typ, dist)
case types.T_int16: case types.T_int16:
...@@ -363,19 +363,19 @@ func NewMin(typ types.Type, dist bool) agg.Agg[any] { ...@@ -363,19 +363,19 @@ func NewMin(typ types.Type, dist bool) agg.Agg[any] {
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
case types.T_varchar: case types.T_varchar:
aggPriv := min.NewStrMin() aggPriv := min.NewStrMin()
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
case types.T_blob: case types.T_blob:
aggPriv := min.NewStrMin() aggPriv := min.NewStrMin()
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
case types.T_date: case types.T_date:
return newGenericMin[types.Date](typ, dist) return newGenericMin[types.Date](typ, dist)
case types.T_datetime: case types.T_datetime:
...@@ -387,13 +387,13 @@ func NewMin(typ types.Type, dist bool) agg.Agg[any] { ...@@ -387,13 +387,13 @@ func NewMin(typ types.Type, dist bool) agg.Agg[any] {
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
case types.T_decimal128: case types.T_decimal128:
aggPriv := min.NewD128Min() aggPriv := min.NewD128Min()
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
} }
panic(fmt.Errorf("unsupport type '%s' for anyvalue", typ)) panic(fmt.Errorf("unsupport type '%s' for anyvalue", typ))
} }
...@@ -547,13 +547,13 @@ func NewVariance(typ types.Type, dist bool) agg.Agg[any] { ...@@ -547,13 +547,13 @@ func NewVariance(typ types.Type, dist bool) agg.Agg[any] {
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, variance.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, variance.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, variance.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, variance.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
case types.T_decimal128: case types.T_decimal128:
aggPriv := variance.New3() aggPriv := variance.New3()
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, variance.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, variance.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, variance.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, variance.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
} }
panic(fmt.Errorf("unsupport type '%s' for avg", typ)) panic(fmt.Errorf("unsupport type '%s' for avg", typ))
...@@ -586,13 +586,13 @@ func NewStdDevPop(typ types.Type, dist bool) agg.Agg[any] { ...@@ -586,13 +586,13 @@ func NewStdDevPop(typ types.Type, dist bool) agg.Agg[any] {
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, stddevpop.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, stddevpop.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, stddevpop.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, stddevpop.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
case types.T_decimal128: case types.T_decimal128:
aggPriv := stddevpop.New3() aggPriv := stddevpop.New3()
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, stddevpop.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, stddevpop.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, stddevpop.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, stddevpop.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
} }
panic(fmt.Errorf("unsupport type '%s' for avg", typ)) panic(fmt.Errorf("unsupport type '%s' for avg", typ))
...@@ -603,7 +603,7 @@ func newGenericAnyValue[T any](typ types.Type, dist bool) agg.Agg[any] { ...@@ -603,7 +603,7 @@ func newGenericAnyValue[T any](typ types.Type, dist bool) agg.Agg[any] {
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, anyvalue.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, anyvalue.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, anyvalue.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, anyvalue.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
} }
func newGenericSum[T1 sum.Numeric, T2 sum.ReturnTyp](typ types.Type, dist bool) agg.Agg[any] { func newGenericSum[T1 sum.Numeric, T2 sum.ReturnTyp](typ types.Type, dist bool) agg.Agg[any] {
...@@ -611,7 +611,7 @@ func newGenericSum[T1 sum.Numeric, T2 sum.ReturnTyp](typ types.Type, dist bool) ...@@ -611,7 +611,7 @@ func newGenericSum[T1 sum.Numeric, T2 sum.ReturnTyp](typ types.Type, dist bool)
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, sum.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, sum.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, sum.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, sum.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
} }
func newGenericAvg[T sum.Numeric](typ types.Type, dist bool) agg.Agg[any] { func newGenericAvg[T sum.Numeric](typ types.Type, dist bool) agg.Agg[any] {
...@@ -619,7 +619,7 @@ func newGenericAvg[T sum.Numeric](typ types.Type, dist bool) agg.Agg[any] { ...@@ -619,7 +619,7 @@ func newGenericAvg[T sum.Numeric](typ types.Type, dist bool) agg.Agg[any] {
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, avg.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, avg.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, avg.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, avg.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
} }
func newGenericMax[T max.Compare](typ types.Type, dist bool) agg.Agg[any] { func newGenericMax[T max.Compare](typ types.Type, dist bool) agg.Agg[any] {
...@@ -627,7 +627,7 @@ func newGenericMax[T max.Compare](typ types.Type, dist bool) agg.Agg[any] { ...@@ -627,7 +627,7 @@ func newGenericMax[T max.Compare](typ types.Type, dist bool) agg.Agg[any] {
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, max.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
} }
func newGenericMin[T max.Compare](typ types.Type, dist bool) agg.Agg[any] { func newGenericMin[T max.Compare](typ types.Type, dist bool) agg.Agg[any] {
...@@ -635,7 +635,7 @@ func newGenericMin[T max.Compare](typ types.Type, dist bool) agg.Agg[any] { ...@@ -635,7 +635,7 @@ func newGenericMin[T max.Compare](typ types.Type, dist bool) agg.Agg[any] {
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, min.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
} }
func newGenericCount[T types.Generic | count.Decimal128AndString](typ types.Type, dist bool, isStar bool) agg.Agg[any] { func newGenericCount[T types.Generic | count.Decimal128AndString](typ types.Type, dist bool, isStar bool) agg.Agg[any] {
...@@ -643,7 +643,7 @@ func newGenericCount[T types.Generic | count.Decimal128AndString](typ types.Type ...@@ -643,7 +643,7 @@ func newGenericCount[T types.Generic | count.Decimal128AndString](typ types.Type
if dist { if dist {
return agg.NewUnaryDistAgg(true, typ, count.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(true, typ, count.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, true, typ, count.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, true, typ, count.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
} }
func newGenericApproxcd[T any](typ types.Type, dist bool) agg.Agg[any] { func newGenericApproxcd[T any](typ types.Type, dist bool) agg.Agg[any] {
...@@ -651,7 +651,7 @@ func newGenericApproxcd[T any](typ types.Type, dist bool) agg.Agg[any] { ...@@ -651,7 +651,7 @@ func newGenericApproxcd[T any](typ types.Type, dist bool) agg.Agg[any] {
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, approxcd.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, approxcd.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, approxcd.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, approxcd.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
} }
func newGenericBitOr[T types.Ints | types.UInts | types.Floats](typ types.Type, dist bool) agg.Agg[any] { func newGenericBitOr[T types.Ints | types.UInts | types.Floats](typ types.Type, dist bool) agg.Agg[any] {
...@@ -659,7 +659,7 @@ func newGenericBitOr[T types.Ints | types.UInts | types.Floats](typ types.Type, ...@@ -659,7 +659,7 @@ func newGenericBitOr[T types.Ints | types.UInts | types.Floats](typ types.Type,
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, bit_or.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, bit_or.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, bit_or.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, bit_or.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
} }
func newGenericBitXor[T types.Ints | types.UInts | types.Floats](typ types.Type, dist bool) agg.Agg[any] { func newGenericBitXor[T types.Ints | types.UInts | types.Floats](typ types.Type, dist bool) agg.Agg[any] {
...@@ -667,7 +667,7 @@ func newGenericBitXor[T types.Ints | types.UInts | types.Floats](typ types.Type, ...@@ -667,7 +667,7 @@ func newGenericBitXor[T types.Ints | types.UInts | types.Floats](typ types.Type,
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, bit_xor.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, bit_xor.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, bit_xor.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, bit_xor.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
} }
func newGenericBitAnd[T types.Ints | types.UInts | types.Floats](typ types.Type, dist bool) agg.Agg[any] { func newGenericBitAnd[T types.Ints | types.UInts | types.Floats](typ types.Type, dist bool) agg.Agg[any] {
...@@ -675,7 +675,7 @@ func newGenericBitAnd[T types.Ints | types.UInts | types.Floats](typ types.Type, ...@@ -675,7 +675,7 @@ func newGenericBitAnd[T types.Ints | types.UInts | types.Floats](typ types.Type,
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, bit_and.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, bit_and.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, bit_and.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, bit_and.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
} }
func newGenericVariance[T types.Ints | types.UInts | types.Floats](typ types.Type, dist bool) agg.Agg[any] { func newGenericVariance[T types.Ints | types.UInts | types.Floats](typ types.Type, dist bool) agg.Agg[any] {
...@@ -683,7 +683,7 @@ func newGenericVariance[T types.Ints | types.UInts | types.Floats](typ types.Typ ...@@ -683,7 +683,7 @@ func newGenericVariance[T types.Ints | types.UInts | types.Floats](typ types.Typ
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, variance.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, variance.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, variance.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, variance.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
} }
func newGenericStdDevPop[T types.Ints | types.UInts | types.Floats](typ types.Type, dist bool) agg.Agg[any] { func newGenericStdDevPop[T types.Ints | types.UInts | types.Floats](typ types.Type, dist bool) agg.Agg[any] {
...@@ -691,5 +691,5 @@ func newGenericStdDevPop[T types.Ints | types.UInts | types.Floats](typ types.Ty ...@@ -691,5 +691,5 @@ func newGenericStdDevPop[T types.Ints | types.UInts | types.Floats](typ types.Ty
if dist { if dist {
return agg.NewUnaryDistAgg(false, typ, stddevpop.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryDistAgg(false, typ, stddevpop.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill)
} }
return agg.NewUnaryAgg(aggPriv, false, typ, stddevpop.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill) return agg.NewUnaryAgg(aggPriv, false, typ, stddevpop.ReturnType([]types.Type{typ}), aggPriv.Grows, aggPriv.Eval, aggPriv.Merge, aggPriv.Fill, nil)
} }
...@@ -155,6 +155,7 @@ func (ctr *container) probe(bat *batch.Batch, ap *Argument, proc *process.Proces ...@@ -155,6 +155,7 @@ func (ctr *container) probe(bat *batch.Batch, ap *Argument, proc *process.Proces
} }
defer ctr.freeJoinCondition(proc) defer ctr.freeJoinCondition(proc)
count := bat.Length() count := bat.Length()
mSels := ctr.mp.Sels()
itr := ctr.mp.Map().NewIterator() itr := ctr.mp.Map().NewIterator()
for i := 0; i < count; i += hashmap.UnitLimit { for i := 0; i < count; i += hashmap.UnitLimit {
n := count - i n := count - i
...@@ -170,16 +171,43 @@ func (ctr *container) probe(bat *batch.Batch, ap *Argument, proc *process.Proces ...@@ -170,16 +171,43 @@ func (ctr *container) probe(bat *batch.Batch, ap *Argument, proc *process.Proces
if zvals[k] == 0 { if zvals[k] == 0 {
continue continue
} }
if vals[k] != 0 { if vals[k] == 0 {
for j, pos := range ap.Result {
if err := vector.UnionOne(rbat.Vecs[j], bat.Vecs[pos], int64(i+k), proc.GetMheap()); err != nil {
rbat.Clean(proc.GetMheap())
return err
}
}
rbat.Zs = append(rbat.Zs, bat.Zs[i+k])
continue continue
} }
for j, pos := range ap.Result { if ap.Cond != nil {
if err := vector.UnionOne(rbat.Vecs[j], bat.Vecs[pos], int64(i+k), proc.GetMheap()); err != nil { flg := true // mark no tuple satisfies the condition
rbat.Clean(proc.GetMheap()) sels := mSels[vals[k]-1]
return err for _, sel := range sels {
vec, err := colexec.JoinFilterEvalExprInBucket(bat, ctr.bat, i+k, int(sel), proc, ap.Cond)
if err != nil {
return err
}
bs := vec.Col.([]bool)
if bs[0] {
flg = false
vec.Free(proc.Mp)
break
}
vec.Free(proc.Mp)
}
if !flg {
continue
} }
for j, pos := range ap.Result {
if err := vector.UnionOne(rbat.Vecs[j], bat.Vecs[pos], int64(i+k), proc.GetMheap()); err != nil {
rbat.Clean(proc.GetMheap())
return err
}
}
rbat.Zs = append(rbat.Zs, bat.Zs[i+k])
} }
rbat.Zs = append(rbat.Zs, bat.Zs[i+k])
} }
} }
rbat.ExpandNulls() rbat.ExpandNulls()
......
...@@ -23,6 +23,7 @@ import ( ...@@ -23,6 +23,7 @@ import (
"github.com/matrixorigin/matrixone/pkg/container/types" "github.com/matrixorigin/matrixone/pkg/container/types"
"github.com/matrixorigin/matrixone/pkg/pb/plan" "github.com/matrixorigin/matrixone/pkg/pb/plan"
"github.com/matrixorigin/matrixone/pkg/sql/colexec/hashbuild" "github.com/matrixorigin/matrixone/pkg/sql/colexec/hashbuild"
"github.com/matrixorigin/matrixone/pkg/sql/plan/function"
"github.com/matrixorigin/matrixone/pkg/testutil" "github.com/matrixorigin/matrixone/pkg/testutil"
"github.com/matrixorigin/matrixone/pkg/vm/mheap" "github.com/matrixorigin/matrixone/pkg/vm/mheap"
"github.com/matrixorigin/matrixone/pkg/vm/process" "github.com/matrixorigin/matrixone/pkg/vm/process"
...@@ -190,6 +191,44 @@ func newTestCase(m *mheap.Mheap, flgs []bool, ts []types.Type, rp []int32, cs [] ...@@ -190,6 +191,44 @@ func newTestCase(m *mheap.Mheap, flgs []bool, ts []types.Type, rp []int32, cs []
Ctx: ctx, Ctx: ctx,
Ch: make(chan *batch.Batch, 3), Ch: make(chan *batch.Batch, 3),
} }
fid := function.EncodeOverloadID(function.EQUAL, 4)
args := make([]*plan.Expr, 0, 2)
args = append(args, &plan.Expr{
Typ: &plan.Type{
Size: ts[0].Size,
Id: int32(ts[0].Oid),
},
Expr: &plan.Expr_Col{
Col: &plan.ColRef{
RelPos: 0,
ColPos: 0,
},
},
})
args = append(args, &plan.Expr{
Typ: &plan.Type{
Size: ts[0].Size,
Id: int32(ts[0].Oid),
},
Expr: &plan.Expr_Col{
Col: &plan.ColRef{
RelPos: 1,
ColPos: 0,
},
},
})
cond := &plan.Expr{
Typ: &plan.Type{
Size: 1,
Id: int32(types.T_bool),
},
Expr: &plan.Expr_F{
F: &plan.Function{
Args: args,
Func: &plan.ObjectRef{Obj: fid},
},
},
}
return antiTestCase{ return antiTestCase{
types: ts, types: ts,
flgs: flgs, flgs: flgs,
...@@ -199,6 +238,7 @@ func newTestCase(m *mheap.Mheap, flgs []bool, ts []types.Type, rp []int32, cs [] ...@@ -199,6 +238,7 @@ func newTestCase(m *mheap.Mheap, flgs []bool, ts []types.Type, rp []int32, cs []
Typs: ts, Typs: ts,
Result: rp, Result: rp,
Conditions: cs, Conditions: cs,
Cond: cond,
}, },
barg: &hashbuild.Argument{ barg: &hashbuild.Argument{
Typs: ts, Typs: ts,
......
...@@ -54,5 +54,6 @@ type Argument struct { ...@@ -54,5 +54,6 @@ type Argument struct {
Nbucket uint64 Nbucket uint64
Result []int32 Result []int32
Typs []types.Type Typs []types.Type
Cond *plan.Expr
Conditions [][]*plan.Expr Conditions [][]*plan.Expr
} }
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