github.com/matrixorigin/matrixone@v1.2.0/pkg/sql/plan/function/list_window.go (about) 1 // Copyright 2021 - 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 function 16 17 import ( 18 "github.com/matrixorigin/matrixone/pkg/container/types" 19 "github.com/matrixorigin/matrixone/pkg/pb/plan" 20 "github.com/matrixorigin/matrixone/pkg/sql/colexec/aggexec" 21 "github.com/matrixorigin/matrixone/pkg/sql/plan/function/agg" 22 ) 23 24 var supportedWindowInNewFramework = []FuncNew{ 25 { 26 functionId: RANK, 27 class: plan.Function_WIN_ORDER, 28 layout: STANDARD_FUNCTION, 29 checkFn: func(overloads []overload, inputs []types.Type) checkResult { 30 if len(inputs) == 0 { 31 return newCheckResultWithSuccess(0) 32 } 33 return newCheckResultWithFailure(failedFunctionParametersWrong) 34 }, 35 Overloads: []overload{ 36 { 37 overloadId: 0, 38 isWin: true, 39 retType: aggexec.SingleWindowReturnType, 40 aggFramework: aggregationLogicOfOverload{ 41 str: "rank", 42 aggRegister: agg.RegisterRank, 43 }, 44 }, 45 }, 46 }, 47 { 48 functionId: ROW_NUMBER, 49 class: plan.Function_WIN_ORDER, 50 layout: STANDARD_FUNCTION, 51 checkFn: func(overloads []overload, inputs []types.Type) checkResult { 52 if len(inputs) == 0 { 53 return newCheckResultWithSuccess(0) 54 } 55 return newCheckResultWithFailure(failedFunctionParametersWrong) 56 }, 57 Overloads: []overload{ 58 { 59 overloadId: 0, 60 isWin: true, 61 retType: aggexec.SingleWindowReturnType, 62 aggFramework: aggregationLogicOfOverload{ 63 str: "row_number", 64 aggRegister: agg.RegisterRowNumber, 65 }, 66 }, 67 }, 68 }, 69 { 70 functionId: DENSE_RANK, 71 class: plan.Function_WIN_ORDER, 72 layout: STANDARD_FUNCTION, 73 checkFn: func(overloads []overload, inputs []types.Type) checkResult { 74 if len(inputs) == 0 { 75 return newCheckResultWithSuccess(0) 76 } 77 return newCheckResultWithFailure(failedFunctionParametersWrong) 78 }, 79 Overloads: []overload{ 80 { 81 overloadId: 0, 82 isWin: true, 83 retType: aggexec.SingleWindowReturnType, 84 aggFramework: aggregationLogicOfOverload{ 85 str: "dense_rank", 86 aggRegister: agg.RegisterDenseRank, 87 }, 88 }, 89 }, 90 }, 91 }