github.com/matrixorigin/matrixone@v0.7.0/pkg/container/hashtable/common.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 hashtable 16 17 import "unsafe" 18 19 const ( 20 kInitialCellCntBits = 10 21 kInitialCellCnt = 1 << kInitialCellCntBits 22 23 kLoadFactorNumerator = 1 24 kLoadFactorDenominator = 2 25 26 //kTwoLevelBucketCntBits = 8 27 //kTwoLevelBucketCnt = 1 << kTwoLevelBucketCntBits 28 //kMaxTwoLevelBucketCnt = kTwoLevelBucketCnt - 1 29 ) 30 31 type Aggregator interface { 32 StateSize() uint8 33 ResultSize() uint8 34 NeedsInit() bool 35 36 Init(state unsafe.Pointer) 37 AddBatch(states []unsafe.Pointer, values unsafe.Pointer) 38 MergeBatch(lstates, rstates []unsafe.Pointer) 39 40 Finalize(states, results []unsafe.Pointer) 41 }