github.com/whtcorpsinc/MilevaDB-Prod@v0.0.0-20211104133533-f57f4be3b597/dbs/memristed/memex/builtin_compare_vec_generated_test.go (about) 1 // Copyright 2020 WHTCORPS INC, Inc. 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 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 // Code generated by go generate in memex/generator; DO NOT EDIT. 15 16 package memex 17 18 import ( 19 "testing" 20 21 . "github.com/whtcorpsinc/check" 22 "github.com/whtcorpsinc/BerolinaSQL/ast" 23 "github.com/whtcorpsinc/milevadb/types" 24 ) 25 26 var vecGeneratedBuiltinCompareCases = map[string][]vecExprBenchCase{ 27 ast.LT: { 28 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETReal, types.ETReal}}, 29 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDecimal, types.ETDecimal}}, 30 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETString, types.ETString}}, 31 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDatetime, types.ETDatetime}}, 32 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDuration, types.ETDuration}}, 33 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETJson, types.ETJson}}, 34 }, 35 ast.LE: { 36 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETReal, types.ETReal}}, 37 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDecimal, types.ETDecimal}}, 38 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETString, types.ETString}}, 39 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDatetime, types.ETDatetime}}, 40 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDuration, types.ETDuration}}, 41 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETJson, types.ETJson}}, 42 }, 43 ast.GT: { 44 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETReal, types.ETReal}}, 45 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDecimal, types.ETDecimal}}, 46 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETString, types.ETString}}, 47 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDatetime, types.ETDatetime}}, 48 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDuration, types.ETDuration}}, 49 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETJson, types.ETJson}}, 50 }, 51 ast.GE: { 52 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETReal, types.ETReal}}, 53 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDecimal, types.ETDecimal}}, 54 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETString, types.ETString}}, 55 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDatetime, types.ETDatetime}}, 56 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDuration, types.ETDuration}}, 57 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETJson, types.ETJson}}, 58 }, 59 ast.EQ: { 60 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETReal, types.ETReal}}, 61 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDecimal, types.ETDecimal}}, 62 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETString, types.ETString}}, 63 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDatetime, types.ETDatetime}}, 64 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDuration, types.ETDuration}}, 65 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETJson, types.ETJson}}, 66 }, 67 ast.NE: { 68 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETReal, types.ETReal}}, 69 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDecimal, types.ETDecimal}}, 70 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETString, types.ETString}}, 71 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDatetime, types.ETDatetime}}, 72 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDuration, types.ETDuration}}, 73 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETJson, types.ETJson}}, 74 }, 75 ast.NullEQ: { 76 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETReal, types.ETReal}}, 77 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDecimal, types.ETDecimal}}, 78 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETString, types.ETString}}, 79 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDatetime, types.ETDatetime}}, 80 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDuration, types.ETDuration}}, 81 {retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETJson, types.ETJson}}, 82 }, 83 ast.Coalesce: { 84 85 { 86 retEvalType: types.ETInt, 87 childrenTypes: []types.EvalType{types.ETInt, types.ETInt, types.ETInt}, 88 geners: []dataGenerator{ 89 gener{*newDefaultGener(0.2, types.ETInt)}, 90 gener{*newDefaultGener(0.2, types.ETInt)}, 91 gener{*newDefaultGener(0.2, types.ETInt)}, 92 }, 93 }, 94 95 { 96 retEvalType: types.ETReal, 97 childrenTypes: []types.EvalType{types.ETReal, types.ETReal, types.ETReal}, 98 geners: []dataGenerator{ 99 gener{*newDefaultGener(0.2, types.ETReal)}, 100 gener{*newDefaultGener(0.2, types.ETReal)}, 101 gener{*newDefaultGener(0.2, types.ETReal)}, 102 }, 103 }, 104 105 { 106 retEvalType: types.ETDecimal, 107 childrenTypes: []types.EvalType{types.ETDecimal, types.ETDecimal, types.ETDecimal}, 108 geners: []dataGenerator{ 109 gener{*newDefaultGener(0.2, types.ETDecimal)}, 110 gener{*newDefaultGener(0.2, types.ETDecimal)}, 111 gener{*newDefaultGener(0.2, types.ETDecimal)}, 112 }, 113 }, 114 115 { 116 retEvalType: types.ETString, 117 childrenTypes: []types.EvalType{types.ETString, types.ETString, types.ETString}, 118 geners: []dataGenerator{ 119 gener{*newDefaultGener(0.2, types.ETString)}, 120 gener{*newDefaultGener(0.2, types.ETString)}, 121 gener{*newDefaultGener(0.2, types.ETString)}, 122 }, 123 }, 124 125 { 126 retEvalType: types.ETDatetime, 127 childrenTypes: []types.EvalType{types.ETDatetime, types.ETDatetime, types.ETDatetime}, 128 geners: []dataGenerator{ 129 gener{*newDefaultGener(0.2, types.ETDatetime)}, 130 gener{*newDefaultGener(0.2, types.ETDatetime)}, 131 gener{*newDefaultGener(0.2, types.ETDatetime)}, 132 }, 133 }, 134 135 { 136 retEvalType: types.ETDuration, 137 childrenTypes: []types.EvalType{types.ETDuration, types.ETDuration, types.ETDuration}, 138 geners: []dataGenerator{ 139 gener{*newDefaultGener(0.2, types.ETDuration)}, 140 gener{*newDefaultGener(0.2, types.ETDuration)}, 141 gener{*newDefaultGener(0.2, types.ETDuration)}, 142 }, 143 }, 144 145 { 146 retEvalType: types.ETJson, 147 childrenTypes: []types.EvalType{types.ETJson, types.ETJson, types.ETJson}, 148 geners: []dataGenerator{ 149 gener{*newDefaultGener(0.2, types.ETJson)}, 150 gener{*newDefaultGener(0.2, types.ETJson)}, 151 gener{*newDefaultGener(0.2, types.ETJson)}, 152 }, 153 }, 154 }, 155 } 156 157 func (s *testEvaluatorSuite) TestVectorizedGeneratedBuiltinCompareEvalOneVec(c *C) { 158 testVectorizedEvalOneVec(c, vecGeneratedBuiltinCompareCases) 159 } 160 161 func (s *testEvaluatorSuite) TestVectorizedGeneratedBuiltinCompareFunc(c *C) { 162 testVectorizedBuiltinFunc(c, vecGeneratedBuiltinCompareCases) 163 } 164 165 func BenchmarkVectorizedGeneratedBuiltinCompareEvalOneVec(b *testing.B) { 166 benchmarkVectorizedEvalOneVec(b, vecGeneratedBuiltinCompareCases) 167 } 168 169 func BenchmarkVectorizedGeneratedBuiltinCompareFunc(b *testing.B) { 170 benchmarkVectorizedBuiltinFunc(b, vecGeneratedBuiltinCompareCases) 171 }