github.com/matrixorigin/matrixone@v0.7.0/pkg/vm/engine/tae/model/blkview_test.go (about) 1 // Copyright 2021 Matrix Origin 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package model 16 17 import ( 18 "testing" 19 20 "github.com/RoaringBitmap/roaring" 21 "github.com/matrixorigin/matrixone/pkg/container/types" 22 "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/containers" 23 "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/testutils" 24 "github.com/stretchr/testify/assert" 25 ) 26 27 func TestEval(t *testing.T) { 28 defer testutils.AfterTest(t)() 29 var zeroV types.TS 30 view := NewBlockView(zeroV.Next().Next()) 31 colTypes := types.MockColTypes(14) 32 rows := 64 33 bat := containers.MockBatch(colTypes, rows, 3, nil) 34 35 view.SetBatch(bat) 36 defer view.Close() 37 view.SetUpdates(1, roaring.BitmapOf(3), map[uint32]any{3: int16(7)}) 38 view.SetUpdates(13, roaring.BitmapOf(4), map[uint32]any{4: []byte("testEval")}) 39 40 _ = view.Eval(true) 41 42 assert.Equal(t, any(int16(7)), view.GetColumnData(1).Get(3)) 43 assert.Equal(t, any([]byte("testEval")), view.GetColumnData(13).Get(4)) 44 }