github.com/matrixorigin/matrixone@v1.2.0/pkg/sql/colexec/aggexec/multiNew.go (about)

     1  // Copyright 2024 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 aggexec
    16  
    17  import (
    18  	"fmt"
    19  	"github.com/matrixorigin/matrixone/pkg/container/types"
    20  )
    21  
    22  // all the codes in this file were to new the multiple column aggregation executors.
    23  
    24  func newMultiAggFuncExecRetFixed(
    25  	mg AggMemoryManager, info multiAggInfo, impl multiColumnAggImplementation) AggFuncExec {
    26  
    27  	switch info.retType.Oid {
    28  	case types.T_bool:
    29  		e := &multiAggFuncExec1[bool]{}
    30  		e.init(mg, info, impl)
    31  		return e
    32  	case types.T_int8:
    33  		e := &multiAggFuncExec1[int8]{}
    34  		e.init(mg, info, impl)
    35  		return e
    36  	case types.T_int16:
    37  		e := &multiAggFuncExec1[int16]{}
    38  		e.init(mg, info, impl)
    39  		return e
    40  	case types.T_int32:
    41  		e := &multiAggFuncExec1[int32]{}
    42  		e.init(mg, info, impl)
    43  		return e
    44  	case types.T_int64:
    45  		e := &multiAggFuncExec1[int64]{}
    46  		e.init(mg, info, impl)
    47  		return e
    48  	case types.T_uint8:
    49  		e := &multiAggFuncExec1[uint8]{}
    50  		e.init(mg, info, impl)
    51  		return e
    52  	case types.T_uint16:
    53  		e := &multiAggFuncExec1[uint16]{}
    54  		e.init(mg, info, impl)
    55  		return e
    56  	case types.T_uint32:
    57  		e := &multiAggFuncExec1[uint32]{}
    58  		e.init(mg, info, impl)
    59  		return e
    60  	case types.T_uint64:
    61  		e := &multiAggFuncExec1[uint64]{}
    62  		e.init(mg, info, impl)
    63  		return e
    64  	case types.T_float32:
    65  		e := &multiAggFuncExec1[float32]{}
    66  		e.init(mg, info, impl)
    67  		return e
    68  	case types.T_float64:
    69  		e := &multiAggFuncExec1[float64]{}
    70  		e.init(mg, info, impl)
    71  		return e
    72  	case types.T_decimal64:
    73  		e := &multiAggFuncExec1[types.Decimal64]{}
    74  		e.init(mg, info, impl)
    75  		return e
    76  	case types.T_decimal128:
    77  		e := &multiAggFuncExec1[types.Decimal128]{}
    78  		e.init(mg, info, impl)
    79  		return e
    80  	case types.T_date:
    81  		e := &multiAggFuncExec1[types.Date]{}
    82  		e.init(mg, info, impl)
    83  		return e
    84  	case types.T_datetime:
    85  		e := &multiAggFuncExec1[types.Datetime]{}
    86  		e.init(mg, info, impl)
    87  		return e
    88  	case types.T_time:
    89  		e := &multiAggFuncExec1[types.Time]{}
    90  		e.init(mg, info, impl)
    91  		return e
    92  	case types.T_timestamp:
    93  		e := &multiAggFuncExec1[types.Timestamp]{}
    94  		e.init(mg, info, impl)
    95  		return e
    96  	}
    97  
    98  	panic(fmt.Sprintf("unexpected parameter to Init a multiAggFuncExec, aggInfo: %s", info))
    99  }