github.com/cockroachdb/cockroachdb-parser@v0.23.3-0.20240213214944-911057d40c9a/pkg/sql/sem/tree/eval_binary_ops.go (about) 1 // Copyright 2022 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 package tree 12 13 import ( 14 "context" 15 16 "github.com/cockroachdb/cockroachdb-parser/pkg/sql/sem/tree/treecmp" 17 "github.com/cockroachdb/cockroachdb-parser/pkg/sql/types" 18 ) 19 20 // This file is used as input to the evalgen command to generate the methods 21 // and interface for eval_op_generated.go. Note that operations which define 22 // their own Eval method will not have one generated for them and will not be 23 // a part of the relevant Evaluator interface. 24 25 // CompareScalarOp is a BinaryEvalOp. 26 type CompareScalarOp struct { 27 treecmp.ComparisonOperator 28 } 29 30 // CompareBox2DOp is a BinaryEvalOp. 31 type CompareBox2DOp struct { 32 Op func(left, right Datum) bool 33 } 34 35 // InTupleOp is a BinaryEvalOp. 36 type InTupleOp struct{} 37 38 // CompareTupleOp is a BinaryEvalOp. 39 type CompareTupleOp struct { 40 treecmp.ComparisonOperator 41 } 42 43 // CompareAnyTupleOp is a BinaryEvalOp. 44 type CompareAnyTupleOp CompareTupleOp 45 46 // Eval suppresses an auto-generated binding and membership in the 47 // OpEvaluator interface. 48 func (t *CompareAnyTupleOp) Eval(ctx context.Context, e OpEvaluator, a, b Datum) (Datum, error) { 49 if a == DNull || b == DNull { 50 return MakeDBool(a == DNull && b == DNull), nil 51 } 52 return e.EvalCompareTupleOp(ctx, (*CompareTupleOp)(t), a, b) 53 } 54 55 // MatchLikeOp is a BinaryEvalOp. 56 type MatchLikeOp struct { 57 CaseInsensitive bool 58 } 59 60 // SimilarToOp is a BinaryEvalOp. 61 type SimilarToOp struct { 62 Escape rune 63 CaseInsensitive bool 64 } 65 66 // MatchRegexpOp is a BinaryEvalOp. 67 type MatchRegexpOp struct { 68 Escape rune 69 CaseInsensitive bool 70 } 71 72 // OverlapsArrayOp is a BinaryEvalOp. 73 type OverlapsArrayOp struct{} 74 75 // OverlapsINetOp is a BinaryEvalOp. 76 type OverlapsINetOp struct{} 77 78 // TSMatchesVectorQueryOp is a BinaryEvalOp. 79 type TSMatchesVectorQueryOp struct{} 80 81 // TSMatchesQueryVectorOp is a BinaryEvalOp. 82 type TSMatchesQueryVectorOp struct{} 83 84 // AppendToMaybeNullArrayOp is a BinaryEvalOp. 85 type AppendToMaybeNullArrayOp struct { 86 Typ *types.T 87 } 88 89 // PrependToMaybeNullArrayOp is a BinaryEvalOp. 90 type PrependToMaybeNullArrayOp struct { 91 Typ *types.T 92 } 93 94 // ConcatArraysOp is a BinaryEvalOp. 95 type ConcatArraysOp struct { 96 Typ *types.T 97 } 98 99 // ConcatOp is a BinaryEvalOp. 100 type ConcatOp struct { 101 Left *types.T 102 Right *types.T 103 } 104 105 type ( 106 // BitAndIntOp is a BinaryEvalOp. 107 BitAndIntOp struct{} 108 // BitAndVarBitOp is a BinaryEvalOp. 109 BitAndVarBitOp struct{} 110 // BitAndINetOp is a BinaryEvalOp. 111 BitAndINetOp struct{} 112 ) 113 114 type ( 115 // BitOrIntOp is a BinaryEvalOp. 116 BitOrIntOp struct{} 117 // BitOrVarBitOp is a BinaryEvalOp. 118 BitOrVarBitOp struct{} 119 // BitOrINetOp is a BinaryEvalOp. 120 BitOrINetOp struct{} 121 ) 122 123 type ( 124 // BitXorIntOp is a BinaryEvalOp. 125 BitXorIntOp struct{} 126 // BitXorVarBitOp is a BinaryEvalOp. 127 BitXorVarBitOp struct{} 128 ) 129 130 type ( 131 // PlusIntOp is a BinaryEvalOp. 132 PlusIntOp struct{} 133 // PlusFloatOp is a BinaryEvalOp. 134 PlusFloatOp struct{} 135 // PlusDecimalOp is a BinaryEvalOp. 136 PlusDecimalOp struct{} 137 // PlusDecimalIntOp is a BinaryEvalOp. 138 PlusDecimalIntOp struct{} 139 // PlusIntDecimalOp is a BinaryEvalOp. 140 PlusIntDecimalOp struct{} 141 // PlusDateIntOp is a BinaryEvalOp. 142 PlusDateIntOp struct{} 143 // PlusIntDateOp is a BinaryEvalOp. 144 PlusIntDateOp struct{} 145 // PlusDateTimeOp is a BinaryEvalOp. 146 PlusDateTimeOp struct{} 147 // PlusTimeDateOp is a BinaryEvalOp. 148 PlusTimeDateOp struct{} 149 // PlusDateTimeTZOp is a BinaryEvalOp. 150 PlusDateTimeTZOp struct{} 151 // PlusTimeTZDateOp is a BinaryEvalOp. 152 PlusTimeTZDateOp struct{} 153 // PlusTimeIntervalOp is a BinaryEvalOp. 154 PlusTimeIntervalOp struct{} 155 // PlusIntervalTimeOp is a BinaryEvalOp. 156 PlusIntervalTimeOp struct{} 157 // PlusTimeTZIntervalOp is a BinaryEvalOp. 158 PlusTimeTZIntervalOp struct{} 159 // PlusIntervalTimeTZOp is a BinaryEvalOp. 160 PlusIntervalTimeTZOp struct{} 161 // PlusTimestampIntervalOp is a BinaryEvalOp. 162 PlusTimestampIntervalOp struct{} 163 // PlusIntervalTimestampOp is a BinaryEvalOp. 164 PlusIntervalTimestampOp struct{} 165 // PlusTimestampTZIntervalOp is a BinaryEvalOp. 166 PlusTimestampTZIntervalOp struct{} 167 // PlusIntervalTimestampTZOp is a BinaryEvalOp. 168 PlusIntervalTimestampTZOp struct{} 169 // PlusIntervalOp is a BinaryEvalOp. 170 PlusIntervalOp struct{} 171 // PlusDateIntervalOp is a BinaryEvalOp. 172 PlusDateIntervalOp struct{} 173 // PlusIntervalDateOp is a BinaryEvalOp. 174 PlusIntervalDateOp struct{} 175 // PlusINetIntOp is a BinaryEvalOp. 176 PlusINetIntOp struct{} 177 // PlusIntINetOp is a BinaryEvalOp. 178 PlusIntINetOp struct{} 179 // PlusDecimalPGLSNOp is a BinaryEvalOp. 180 PlusDecimalPGLSNOp struct{} 181 // PlusPGLSNDecimalOp is a BinaryEvalOp. 182 PlusPGLSNDecimalOp struct{} 183 ) 184 185 type ( 186 // MinusIntOp is a BinaryEvalOp. 187 MinusIntOp struct{} 188 // MinusFloatOp is a BinaryEvalOp. 189 MinusFloatOp struct{} 190 // MinusDecimalOp is a BinaryEvalOp. 191 MinusDecimalOp struct{} 192 // MinusDecimalIntOp is a BinaryEvalOp. 193 MinusDecimalIntOp struct{} 194 // MinusIntDecimalOp is a BinaryEvalOp. 195 MinusIntDecimalOp struct{} 196 // MinusDateIntOp is a BinaryEvalOp. 197 MinusDateIntOp struct{} 198 // MinusDateOp is a BinaryEvalOp. 199 MinusDateOp struct{} 200 // MinusDateTimeOp is a BinaryEvalOp. 201 MinusDateTimeOp struct{} 202 // MinusTimeOp is a BinaryEvalOp. 203 MinusTimeOp struct{} 204 // MinusTimestampOp is a BinaryEvalOp. 205 MinusTimestampOp struct{} 206 // MinusTimestampTZOp is a BinaryEvalOp. 207 MinusTimestampTZOp struct{} 208 // MinusTimestampTimestampTZOp is a BinaryEvalOp. 209 MinusTimestampTimestampTZOp struct{} 210 // MinusTimestampTZTimestampOp is a BinaryEvalOp. 211 MinusTimestampTZTimestampOp struct{} 212 // MinusTimeIntervalOp is a BinaryEvalOp. 213 MinusTimeIntervalOp struct{} 214 // MinusTimeTZIntervalOp is a BinaryEvalOp. 215 MinusTimeTZIntervalOp struct{} 216 // MinusTimestampIntervalOp is a BinaryEvalOp. 217 MinusTimestampIntervalOp struct{} 218 // MinusTimestampTZIntervalOp is a BinaryEvalOp. 219 MinusTimestampTZIntervalOp struct{} 220 // MinusDateIntervalOp is a BinaryEvalOp. 221 MinusDateIntervalOp struct{} 222 // MinusIntervalOp is a BinaryEvalOp. 223 MinusIntervalOp struct{} 224 // MinusJsonbStringOp is a BinaryEvalOp. 225 MinusJsonbStringOp struct{} 226 // MinusJsonbIntOp is a BinaryEvalOp. 227 MinusJsonbIntOp struct{} 228 // MinusJsonbStringArrayOp is a BinaryEvalOp. 229 MinusJsonbStringArrayOp struct{} 230 // MinusINetOp is a BinaryEvalOp. 231 MinusINetOp struct{} 232 // MinusINetIntOp is a BinaryEvalOp. 233 MinusINetIntOp struct{} 234 // MinusPGLSNDecimalOp is a BinaryEvalOp. 235 MinusPGLSNDecimalOp struct{} 236 // MinusPGLSNOp is a BinaryEvalOp. 237 MinusPGLSNOp struct{} 238 ) 239 type ( 240 // MultDecimalIntOp is a BinaryEvalOp. 241 MultDecimalIntOp struct{} 242 // MultDecimalIntervalOp is a BinaryEvalOp. 243 MultDecimalIntervalOp struct{} 244 // MultDecimalOp is a BinaryEvalOp. 245 MultDecimalOp struct{} 246 // MultFloatIntervalOp is a BinaryEvalOp. 247 MultFloatIntervalOp struct{} 248 // MultFloatOp is a BinaryEvalOp. 249 MultFloatOp struct{} 250 // MultIntDecimalOp is a BinaryEvalOp. 251 MultIntDecimalOp struct{} 252 // MultIntIntervalOp is a BinaryEvalOp. 253 MultIntIntervalOp struct{} 254 // MultIntOp is a BinaryEvalOp. 255 MultIntOp struct{} 256 // MultIntervalDecimalOp is a BinaryEvalOp. 257 MultIntervalDecimalOp struct{} 258 // MultIntervalFloatOp is a BinaryEvalOp. 259 MultIntervalFloatOp struct{} 260 // MultIntervalIntOp is a BinaryEvalOp. 261 MultIntervalIntOp struct{} 262 ) 263 264 type ( 265 // DivDecimalIntOp is a BinaryEvalOp. 266 DivDecimalIntOp struct{} 267 // DivDecimalOp is a BinaryEvalOp. 268 DivDecimalOp struct{} 269 // DivFloatOp is a BinaryEvalOp. 270 DivFloatOp struct{} 271 // DivIntDecimalOp is a BinaryEvalOp. 272 DivIntDecimalOp struct{} 273 // DivIntOp is a BinaryEvalOp. 274 DivIntOp struct{} 275 // DivIntervalFloatOp is a BinaryEvalOp. 276 DivIntervalFloatOp struct{} 277 // DivIntervalIntOp is a BinaryEvalOp. 278 DivIntervalIntOp struct{} 279 ) 280 281 type ( 282 // FloorDivDecimalIntOp is a BinaryEvalOp. 283 FloorDivDecimalIntOp struct{} 284 // FloorDivDecimalOp is a BinaryEvalOp. 285 FloorDivDecimalOp struct{} 286 // FloorDivFloatOp is a BinaryEvalOp. 287 FloorDivFloatOp struct{} 288 // FloorDivIntDecimalOp is a BinaryEvalOp. 289 FloorDivIntDecimalOp struct{} 290 // FloorDivIntOp is a BinaryEvalOp. 291 FloorDivIntOp struct{} 292 ) 293 294 type ( 295 // ModDecimalIntOp is a BinaryEvalOp. 296 ModDecimalIntOp struct{} 297 // ModDecimalOp is a BinaryEvalOp. 298 ModDecimalOp struct{} 299 // ModFloatOp is a BinaryEvalOp. 300 ModFloatOp struct{} 301 // ModIntDecimalOp is a BinaryEvalOp. 302 ModIntDecimalOp struct{} 303 // ModIntOp is a BinaryEvalOp. 304 ModIntOp struct{} 305 // ModStringOp is a BinaryEvalOp. 306 ModStringOp struct{} 307 ) 308 309 type ( 310 // ConcatBytesOp is a BinaryEvalOp. 311 ConcatBytesOp struct{} 312 // ConcatJsonbOp is a BinaryEvalOp. 313 ConcatJsonbOp struct{} 314 // ConcatStringOp is a BinaryEvalOp. 315 ConcatStringOp struct{} 316 // ConcatVarBitOp is a BinaryEvalOp. 317 ConcatVarBitOp struct{} 318 ) 319 320 type ( 321 // LShiftINetOp is a BinaryEvalOp. 322 LShiftINetOp struct{} 323 // LShiftIntOp is a BinaryEvalOp. 324 LShiftIntOp struct{} 325 // LShiftVarBitIntOp is a BinaryEvalOp. 326 LShiftVarBitIntOp struct{} 327 ) 328 329 type ( 330 // RShiftINetOp is a BinaryEvalOp. 331 RShiftINetOp struct{} 332 // RShiftIntOp is a BinaryEvalOp. 333 RShiftIntOp struct{} 334 // RShiftVarBitIntOp is a BinaryEvalOp. 335 RShiftVarBitIntOp struct{} 336 ) 337 338 type ( 339 // PowDecimalIntOp is a BinaryEvalOp. 340 PowDecimalIntOp struct{} 341 // PowDecimalOp is a BinaryEvalOp. 342 PowDecimalOp struct{} 343 // PowFloatOp is a BinaryEvalOp. 344 PowFloatOp struct{} 345 // PowIntDecimalOp is a BinaryEvalOp. 346 PowIntDecimalOp struct{} 347 // PowIntOp is a BinaryEvalOp. 348 PowIntOp struct{} 349 ) 350 351 type ( 352 // JSONFetchValIntOp is a BinaryEvalOp. 353 JSONFetchValIntOp struct{} 354 // JSONFetchValStringOp is a BinaryEvalOp. 355 JSONFetchValStringOp struct{} 356 ) 357 type ( 358 // JSONFetchTextIntOp is a BinaryEvalOp. 359 JSONFetchTextIntOp struct{} 360 // JSONFetchTextStringOp is a BinaryEvalOp. 361 JSONFetchTextStringOp struct{} 362 ) 363 364 // JSONExistsOp is a BinaryEvalOp. 365 type JSONExistsOp struct{} 366 367 // JSONSomeExistsOp is a BinaryEvalOp. 368 type JSONSomeExistsOp struct{} 369 370 // JSONAllExistsOp is a BinaryEvalOp. 371 type JSONAllExistsOp struct{} 372 373 // JSONFetchValPathOp is a BinaryEvalOp. 374 type JSONFetchValPathOp struct{} 375 376 // JSONFetchTextPathOp is a BinaryEvalOp. 377 type JSONFetchTextPathOp struct{} 378 379 // ContainsArrayOp is a BinaryEvalOp. 380 type ContainsArrayOp struct{} 381 382 // ContainsJsonbOp is a BinaryEvalOp. 383 type ContainsJsonbOp struct{} 384 385 // ContainedByArrayOp is a BinaryEvalOp. 386 type ContainedByArrayOp struct{} 387 388 // ContainedByJsonbOp is a BinaryEvalOp. 389 type ContainedByJsonbOp struct{}