github.com/matrixorigin/matrixone@v1.2.0/pkg/vm/engine/tae/model/preparer.go (about) 1 // Copyright 2022 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 "github.com/matrixorigin/matrixone/pkg/objectio" 19 "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/containers" 20 ) 21 22 func PreparePhyAddrData( 23 id *objectio.Blockid, startRow, length uint32, pool *containers.VectorPool, 24 ) (col containers.Vector, err error) { 25 col = pool.GetVector(&objectio.RowidType) 26 vec := col.GetDownstreamVector() 27 m := col.GetAllocator() 28 if err = objectio.ConstructRowidColumnTo( 29 vec, id, startRow, length, m, 30 ); err != nil { 31 col.Close() 32 col = nil 33 } 34 return 35 } 36 37 type PreparedCompactedBlockData struct { 38 Columns *containers.Batch 39 SortKey containers.Vector 40 SchemaVersion uint32 41 Seqnums []uint16 42 } 43 44 func NewPreparedCompactedBlockData() *PreparedCompactedBlockData { 45 return &PreparedCompactedBlockData{} 46 } 47 48 func (preparer *PreparedCompactedBlockData) Close() { 49 if preparer.Columns != nil { 50 preparer.Columns.Close() 51 preparer.Columns = nil 52 } 53 if preparer.SortKey != nil { 54 preparer.SortKey = nil 55 } 56 }