github.com/whtcorpsinc/MilevaDB-Prod@v0.0.0-20211104133533-f57f4be3b597/dbs/memristed/memex/builtin_compare_vec_generated.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 "github.com/whtcorpsinc/milevadb/types" 20 "github.com/whtcorpsinc/milevadb/types/json" 21 "github.com/whtcorpsinc/milevadb/soliton/chunk" 22 ) 23 24 func (b *builtinLTRealSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 25 n := input.NumEvents() 26 buf0, err := b.bufSlabPredictor.get(types.ETReal, n) 27 if err != nil { 28 return err 29 } 30 defer b.bufSlabPredictor.put(buf0) 31 if err := b.args[0].VecEvalReal(b.ctx, input, buf0); err != nil { 32 return err 33 } 34 buf1, err := b.bufSlabPredictor.get(types.ETReal, n) 35 if err != nil { 36 return err 37 } 38 defer b.bufSlabPredictor.put(buf1) 39 if err := b.args[1].VecEvalReal(b.ctx, input, buf1); err != nil { 40 return err 41 } 42 43 arg0 := buf0.Float64s() 44 arg1 := buf1.Float64s() 45 result.ResizeInt64(n, false) 46 result.MergeNulls(buf0, buf1) 47 i64s := result.Int64s() 48 for i := 0; i < n; i++ { 49 if result.IsNull(i) { 50 continue 51 } 52 val := types.CompareFloat64(arg0[i], arg1[i]) 53 if val < 0 { 54 i64s[i] = 1 55 } else { 56 i64s[i] = 0 57 } 58 } 59 return nil 60 } 61 62 func (b *builtinLTRealSig) vectorized() bool { 63 return true 64 } 65 66 func (b *builtinLTDecimalSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 67 n := input.NumEvents() 68 buf0, err := b.bufSlabPredictor.get(types.ETDecimal, n) 69 if err != nil { 70 return err 71 } 72 defer b.bufSlabPredictor.put(buf0) 73 if err := b.args[0].VecEvalDecimal(b.ctx, input, buf0); err != nil { 74 return err 75 } 76 buf1, err := b.bufSlabPredictor.get(types.ETDecimal, n) 77 if err != nil { 78 return err 79 } 80 defer b.bufSlabPredictor.put(buf1) 81 if err := b.args[1].VecEvalDecimal(b.ctx, input, buf1); err != nil { 82 return err 83 } 84 85 arg0 := buf0.Decimals() 86 arg1 := buf1.Decimals() 87 result.ResizeInt64(n, false) 88 result.MergeNulls(buf0, buf1) 89 i64s := result.Int64s() 90 for i := 0; i < n; i++ { 91 if result.IsNull(i) { 92 continue 93 } 94 val := arg0[i].Compare(&arg1[i]) 95 if val < 0 { 96 i64s[i] = 1 97 } else { 98 i64s[i] = 0 99 } 100 } 101 return nil 102 } 103 104 func (b *builtinLTDecimalSig) vectorized() bool { 105 return true 106 } 107 108 func (b *builtinLTStringSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 109 n := input.NumEvents() 110 buf0, err := b.bufSlabPredictor.get(types.ETString, n) 111 if err != nil { 112 return err 113 } 114 defer b.bufSlabPredictor.put(buf0) 115 if err := b.args[0].VecEvalString(b.ctx, input, buf0); err != nil { 116 return err 117 } 118 buf1, err := b.bufSlabPredictor.get(types.ETString, n) 119 if err != nil { 120 return err 121 } 122 defer b.bufSlabPredictor.put(buf1) 123 if err := b.args[1].VecEvalString(b.ctx, input, buf1); err != nil { 124 return err 125 } 126 127 result.ResizeInt64(n, false) 128 result.MergeNulls(buf0, buf1) 129 i64s := result.Int64s() 130 for i := 0; i < n; i++ { 131 if result.IsNull(i) { 132 continue 133 } 134 val := types.CompareString(buf0.GetString(i), buf1.GetString(i), b.defCauslation) 135 if val < 0 { 136 i64s[i] = 1 137 } else { 138 i64s[i] = 0 139 } 140 } 141 return nil 142 } 143 144 func (b *builtinLTStringSig) vectorized() bool { 145 return true 146 } 147 148 func (b *builtinLTTimeSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 149 n := input.NumEvents() 150 buf0, err := b.bufSlabPredictor.get(types.ETDatetime, n) 151 if err != nil { 152 return err 153 } 154 defer b.bufSlabPredictor.put(buf0) 155 if err := b.args[0].VecEvalTime(b.ctx, input, buf0); err != nil { 156 return err 157 } 158 buf1, err := b.bufSlabPredictor.get(types.ETDatetime, n) 159 if err != nil { 160 return err 161 } 162 defer b.bufSlabPredictor.put(buf1) 163 if err := b.args[1].VecEvalTime(b.ctx, input, buf1); err != nil { 164 return err 165 } 166 167 arg0 := buf0.Times() 168 arg1 := buf1.Times() 169 result.ResizeInt64(n, false) 170 result.MergeNulls(buf0, buf1) 171 i64s := result.Int64s() 172 for i := 0; i < n; i++ { 173 if result.IsNull(i) { 174 continue 175 } 176 val := arg0[i].Compare(arg1[i]) 177 if val < 0 { 178 i64s[i] = 1 179 } else { 180 i64s[i] = 0 181 } 182 } 183 return nil 184 } 185 186 func (b *builtinLTTimeSig) vectorized() bool { 187 return true 188 } 189 190 func (b *builtinLTDurationSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 191 n := input.NumEvents() 192 buf0, err := b.bufSlabPredictor.get(types.ETDuration, n) 193 if err != nil { 194 return err 195 } 196 defer b.bufSlabPredictor.put(buf0) 197 if err := b.args[0].VecEvalDuration(b.ctx, input, buf0); err != nil { 198 return err 199 } 200 buf1, err := b.bufSlabPredictor.get(types.ETDuration, n) 201 if err != nil { 202 return err 203 } 204 defer b.bufSlabPredictor.put(buf1) 205 if err := b.args[1].VecEvalDuration(b.ctx, input, buf1); err != nil { 206 return err 207 } 208 209 arg0 := buf0.GoDurations() 210 arg1 := buf1.GoDurations() 211 result.ResizeInt64(n, false) 212 result.MergeNulls(buf0, buf1) 213 i64s := result.Int64s() 214 for i := 0; i < n; i++ { 215 if result.IsNull(i) { 216 continue 217 } 218 val := types.CompareDuration(arg0[i], arg1[i]) 219 if val < 0 { 220 i64s[i] = 1 221 } else { 222 i64s[i] = 0 223 } 224 } 225 return nil 226 } 227 228 func (b *builtinLTDurationSig) vectorized() bool { 229 return true 230 } 231 232 func (b *builtinLTJSONSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 233 n := input.NumEvents() 234 buf0, err := b.bufSlabPredictor.get(types.ETJson, n) 235 if err != nil { 236 return err 237 } 238 defer b.bufSlabPredictor.put(buf0) 239 if err := b.args[0].VecEvalJSON(b.ctx, input, buf0); err != nil { 240 return err 241 } 242 buf1, err := b.bufSlabPredictor.get(types.ETJson, n) 243 if err != nil { 244 return err 245 } 246 defer b.bufSlabPredictor.put(buf1) 247 if err := b.args[1].VecEvalJSON(b.ctx, input, buf1); err != nil { 248 return err 249 } 250 251 result.ResizeInt64(n, false) 252 result.MergeNulls(buf0, buf1) 253 i64s := result.Int64s() 254 for i := 0; i < n; i++ { 255 if result.IsNull(i) { 256 continue 257 } 258 val := json.CompareBinary(buf0.GetJSON(i), buf1.GetJSON(i)) 259 if val < 0 { 260 i64s[i] = 1 261 } else { 262 i64s[i] = 0 263 } 264 } 265 return nil 266 } 267 268 func (b *builtinLTJSONSig) vectorized() bool { 269 return true 270 } 271 272 func (b *builtinLERealSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 273 n := input.NumEvents() 274 buf0, err := b.bufSlabPredictor.get(types.ETReal, n) 275 if err != nil { 276 return err 277 } 278 defer b.bufSlabPredictor.put(buf0) 279 if err := b.args[0].VecEvalReal(b.ctx, input, buf0); err != nil { 280 return err 281 } 282 buf1, err := b.bufSlabPredictor.get(types.ETReal, n) 283 if err != nil { 284 return err 285 } 286 defer b.bufSlabPredictor.put(buf1) 287 if err := b.args[1].VecEvalReal(b.ctx, input, buf1); err != nil { 288 return err 289 } 290 291 arg0 := buf0.Float64s() 292 arg1 := buf1.Float64s() 293 result.ResizeInt64(n, false) 294 result.MergeNulls(buf0, buf1) 295 i64s := result.Int64s() 296 for i := 0; i < n; i++ { 297 if result.IsNull(i) { 298 continue 299 } 300 val := types.CompareFloat64(arg0[i], arg1[i]) 301 if val <= 0 { 302 i64s[i] = 1 303 } else { 304 i64s[i] = 0 305 } 306 } 307 return nil 308 } 309 310 func (b *builtinLERealSig) vectorized() bool { 311 return true 312 } 313 314 func (b *builtinLEDecimalSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 315 n := input.NumEvents() 316 buf0, err := b.bufSlabPredictor.get(types.ETDecimal, n) 317 if err != nil { 318 return err 319 } 320 defer b.bufSlabPredictor.put(buf0) 321 if err := b.args[0].VecEvalDecimal(b.ctx, input, buf0); err != nil { 322 return err 323 } 324 buf1, err := b.bufSlabPredictor.get(types.ETDecimal, n) 325 if err != nil { 326 return err 327 } 328 defer b.bufSlabPredictor.put(buf1) 329 if err := b.args[1].VecEvalDecimal(b.ctx, input, buf1); err != nil { 330 return err 331 } 332 333 arg0 := buf0.Decimals() 334 arg1 := buf1.Decimals() 335 result.ResizeInt64(n, false) 336 result.MergeNulls(buf0, buf1) 337 i64s := result.Int64s() 338 for i := 0; i < n; i++ { 339 if result.IsNull(i) { 340 continue 341 } 342 val := arg0[i].Compare(&arg1[i]) 343 if val <= 0 { 344 i64s[i] = 1 345 } else { 346 i64s[i] = 0 347 } 348 } 349 return nil 350 } 351 352 func (b *builtinLEDecimalSig) vectorized() bool { 353 return true 354 } 355 356 func (b *builtinLEStringSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 357 n := input.NumEvents() 358 buf0, err := b.bufSlabPredictor.get(types.ETString, n) 359 if err != nil { 360 return err 361 } 362 defer b.bufSlabPredictor.put(buf0) 363 if err := b.args[0].VecEvalString(b.ctx, input, buf0); err != nil { 364 return err 365 } 366 buf1, err := b.bufSlabPredictor.get(types.ETString, n) 367 if err != nil { 368 return err 369 } 370 defer b.bufSlabPredictor.put(buf1) 371 if err := b.args[1].VecEvalString(b.ctx, input, buf1); err != nil { 372 return err 373 } 374 375 result.ResizeInt64(n, false) 376 result.MergeNulls(buf0, buf1) 377 i64s := result.Int64s() 378 for i := 0; i < n; i++ { 379 if result.IsNull(i) { 380 continue 381 } 382 val := types.CompareString(buf0.GetString(i), buf1.GetString(i), b.defCauslation) 383 if val <= 0 { 384 i64s[i] = 1 385 } else { 386 i64s[i] = 0 387 } 388 } 389 return nil 390 } 391 392 func (b *builtinLEStringSig) vectorized() bool { 393 return true 394 } 395 396 func (b *builtinLETimeSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 397 n := input.NumEvents() 398 buf0, err := b.bufSlabPredictor.get(types.ETDatetime, n) 399 if err != nil { 400 return err 401 } 402 defer b.bufSlabPredictor.put(buf0) 403 if err := b.args[0].VecEvalTime(b.ctx, input, buf0); err != nil { 404 return err 405 } 406 buf1, err := b.bufSlabPredictor.get(types.ETDatetime, n) 407 if err != nil { 408 return err 409 } 410 defer b.bufSlabPredictor.put(buf1) 411 if err := b.args[1].VecEvalTime(b.ctx, input, buf1); err != nil { 412 return err 413 } 414 415 arg0 := buf0.Times() 416 arg1 := buf1.Times() 417 result.ResizeInt64(n, false) 418 result.MergeNulls(buf0, buf1) 419 i64s := result.Int64s() 420 for i := 0; i < n; i++ { 421 if result.IsNull(i) { 422 continue 423 } 424 val := arg0[i].Compare(arg1[i]) 425 if val <= 0 { 426 i64s[i] = 1 427 } else { 428 i64s[i] = 0 429 } 430 } 431 return nil 432 } 433 434 func (b *builtinLETimeSig) vectorized() bool { 435 return true 436 } 437 438 func (b *builtinLEDurationSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 439 n := input.NumEvents() 440 buf0, err := b.bufSlabPredictor.get(types.ETDuration, n) 441 if err != nil { 442 return err 443 } 444 defer b.bufSlabPredictor.put(buf0) 445 if err := b.args[0].VecEvalDuration(b.ctx, input, buf0); err != nil { 446 return err 447 } 448 buf1, err := b.bufSlabPredictor.get(types.ETDuration, n) 449 if err != nil { 450 return err 451 } 452 defer b.bufSlabPredictor.put(buf1) 453 if err := b.args[1].VecEvalDuration(b.ctx, input, buf1); err != nil { 454 return err 455 } 456 457 arg0 := buf0.GoDurations() 458 arg1 := buf1.GoDurations() 459 result.ResizeInt64(n, false) 460 result.MergeNulls(buf0, buf1) 461 i64s := result.Int64s() 462 for i := 0; i < n; i++ { 463 if result.IsNull(i) { 464 continue 465 } 466 val := types.CompareDuration(arg0[i], arg1[i]) 467 if val <= 0 { 468 i64s[i] = 1 469 } else { 470 i64s[i] = 0 471 } 472 } 473 return nil 474 } 475 476 func (b *builtinLEDurationSig) vectorized() bool { 477 return true 478 } 479 480 func (b *builtinLEJSONSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 481 n := input.NumEvents() 482 buf0, err := b.bufSlabPredictor.get(types.ETJson, n) 483 if err != nil { 484 return err 485 } 486 defer b.bufSlabPredictor.put(buf0) 487 if err := b.args[0].VecEvalJSON(b.ctx, input, buf0); err != nil { 488 return err 489 } 490 buf1, err := b.bufSlabPredictor.get(types.ETJson, n) 491 if err != nil { 492 return err 493 } 494 defer b.bufSlabPredictor.put(buf1) 495 if err := b.args[1].VecEvalJSON(b.ctx, input, buf1); err != nil { 496 return err 497 } 498 499 result.ResizeInt64(n, false) 500 result.MergeNulls(buf0, buf1) 501 i64s := result.Int64s() 502 for i := 0; i < n; i++ { 503 if result.IsNull(i) { 504 continue 505 } 506 val := json.CompareBinary(buf0.GetJSON(i), buf1.GetJSON(i)) 507 if val <= 0 { 508 i64s[i] = 1 509 } else { 510 i64s[i] = 0 511 } 512 } 513 return nil 514 } 515 516 func (b *builtinLEJSONSig) vectorized() bool { 517 return true 518 } 519 520 func (b *builtinGTRealSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 521 n := input.NumEvents() 522 buf0, err := b.bufSlabPredictor.get(types.ETReal, n) 523 if err != nil { 524 return err 525 } 526 defer b.bufSlabPredictor.put(buf0) 527 if err := b.args[0].VecEvalReal(b.ctx, input, buf0); err != nil { 528 return err 529 } 530 buf1, err := b.bufSlabPredictor.get(types.ETReal, n) 531 if err != nil { 532 return err 533 } 534 defer b.bufSlabPredictor.put(buf1) 535 if err := b.args[1].VecEvalReal(b.ctx, input, buf1); err != nil { 536 return err 537 } 538 539 arg0 := buf0.Float64s() 540 arg1 := buf1.Float64s() 541 result.ResizeInt64(n, false) 542 result.MergeNulls(buf0, buf1) 543 i64s := result.Int64s() 544 for i := 0; i < n; i++ { 545 if result.IsNull(i) { 546 continue 547 } 548 val := types.CompareFloat64(arg0[i], arg1[i]) 549 if val > 0 { 550 i64s[i] = 1 551 } else { 552 i64s[i] = 0 553 } 554 } 555 return nil 556 } 557 558 func (b *builtinGTRealSig) vectorized() bool { 559 return true 560 } 561 562 func (b *builtinGTDecimalSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 563 n := input.NumEvents() 564 buf0, err := b.bufSlabPredictor.get(types.ETDecimal, n) 565 if err != nil { 566 return err 567 } 568 defer b.bufSlabPredictor.put(buf0) 569 if err := b.args[0].VecEvalDecimal(b.ctx, input, buf0); err != nil { 570 return err 571 } 572 buf1, err := b.bufSlabPredictor.get(types.ETDecimal, n) 573 if err != nil { 574 return err 575 } 576 defer b.bufSlabPredictor.put(buf1) 577 if err := b.args[1].VecEvalDecimal(b.ctx, input, buf1); err != nil { 578 return err 579 } 580 581 arg0 := buf0.Decimals() 582 arg1 := buf1.Decimals() 583 result.ResizeInt64(n, false) 584 result.MergeNulls(buf0, buf1) 585 i64s := result.Int64s() 586 for i := 0; i < n; i++ { 587 if result.IsNull(i) { 588 continue 589 } 590 val := arg0[i].Compare(&arg1[i]) 591 if val > 0 { 592 i64s[i] = 1 593 } else { 594 i64s[i] = 0 595 } 596 } 597 return nil 598 } 599 600 func (b *builtinGTDecimalSig) vectorized() bool { 601 return true 602 } 603 604 func (b *builtinGTStringSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 605 n := input.NumEvents() 606 buf0, err := b.bufSlabPredictor.get(types.ETString, n) 607 if err != nil { 608 return err 609 } 610 defer b.bufSlabPredictor.put(buf0) 611 if err := b.args[0].VecEvalString(b.ctx, input, buf0); err != nil { 612 return err 613 } 614 buf1, err := b.bufSlabPredictor.get(types.ETString, n) 615 if err != nil { 616 return err 617 } 618 defer b.bufSlabPredictor.put(buf1) 619 if err := b.args[1].VecEvalString(b.ctx, input, buf1); err != nil { 620 return err 621 } 622 623 result.ResizeInt64(n, false) 624 result.MergeNulls(buf0, buf1) 625 i64s := result.Int64s() 626 for i := 0; i < n; i++ { 627 if result.IsNull(i) { 628 continue 629 } 630 val := types.CompareString(buf0.GetString(i), buf1.GetString(i), b.defCauslation) 631 if val > 0 { 632 i64s[i] = 1 633 } else { 634 i64s[i] = 0 635 } 636 } 637 return nil 638 } 639 640 func (b *builtinGTStringSig) vectorized() bool { 641 return true 642 } 643 644 func (b *builtinGTTimeSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 645 n := input.NumEvents() 646 buf0, err := b.bufSlabPredictor.get(types.ETDatetime, n) 647 if err != nil { 648 return err 649 } 650 defer b.bufSlabPredictor.put(buf0) 651 if err := b.args[0].VecEvalTime(b.ctx, input, buf0); err != nil { 652 return err 653 } 654 buf1, err := b.bufSlabPredictor.get(types.ETDatetime, n) 655 if err != nil { 656 return err 657 } 658 defer b.bufSlabPredictor.put(buf1) 659 if err := b.args[1].VecEvalTime(b.ctx, input, buf1); err != nil { 660 return err 661 } 662 663 arg0 := buf0.Times() 664 arg1 := buf1.Times() 665 result.ResizeInt64(n, false) 666 result.MergeNulls(buf0, buf1) 667 i64s := result.Int64s() 668 for i := 0; i < n; i++ { 669 if result.IsNull(i) { 670 continue 671 } 672 val := arg0[i].Compare(arg1[i]) 673 if val > 0 { 674 i64s[i] = 1 675 } else { 676 i64s[i] = 0 677 } 678 } 679 return nil 680 } 681 682 func (b *builtinGTTimeSig) vectorized() bool { 683 return true 684 } 685 686 func (b *builtinGTDurationSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 687 n := input.NumEvents() 688 buf0, err := b.bufSlabPredictor.get(types.ETDuration, n) 689 if err != nil { 690 return err 691 } 692 defer b.bufSlabPredictor.put(buf0) 693 if err := b.args[0].VecEvalDuration(b.ctx, input, buf0); err != nil { 694 return err 695 } 696 buf1, err := b.bufSlabPredictor.get(types.ETDuration, n) 697 if err != nil { 698 return err 699 } 700 defer b.bufSlabPredictor.put(buf1) 701 if err := b.args[1].VecEvalDuration(b.ctx, input, buf1); err != nil { 702 return err 703 } 704 705 arg0 := buf0.GoDurations() 706 arg1 := buf1.GoDurations() 707 result.ResizeInt64(n, false) 708 result.MergeNulls(buf0, buf1) 709 i64s := result.Int64s() 710 for i := 0; i < n; i++ { 711 if result.IsNull(i) { 712 continue 713 } 714 val := types.CompareDuration(arg0[i], arg1[i]) 715 if val > 0 { 716 i64s[i] = 1 717 } else { 718 i64s[i] = 0 719 } 720 } 721 return nil 722 } 723 724 func (b *builtinGTDurationSig) vectorized() bool { 725 return true 726 } 727 728 func (b *builtinGTJSONSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 729 n := input.NumEvents() 730 buf0, err := b.bufSlabPredictor.get(types.ETJson, n) 731 if err != nil { 732 return err 733 } 734 defer b.bufSlabPredictor.put(buf0) 735 if err := b.args[0].VecEvalJSON(b.ctx, input, buf0); err != nil { 736 return err 737 } 738 buf1, err := b.bufSlabPredictor.get(types.ETJson, n) 739 if err != nil { 740 return err 741 } 742 defer b.bufSlabPredictor.put(buf1) 743 if err := b.args[1].VecEvalJSON(b.ctx, input, buf1); err != nil { 744 return err 745 } 746 747 result.ResizeInt64(n, false) 748 result.MergeNulls(buf0, buf1) 749 i64s := result.Int64s() 750 for i := 0; i < n; i++ { 751 if result.IsNull(i) { 752 continue 753 } 754 val := json.CompareBinary(buf0.GetJSON(i), buf1.GetJSON(i)) 755 if val > 0 { 756 i64s[i] = 1 757 } else { 758 i64s[i] = 0 759 } 760 } 761 return nil 762 } 763 764 func (b *builtinGTJSONSig) vectorized() bool { 765 return true 766 } 767 768 func (b *builtinGERealSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 769 n := input.NumEvents() 770 buf0, err := b.bufSlabPredictor.get(types.ETReal, n) 771 if err != nil { 772 return err 773 } 774 defer b.bufSlabPredictor.put(buf0) 775 if err := b.args[0].VecEvalReal(b.ctx, input, buf0); err != nil { 776 return err 777 } 778 buf1, err := b.bufSlabPredictor.get(types.ETReal, n) 779 if err != nil { 780 return err 781 } 782 defer b.bufSlabPredictor.put(buf1) 783 if err := b.args[1].VecEvalReal(b.ctx, input, buf1); err != nil { 784 return err 785 } 786 787 arg0 := buf0.Float64s() 788 arg1 := buf1.Float64s() 789 result.ResizeInt64(n, false) 790 result.MergeNulls(buf0, buf1) 791 i64s := result.Int64s() 792 for i := 0; i < n; i++ { 793 if result.IsNull(i) { 794 continue 795 } 796 val := types.CompareFloat64(arg0[i], arg1[i]) 797 if val >= 0 { 798 i64s[i] = 1 799 } else { 800 i64s[i] = 0 801 } 802 } 803 return nil 804 } 805 806 func (b *builtinGERealSig) vectorized() bool { 807 return true 808 } 809 810 func (b *builtinGEDecimalSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 811 n := input.NumEvents() 812 buf0, err := b.bufSlabPredictor.get(types.ETDecimal, n) 813 if err != nil { 814 return err 815 } 816 defer b.bufSlabPredictor.put(buf0) 817 if err := b.args[0].VecEvalDecimal(b.ctx, input, buf0); err != nil { 818 return err 819 } 820 buf1, err := b.bufSlabPredictor.get(types.ETDecimal, n) 821 if err != nil { 822 return err 823 } 824 defer b.bufSlabPredictor.put(buf1) 825 if err := b.args[1].VecEvalDecimal(b.ctx, input, buf1); err != nil { 826 return err 827 } 828 829 arg0 := buf0.Decimals() 830 arg1 := buf1.Decimals() 831 result.ResizeInt64(n, false) 832 result.MergeNulls(buf0, buf1) 833 i64s := result.Int64s() 834 for i := 0; i < n; i++ { 835 if result.IsNull(i) { 836 continue 837 } 838 val := arg0[i].Compare(&arg1[i]) 839 if val >= 0 { 840 i64s[i] = 1 841 } else { 842 i64s[i] = 0 843 } 844 } 845 return nil 846 } 847 848 func (b *builtinGEDecimalSig) vectorized() bool { 849 return true 850 } 851 852 func (b *builtinGEStringSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 853 n := input.NumEvents() 854 buf0, err := b.bufSlabPredictor.get(types.ETString, n) 855 if err != nil { 856 return err 857 } 858 defer b.bufSlabPredictor.put(buf0) 859 if err := b.args[0].VecEvalString(b.ctx, input, buf0); err != nil { 860 return err 861 } 862 buf1, err := b.bufSlabPredictor.get(types.ETString, n) 863 if err != nil { 864 return err 865 } 866 defer b.bufSlabPredictor.put(buf1) 867 if err := b.args[1].VecEvalString(b.ctx, input, buf1); err != nil { 868 return err 869 } 870 871 result.ResizeInt64(n, false) 872 result.MergeNulls(buf0, buf1) 873 i64s := result.Int64s() 874 for i := 0; i < n; i++ { 875 if result.IsNull(i) { 876 continue 877 } 878 val := types.CompareString(buf0.GetString(i), buf1.GetString(i), b.defCauslation) 879 if val >= 0 { 880 i64s[i] = 1 881 } else { 882 i64s[i] = 0 883 } 884 } 885 return nil 886 } 887 888 func (b *builtinGEStringSig) vectorized() bool { 889 return true 890 } 891 892 func (b *builtinGETimeSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 893 n := input.NumEvents() 894 buf0, err := b.bufSlabPredictor.get(types.ETDatetime, n) 895 if err != nil { 896 return err 897 } 898 defer b.bufSlabPredictor.put(buf0) 899 if err := b.args[0].VecEvalTime(b.ctx, input, buf0); err != nil { 900 return err 901 } 902 buf1, err := b.bufSlabPredictor.get(types.ETDatetime, n) 903 if err != nil { 904 return err 905 } 906 defer b.bufSlabPredictor.put(buf1) 907 if err := b.args[1].VecEvalTime(b.ctx, input, buf1); err != nil { 908 return err 909 } 910 911 arg0 := buf0.Times() 912 arg1 := buf1.Times() 913 result.ResizeInt64(n, false) 914 result.MergeNulls(buf0, buf1) 915 i64s := result.Int64s() 916 for i := 0; i < n; i++ { 917 if result.IsNull(i) { 918 continue 919 } 920 val := arg0[i].Compare(arg1[i]) 921 if val >= 0 { 922 i64s[i] = 1 923 } else { 924 i64s[i] = 0 925 } 926 } 927 return nil 928 } 929 930 func (b *builtinGETimeSig) vectorized() bool { 931 return true 932 } 933 934 func (b *builtinGEDurationSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 935 n := input.NumEvents() 936 buf0, err := b.bufSlabPredictor.get(types.ETDuration, n) 937 if err != nil { 938 return err 939 } 940 defer b.bufSlabPredictor.put(buf0) 941 if err := b.args[0].VecEvalDuration(b.ctx, input, buf0); err != nil { 942 return err 943 } 944 buf1, err := b.bufSlabPredictor.get(types.ETDuration, n) 945 if err != nil { 946 return err 947 } 948 defer b.bufSlabPredictor.put(buf1) 949 if err := b.args[1].VecEvalDuration(b.ctx, input, buf1); err != nil { 950 return err 951 } 952 953 arg0 := buf0.GoDurations() 954 arg1 := buf1.GoDurations() 955 result.ResizeInt64(n, false) 956 result.MergeNulls(buf0, buf1) 957 i64s := result.Int64s() 958 for i := 0; i < n; i++ { 959 if result.IsNull(i) { 960 continue 961 } 962 val := types.CompareDuration(arg0[i], arg1[i]) 963 if val >= 0 { 964 i64s[i] = 1 965 } else { 966 i64s[i] = 0 967 } 968 } 969 return nil 970 } 971 972 func (b *builtinGEDurationSig) vectorized() bool { 973 return true 974 } 975 976 func (b *builtinGEJSONSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 977 n := input.NumEvents() 978 buf0, err := b.bufSlabPredictor.get(types.ETJson, n) 979 if err != nil { 980 return err 981 } 982 defer b.bufSlabPredictor.put(buf0) 983 if err := b.args[0].VecEvalJSON(b.ctx, input, buf0); err != nil { 984 return err 985 } 986 buf1, err := b.bufSlabPredictor.get(types.ETJson, n) 987 if err != nil { 988 return err 989 } 990 defer b.bufSlabPredictor.put(buf1) 991 if err := b.args[1].VecEvalJSON(b.ctx, input, buf1); err != nil { 992 return err 993 } 994 995 result.ResizeInt64(n, false) 996 result.MergeNulls(buf0, buf1) 997 i64s := result.Int64s() 998 for i := 0; i < n; i++ { 999 if result.IsNull(i) { 1000 continue 1001 } 1002 val := json.CompareBinary(buf0.GetJSON(i), buf1.GetJSON(i)) 1003 if val >= 0 { 1004 i64s[i] = 1 1005 } else { 1006 i64s[i] = 0 1007 } 1008 } 1009 return nil 1010 } 1011 1012 func (b *builtinGEJSONSig) vectorized() bool { 1013 return true 1014 } 1015 1016 func (b *builtinEQRealSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1017 n := input.NumEvents() 1018 buf0, err := b.bufSlabPredictor.get(types.ETReal, n) 1019 if err != nil { 1020 return err 1021 } 1022 defer b.bufSlabPredictor.put(buf0) 1023 if err := b.args[0].VecEvalReal(b.ctx, input, buf0); err != nil { 1024 return err 1025 } 1026 buf1, err := b.bufSlabPredictor.get(types.ETReal, n) 1027 if err != nil { 1028 return err 1029 } 1030 defer b.bufSlabPredictor.put(buf1) 1031 if err := b.args[1].VecEvalReal(b.ctx, input, buf1); err != nil { 1032 return err 1033 } 1034 1035 arg0 := buf0.Float64s() 1036 arg1 := buf1.Float64s() 1037 result.ResizeInt64(n, false) 1038 result.MergeNulls(buf0, buf1) 1039 i64s := result.Int64s() 1040 for i := 0; i < n; i++ { 1041 if result.IsNull(i) { 1042 continue 1043 } 1044 val := types.CompareFloat64(arg0[i], arg1[i]) 1045 if val == 0 { 1046 i64s[i] = 1 1047 } else { 1048 i64s[i] = 0 1049 } 1050 } 1051 return nil 1052 } 1053 1054 func (b *builtinEQRealSig) vectorized() bool { 1055 return true 1056 } 1057 1058 func (b *builtinEQDecimalSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1059 n := input.NumEvents() 1060 buf0, err := b.bufSlabPredictor.get(types.ETDecimal, n) 1061 if err != nil { 1062 return err 1063 } 1064 defer b.bufSlabPredictor.put(buf0) 1065 if err := b.args[0].VecEvalDecimal(b.ctx, input, buf0); err != nil { 1066 return err 1067 } 1068 buf1, err := b.bufSlabPredictor.get(types.ETDecimal, n) 1069 if err != nil { 1070 return err 1071 } 1072 defer b.bufSlabPredictor.put(buf1) 1073 if err := b.args[1].VecEvalDecimal(b.ctx, input, buf1); err != nil { 1074 return err 1075 } 1076 1077 arg0 := buf0.Decimals() 1078 arg1 := buf1.Decimals() 1079 result.ResizeInt64(n, false) 1080 result.MergeNulls(buf0, buf1) 1081 i64s := result.Int64s() 1082 for i := 0; i < n; i++ { 1083 if result.IsNull(i) { 1084 continue 1085 } 1086 val := arg0[i].Compare(&arg1[i]) 1087 if val == 0 { 1088 i64s[i] = 1 1089 } else { 1090 i64s[i] = 0 1091 } 1092 } 1093 return nil 1094 } 1095 1096 func (b *builtinEQDecimalSig) vectorized() bool { 1097 return true 1098 } 1099 1100 func (b *builtinEQStringSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1101 n := input.NumEvents() 1102 buf0, err := b.bufSlabPredictor.get(types.ETString, n) 1103 if err != nil { 1104 return err 1105 } 1106 defer b.bufSlabPredictor.put(buf0) 1107 if err := b.args[0].VecEvalString(b.ctx, input, buf0); err != nil { 1108 return err 1109 } 1110 buf1, err := b.bufSlabPredictor.get(types.ETString, n) 1111 if err != nil { 1112 return err 1113 } 1114 defer b.bufSlabPredictor.put(buf1) 1115 if err := b.args[1].VecEvalString(b.ctx, input, buf1); err != nil { 1116 return err 1117 } 1118 1119 result.ResizeInt64(n, false) 1120 result.MergeNulls(buf0, buf1) 1121 i64s := result.Int64s() 1122 for i := 0; i < n; i++ { 1123 if result.IsNull(i) { 1124 continue 1125 } 1126 val := types.CompareString(buf0.GetString(i), buf1.GetString(i), b.defCauslation) 1127 if val == 0 { 1128 i64s[i] = 1 1129 } else { 1130 i64s[i] = 0 1131 } 1132 } 1133 return nil 1134 } 1135 1136 func (b *builtinEQStringSig) vectorized() bool { 1137 return true 1138 } 1139 1140 func (b *builtinEQTimeSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1141 n := input.NumEvents() 1142 buf0, err := b.bufSlabPredictor.get(types.ETDatetime, n) 1143 if err != nil { 1144 return err 1145 } 1146 defer b.bufSlabPredictor.put(buf0) 1147 if err := b.args[0].VecEvalTime(b.ctx, input, buf0); err != nil { 1148 return err 1149 } 1150 buf1, err := b.bufSlabPredictor.get(types.ETDatetime, n) 1151 if err != nil { 1152 return err 1153 } 1154 defer b.bufSlabPredictor.put(buf1) 1155 if err := b.args[1].VecEvalTime(b.ctx, input, buf1); err != nil { 1156 return err 1157 } 1158 1159 arg0 := buf0.Times() 1160 arg1 := buf1.Times() 1161 result.ResizeInt64(n, false) 1162 result.MergeNulls(buf0, buf1) 1163 i64s := result.Int64s() 1164 for i := 0; i < n; i++ { 1165 if result.IsNull(i) { 1166 continue 1167 } 1168 val := arg0[i].Compare(arg1[i]) 1169 if val == 0 { 1170 i64s[i] = 1 1171 } else { 1172 i64s[i] = 0 1173 } 1174 } 1175 return nil 1176 } 1177 1178 func (b *builtinEQTimeSig) vectorized() bool { 1179 return true 1180 } 1181 1182 func (b *builtinEQDurationSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1183 n := input.NumEvents() 1184 buf0, err := b.bufSlabPredictor.get(types.ETDuration, n) 1185 if err != nil { 1186 return err 1187 } 1188 defer b.bufSlabPredictor.put(buf0) 1189 if err := b.args[0].VecEvalDuration(b.ctx, input, buf0); err != nil { 1190 return err 1191 } 1192 buf1, err := b.bufSlabPredictor.get(types.ETDuration, n) 1193 if err != nil { 1194 return err 1195 } 1196 defer b.bufSlabPredictor.put(buf1) 1197 if err := b.args[1].VecEvalDuration(b.ctx, input, buf1); err != nil { 1198 return err 1199 } 1200 1201 arg0 := buf0.GoDurations() 1202 arg1 := buf1.GoDurations() 1203 result.ResizeInt64(n, false) 1204 result.MergeNulls(buf0, buf1) 1205 i64s := result.Int64s() 1206 for i := 0; i < n; i++ { 1207 if result.IsNull(i) { 1208 continue 1209 } 1210 val := types.CompareDuration(arg0[i], arg1[i]) 1211 if val == 0 { 1212 i64s[i] = 1 1213 } else { 1214 i64s[i] = 0 1215 } 1216 } 1217 return nil 1218 } 1219 1220 func (b *builtinEQDurationSig) vectorized() bool { 1221 return true 1222 } 1223 1224 func (b *builtinEQJSONSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1225 n := input.NumEvents() 1226 buf0, err := b.bufSlabPredictor.get(types.ETJson, n) 1227 if err != nil { 1228 return err 1229 } 1230 defer b.bufSlabPredictor.put(buf0) 1231 if err := b.args[0].VecEvalJSON(b.ctx, input, buf0); err != nil { 1232 return err 1233 } 1234 buf1, err := b.bufSlabPredictor.get(types.ETJson, n) 1235 if err != nil { 1236 return err 1237 } 1238 defer b.bufSlabPredictor.put(buf1) 1239 if err := b.args[1].VecEvalJSON(b.ctx, input, buf1); err != nil { 1240 return err 1241 } 1242 1243 result.ResizeInt64(n, false) 1244 result.MergeNulls(buf0, buf1) 1245 i64s := result.Int64s() 1246 for i := 0; i < n; i++ { 1247 if result.IsNull(i) { 1248 continue 1249 } 1250 val := json.CompareBinary(buf0.GetJSON(i), buf1.GetJSON(i)) 1251 if val == 0 { 1252 i64s[i] = 1 1253 } else { 1254 i64s[i] = 0 1255 } 1256 } 1257 return nil 1258 } 1259 1260 func (b *builtinEQJSONSig) vectorized() bool { 1261 return true 1262 } 1263 1264 func (b *builtinNERealSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1265 n := input.NumEvents() 1266 buf0, err := b.bufSlabPredictor.get(types.ETReal, n) 1267 if err != nil { 1268 return err 1269 } 1270 defer b.bufSlabPredictor.put(buf0) 1271 if err := b.args[0].VecEvalReal(b.ctx, input, buf0); err != nil { 1272 return err 1273 } 1274 buf1, err := b.bufSlabPredictor.get(types.ETReal, n) 1275 if err != nil { 1276 return err 1277 } 1278 defer b.bufSlabPredictor.put(buf1) 1279 if err := b.args[1].VecEvalReal(b.ctx, input, buf1); err != nil { 1280 return err 1281 } 1282 1283 arg0 := buf0.Float64s() 1284 arg1 := buf1.Float64s() 1285 result.ResizeInt64(n, false) 1286 result.MergeNulls(buf0, buf1) 1287 i64s := result.Int64s() 1288 for i := 0; i < n; i++ { 1289 if result.IsNull(i) { 1290 continue 1291 } 1292 val := types.CompareFloat64(arg0[i], arg1[i]) 1293 if val != 0 { 1294 i64s[i] = 1 1295 } else { 1296 i64s[i] = 0 1297 } 1298 } 1299 return nil 1300 } 1301 1302 func (b *builtinNERealSig) vectorized() bool { 1303 return true 1304 } 1305 1306 func (b *builtinNEDecimalSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1307 n := input.NumEvents() 1308 buf0, err := b.bufSlabPredictor.get(types.ETDecimal, n) 1309 if err != nil { 1310 return err 1311 } 1312 defer b.bufSlabPredictor.put(buf0) 1313 if err := b.args[0].VecEvalDecimal(b.ctx, input, buf0); err != nil { 1314 return err 1315 } 1316 buf1, err := b.bufSlabPredictor.get(types.ETDecimal, n) 1317 if err != nil { 1318 return err 1319 } 1320 defer b.bufSlabPredictor.put(buf1) 1321 if err := b.args[1].VecEvalDecimal(b.ctx, input, buf1); err != nil { 1322 return err 1323 } 1324 1325 arg0 := buf0.Decimals() 1326 arg1 := buf1.Decimals() 1327 result.ResizeInt64(n, false) 1328 result.MergeNulls(buf0, buf1) 1329 i64s := result.Int64s() 1330 for i := 0; i < n; i++ { 1331 if result.IsNull(i) { 1332 continue 1333 } 1334 val := arg0[i].Compare(&arg1[i]) 1335 if val != 0 { 1336 i64s[i] = 1 1337 } else { 1338 i64s[i] = 0 1339 } 1340 } 1341 return nil 1342 } 1343 1344 func (b *builtinNEDecimalSig) vectorized() bool { 1345 return true 1346 } 1347 1348 func (b *builtinNEStringSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1349 n := input.NumEvents() 1350 buf0, err := b.bufSlabPredictor.get(types.ETString, n) 1351 if err != nil { 1352 return err 1353 } 1354 defer b.bufSlabPredictor.put(buf0) 1355 if err := b.args[0].VecEvalString(b.ctx, input, buf0); err != nil { 1356 return err 1357 } 1358 buf1, err := b.bufSlabPredictor.get(types.ETString, n) 1359 if err != nil { 1360 return err 1361 } 1362 defer b.bufSlabPredictor.put(buf1) 1363 if err := b.args[1].VecEvalString(b.ctx, input, buf1); err != nil { 1364 return err 1365 } 1366 1367 result.ResizeInt64(n, false) 1368 result.MergeNulls(buf0, buf1) 1369 i64s := result.Int64s() 1370 for i := 0; i < n; i++ { 1371 if result.IsNull(i) { 1372 continue 1373 } 1374 val := types.CompareString(buf0.GetString(i), buf1.GetString(i), b.defCauslation) 1375 if val != 0 { 1376 i64s[i] = 1 1377 } else { 1378 i64s[i] = 0 1379 } 1380 } 1381 return nil 1382 } 1383 1384 func (b *builtinNEStringSig) vectorized() bool { 1385 return true 1386 } 1387 1388 func (b *builtinNETimeSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1389 n := input.NumEvents() 1390 buf0, err := b.bufSlabPredictor.get(types.ETDatetime, n) 1391 if err != nil { 1392 return err 1393 } 1394 defer b.bufSlabPredictor.put(buf0) 1395 if err := b.args[0].VecEvalTime(b.ctx, input, buf0); err != nil { 1396 return err 1397 } 1398 buf1, err := b.bufSlabPredictor.get(types.ETDatetime, n) 1399 if err != nil { 1400 return err 1401 } 1402 defer b.bufSlabPredictor.put(buf1) 1403 if err := b.args[1].VecEvalTime(b.ctx, input, buf1); err != nil { 1404 return err 1405 } 1406 1407 arg0 := buf0.Times() 1408 arg1 := buf1.Times() 1409 result.ResizeInt64(n, false) 1410 result.MergeNulls(buf0, buf1) 1411 i64s := result.Int64s() 1412 for i := 0; i < n; i++ { 1413 if result.IsNull(i) { 1414 continue 1415 } 1416 val := arg0[i].Compare(arg1[i]) 1417 if val != 0 { 1418 i64s[i] = 1 1419 } else { 1420 i64s[i] = 0 1421 } 1422 } 1423 return nil 1424 } 1425 1426 func (b *builtinNETimeSig) vectorized() bool { 1427 return true 1428 } 1429 1430 func (b *builtinNEDurationSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1431 n := input.NumEvents() 1432 buf0, err := b.bufSlabPredictor.get(types.ETDuration, n) 1433 if err != nil { 1434 return err 1435 } 1436 defer b.bufSlabPredictor.put(buf0) 1437 if err := b.args[0].VecEvalDuration(b.ctx, input, buf0); err != nil { 1438 return err 1439 } 1440 buf1, err := b.bufSlabPredictor.get(types.ETDuration, n) 1441 if err != nil { 1442 return err 1443 } 1444 defer b.bufSlabPredictor.put(buf1) 1445 if err := b.args[1].VecEvalDuration(b.ctx, input, buf1); err != nil { 1446 return err 1447 } 1448 1449 arg0 := buf0.GoDurations() 1450 arg1 := buf1.GoDurations() 1451 result.ResizeInt64(n, false) 1452 result.MergeNulls(buf0, buf1) 1453 i64s := result.Int64s() 1454 for i := 0; i < n; i++ { 1455 if result.IsNull(i) { 1456 continue 1457 } 1458 val := types.CompareDuration(arg0[i], arg1[i]) 1459 if val != 0 { 1460 i64s[i] = 1 1461 } else { 1462 i64s[i] = 0 1463 } 1464 } 1465 return nil 1466 } 1467 1468 func (b *builtinNEDurationSig) vectorized() bool { 1469 return true 1470 } 1471 1472 func (b *builtinNEJSONSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1473 n := input.NumEvents() 1474 buf0, err := b.bufSlabPredictor.get(types.ETJson, n) 1475 if err != nil { 1476 return err 1477 } 1478 defer b.bufSlabPredictor.put(buf0) 1479 if err := b.args[0].VecEvalJSON(b.ctx, input, buf0); err != nil { 1480 return err 1481 } 1482 buf1, err := b.bufSlabPredictor.get(types.ETJson, n) 1483 if err != nil { 1484 return err 1485 } 1486 defer b.bufSlabPredictor.put(buf1) 1487 if err := b.args[1].VecEvalJSON(b.ctx, input, buf1); err != nil { 1488 return err 1489 } 1490 1491 result.ResizeInt64(n, false) 1492 result.MergeNulls(buf0, buf1) 1493 i64s := result.Int64s() 1494 for i := 0; i < n; i++ { 1495 if result.IsNull(i) { 1496 continue 1497 } 1498 val := json.CompareBinary(buf0.GetJSON(i), buf1.GetJSON(i)) 1499 if val != 0 { 1500 i64s[i] = 1 1501 } else { 1502 i64s[i] = 0 1503 } 1504 } 1505 return nil 1506 } 1507 1508 func (b *builtinNEJSONSig) vectorized() bool { 1509 return true 1510 } 1511 1512 func (b *builtinNullEQRealSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1513 n := input.NumEvents() 1514 buf0, err := b.bufSlabPredictor.get(types.ETReal, n) 1515 if err != nil { 1516 return err 1517 } 1518 defer b.bufSlabPredictor.put(buf0) 1519 if err := b.args[0].VecEvalReal(b.ctx, input, buf0); err != nil { 1520 return err 1521 } 1522 buf1, err := b.bufSlabPredictor.get(types.ETReal, n) 1523 if err != nil { 1524 return err 1525 } 1526 defer b.bufSlabPredictor.put(buf1) 1527 if err := b.args[1].VecEvalReal(b.ctx, input, buf1); err != nil { 1528 return err 1529 } 1530 1531 arg0 := buf0.Float64s() 1532 arg1 := buf1.Float64s() 1533 result.ResizeInt64(n, false) 1534 i64s := result.Int64s() 1535 for i := 0; i < n; i++ { 1536 isNull0 := buf0.IsNull(i) 1537 isNull1 := buf1.IsNull(i) 1538 switch { 1539 case isNull0 && isNull1: 1540 i64s[i] = 1 1541 case isNull0 != isNull1: 1542 i64s[i] = 0 1543 case types.CompareFloat64(arg0[i], arg1[i]) == 0: 1544 i64s[i] = 1 1545 } 1546 } 1547 return nil 1548 } 1549 1550 func (b *builtinNullEQRealSig) vectorized() bool { 1551 return true 1552 } 1553 1554 func (b *builtinNullEQDecimalSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1555 n := input.NumEvents() 1556 buf0, err := b.bufSlabPredictor.get(types.ETDecimal, n) 1557 if err != nil { 1558 return err 1559 } 1560 defer b.bufSlabPredictor.put(buf0) 1561 if err := b.args[0].VecEvalDecimal(b.ctx, input, buf0); err != nil { 1562 return err 1563 } 1564 buf1, err := b.bufSlabPredictor.get(types.ETDecimal, n) 1565 if err != nil { 1566 return err 1567 } 1568 defer b.bufSlabPredictor.put(buf1) 1569 if err := b.args[1].VecEvalDecimal(b.ctx, input, buf1); err != nil { 1570 return err 1571 } 1572 1573 arg0 := buf0.Decimals() 1574 arg1 := buf1.Decimals() 1575 result.ResizeInt64(n, false) 1576 i64s := result.Int64s() 1577 for i := 0; i < n; i++ { 1578 isNull0 := buf0.IsNull(i) 1579 isNull1 := buf1.IsNull(i) 1580 switch { 1581 case isNull0 && isNull1: 1582 i64s[i] = 1 1583 case isNull0 != isNull1: 1584 i64s[i] = 0 1585 case arg0[i].Compare(&arg1[i]) == 0: 1586 i64s[i] = 1 1587 } 1588 } 1589 return nil 1590 } 1591 1592 func (b *builtinNullEQDecimalSig) vectorized() bool { 1593 return true 1594 } 1595 1596 func (b *builtinNullEQStringSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1597 n := input.NumEvents() 1598 buf0, err := b.bufSlabPredictor.get(types.ETString, n) 1599 if err != nil { 1600 return err 1601 } 1602 defer b.bufSlabPredictor.put(buf0) 1603 if err := b.args[0].VecEvalString(b.ctx, input, buf0); err != nil { 1604 return err 1605 } 1606 buf1, err := b.bufSlabPredictor.get(types.ETString, n) 1607 if err != nil { 1608 return err 1609 } 1610 defer b.bufSlabPredictor.put(buf1) 1611 if err := b.args[1].VecEvalString(b.ctx, input, buf1); err != nil { 1612 return err 1613 } 1614 1615 result.ResizeInt64(n, false) 1616 i64s := result.Int64s() 1617 for i := 0; i < n; i++ { 1618 isNull0 := buf0.IsNull(i) 1619 isNull1 := buf1.IsNull(i) 1620 switch { 1621 case isNull0 && isNull1: 1622 i64s[i] = 1 1623 case isNull0 != isNull1: 1624 i64s[i] = 0 1625 case types.CompareString(buf0.GetString(i), buf1.GetString(i), b.defCauslation) == 0: 1626 i64s[i] = 1 1627 } 1628 } 1629 return nil 1630 } 1631 1632 func (b *builtinNullEQStringSig) vectorized() bool { 1633 return true 1634 } 1635 1636 func (b *builtinNullEQTimeSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1637 n := input.NumEvents() 1638 buf0, err := b.bufSlabPredictor.get(types.ETDatetime, n) 1639 if err != nil { 1640 return err 1641 } 1642 defer b.bufSlabPredictor.put(buf0) 1643 if err := b.args[0].VecEvalTime(b.ctx, input, buf0); err != nil { 1644 return err 1645 } 1646 buf1, err := b.bufSlabPredictor.get(types.ETDatetime, n) 1647 if err != nil { 1648 return err 1649 } 1650 defer b.bufSlabPredictor.put(buf1) 1651 if err := b.args[1].VecEvalTime(b.ctx, input, buf1); err != nil { 1652 return err 1653 } 1654 1655 arg0 := buf0.Times() 1656 arg1 := buf1.Times() 1657 result.ResizeInt64(n, false) 1658 i64s := result.Int64s() 1659 for i := 0; i < n; i++ { 1660 isNull0 := buf0.IsNull(i) 1661 isNull1 := buf1.IsNull(i) 1662 switch { 1663 case isNull0 && isNull1: 1664 i64s[i] = 1 1665 case isNull0 != isNull1: 1666 i64s[i] = 0 1667 case arg0[i].Compare(arg1[i]) == 0: 1668 i64s[i] = 1 1669 } 1670 } 1671 return nil 1672 } 1673 1674 func (b *builtinNullEQTimeSig) vectorized() bool { 1675 return true 1676 } 1677 1678 func (b *builtinNullEQDurationSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1679 n := input.NumEvents() 1680 buf0, err := b.bufSlabPredictor.get(types.ETDuration, n) 1681 if err != nil { 1682 return err 1683 } 1684 defer b.bufSlabPredictor.put(buf0) 1685 if err := b.args[0].VecEvalDuration(b.ctx, input, buf0); err != nil { 1686 return err 1687 } 1688 buf1, err := b.bufSlabPredictor.get(types.ETDuration, n) 1689 if err != nil { 1690 return err 1691 } 1692 defer b.bufSlabPredictor.put(buf1) 1693 if err := b.args[1].VecEvalDuration(b.ctx, input, buf1); err != nil { 1694 return err 1695 } 1696 1697 arg0 := buf0.GoDurations() 1698 arg1 := buf1.GoDurations() 1699 result.ResizeInt64(n, false) 1700 i64s := result.Int64s() 1701 for i := 0; i < n; i++ { 1702 isNull0 := buf0.IsNull(i) 1703 isNull1 := buf1.IsNull(i) 1704 switch { 1705 case isNull0 && isNull1: 1706 i64s[i] = 1 1707 case isNull0 != isNull1: 1708 i64s[i] = 0 1709 case types.CompareDuration(arg0[i], arg1[i]) == 0: 1710 i64s[i] = 1 1711 } 1712 } 1713 return nil 1714 } 1715 1716 func (b *builtinNullEQDurationSig) vectorized() bool { 1717 return true 1718 } 1719 1720 func (b *builtinNullEQJSONSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1721 n := input.NumEvents() 1722 buf0, err := b.bufSlabPredictor.get(types.ETJson, n) 1723 if err != nil { 1724 return err 1725 } 1726 defer b.bufSlabPredictor.put(buf0) 1727 if err := b.args[0].VecEvalJSON(b.ctx, input, buf0); err != nil { 1728 return err 1729 } 1730 buf1, err := b.bufSlabPredictor.get(types.ETJson, n) 1731 if err != nil { 1732 return err 1733 } 1734 defer b.bufSlabPredictor.put(buf1) 1735 if err := b.args[1].VecEvalJSON(b.ctx, input, buf1); err != nil { 1736 return err 1737 } 1738 1739 result.ResizeInt64(n, false) 1740 i64s := result.Int64s() 1741 for i := 0; i < n; i++ { 1742 isNull0 := buf0.IsNull(i) 1743 isNull1 := buf1.IsNull(i) 1744 switch { 1745 case isNull0 && isNull1: 1746 i64s[i] = 1 1747 case isNull0 != isNull1: 1748 i64s[i] = 0 1749 case json.CompareBinary(buf0.GetJSON(i), buf1.GetJSON(i)) == 0: 1750 i64s[i] = 1 1751 } 1752 } 1753 return nil 1754 } 1755 1756 func (b *builtinNullEQJSONSig) vectorized() bool { 1757 return true 1758 } 1759 1760 // NOTE: Coalesce just return the first non-null item, but vectorization do each item, which would incur additional errors. If this case happen, 1761 // the vectorization falls back to the scalar execution. 1762 func (b *builtinCoalesceIntSig) fallbackEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1763 n := input.NumEvents() 1764 1765 x := result.Int64s() 1766 for i := 0; i < n; i++ { 1767 res, isNull, err := b.evalInt(input.GetEvent(i)) 1768 if err != nil { 1769 return err 1770 } 1771 result.SetNull(i, isNull) 1772 if isNull { 1773 continue 1774 } 1775 1776 x[i] = res 1777 1778 } 1779 return nil 1780 } 1781 1782 func (b *builtinCoalesceIntSig) vecEvalInt(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1783 n := input.NumEvents() 1784 result.ResizeInt64(n, true) 1785 i64s := result.Int64s() 1786 buf1, err := b.bufSlabPredictor.get(types.ETInt, n) 1787 if err != nil { 1788 return err 1789 } 1790 defer b.bufSlabPredictor.put(buf1) 1791 sc := b.ctx.GetStochastikVars().StmtCtx 1792 beforeWarns := sc.WarningCount() 1793 for j := 0; j < len(b.args); j++ { 1794 err := b.args[j].VecEvalInt(b.ctx, input, buf1) 1795 afterWarns := sc.WarningCount() 1796 if err != nil || afterWarns > beforeWarns { 1797 if afterWarns > beforeWarns { 1798 sc.TruncateWarnings(int(beforeWarns)) 1799 } 1800 return b.fallbackEvalInt(input, result) 1801 } 1802 args := buf1.Int64s() 1803 for i := 0; i < n; i++ { 1804 if !buf1.IsNull(i) && result.IsNull(i) { 1805 i64s[i] = args[i] 1806 result.SetNull(i, false) 1807 } 1808 } 1809 } 1810 return nil 1811 } 1812 1813 func (b *builtinCoalesceIntSig) vectorized() bool { 1814 return true 1815 } 1816 1817 // NOTE: Coalesce just return the first non-null item, but vectorization do each item, which would incur additional errors. If this case happen, 1818 // the vectorization falls back to the scalar execution. 1819 func (b *builtinCoalesceRealSig) fallbackEvalReal(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1820 n := input.NumEvents() 1821 1822 x := result.Float64s() 1823 for i := 0; i < n; i++ { 1824 res, isNull, err := b.evalReal(input.GetEvent(i)) 1825 if err != nil { 1826 return err 1827 } 1828 result.SetNull(i, isNull) 1829 if isNull { 1830 continue 1831 } 1832 1833 x[i] = res 1834 1835 } 1836 return nil 1837 } 1838 1839 func (b *builtinCoalesceRealSig) vecEvalReal(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1840 n := input.NumEvents() 1841 result.ResizeFloat64(n, true) 1842 i64s := result.Float64s() 1843 buf1, err := b.bufSlabPredictor.get(types.ETReal, n) 1844 if err != nil { 1845 return err 1846 } 1847 defer b.bufSlabPredictor.put(buf1) 1848 sc := b.ctx.GetStochastikVars().StmtCtx 1849 beforeWarns := sc.WarningCount() 1850 for j := 0; j < len(b.args); j++ { 1851 err := b.args[j].VecEvalReal(b.ctx, input, buf1) 1852 afterWarns := sc.WarningCount() 1853 if err != nil || afterWarns > beforeWarns { 1854 if afterWarns > beforeWarns { 1855 sc.TruncateWarnings(int(beforeWarns)) 1856 } 1857 return b.fallbackEvalReal(input, result) 1858 } 1859 args := buf1.Float64s() 1860 for i := 0; i < n; i++ { 1861 if !buf1.IsNull(i) && result.IsNull(i) { 1862 i64s[i] = args[i] 1863 result.SetNull(i, false) 1864 } 1865 } 1866 } 1867 return nil 1868 } 1869 1870 func (b *builtinCoalesceRealSig) vectorized() bool { 1871 return true 1872 } 1873 1874 // NOTE: Coalesce just return the first non-null item, but vectorization do each item, which would incur additional errors. If this case happen, 1875 // the vectorization falls back to the scalar execution. 1876 func (b *builtinCoalesceDecimalSig) fallbackEvalDecimal(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1877 n := input.NumEvents() 1878 1879 x := result.Decimals() 1880 for i := 0; i < n; i++ { 1881 res, isNull, err := b.evalDecimal(input.GetEvent(i)) 1882 if err != nil { 1883 return err 1884 } 1885 result.SetNull(i, isNull) 1886 if isNull { 1887 continue 1888 } 1889 1890 x[i] = *res 1891 1892 } 1893 return nil 1894 } 1895 1896 func (b *builtinCoalesceDecimalSig) vecEvalDecimal(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1897 n := input.NumEvents() 1898 result.ResizeDecimal(n, true) 1899 i64s := result.Decimals() 1900 buf1, err := b.bufSlabPredictor.get(types.ETDecimal, n) 1901 if err != nil { 1902 return err 1903 } 1904 defer b.bufSlabPredictor.put(buf1) 1905 sc := b.ctx.GetStochastikVars().StmtCtx 1906 beforeWarns := sc.WarningCount() 1907 for j := 0; j < len(b.args); j++ { 1908 err := b.args[j].VecEvalDecimal(b.ctx, input, buf1) 1909 afterWarns := sc.WarningCount() 1910 if err != nil || afterWarns > beforeWarns { 1911 if afterWarns > beforeWarns { 1912 sc.TruncateWarnings(int(beforeWarns)) 1913 } 1914 return b.fallbackEvalDecimal(input, result) 1915 } 1916 args := buf1.Decimals() 1917 for i := 0; i < n; i++ { 1918 if !buf1.IsNull(i) && result.IsNull(i) { 1919 i64s[i] = args[i] 1920 result.SetNull(i, false) 1921 } 1922 } 1923 } 1924 return nil 1925 } 1926 1927 func (b *builtinCoalesceDecimalSig) vectorized() bool { 1928 return true 1929 } 1930 1931 // NOTE: Coalesce just return the first non-null item, but vectorization do each item, which would incur additional errors. If this case happen, 1932 // the vectorization falls back to the scalar execution. 1933 func (b *builtinCoalesceStringSig) fallbackEvalString(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1934 n := input.NumEvents() 1935 1936 result.ReserveString(n) 1937 for i := 0; i < n; i++ { 1938 res, isNull, err := b.evalString(input.GetEvent(i)) 1939 if err != nil { 1940 return err 1941 } 1942 if isNull { 1943 result.AppendNull() 1944 continue 1945 } 1946 result.AppendString(res) 1947 } 1948 return nil 1949 } 1950 1951 func (b *builtinCoalesceStringSig) vecEvalString(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1952 n := input.NumEvents() 1953 argLen := len(b.args) 1954 1955 bufs := make([]*chunk.DeferredCauset, argLen) 1956 sc := b.ctx.GetStochastikVars().StmtCtx 1957 beforeWarns := sc.WarningCount() 1958 for i := 0; i < argLen; i++ { 1959 buf, err := b.bufSlabPredictor.get(types.ETInt, n) 1960 if err != nil { 1961 return err 1962 } 1963 defer b.bufSlabPredictor.put(buf) 1964 err = b.args[i].VecEvalString(b.ctx, input, buf) 1965 afterWarns := sc.WarningCount() 1966 if err != nil || afterWarns > beforeWarns { 1967 if afterWarns > beforeWarns { 1968 sc.TruncateWarnings(int(beforeWarns)) 1969 } 1970 return b.fallbackEvalString(input, result) 1971 } 1972 bufs[i] = buf 1973 } 1974 result.ReserveString(n) 1975 1976 for i := 0; i < n; i++ { 1977 for j := 0; j < argLen; j++ { 1978 if !bufs[j].IsNull(i) { 1979 result.AppendString(bufs[j].GetString(i)) 1980 break 1981 } 1982 if j == argLen-1 && bufs[j].IsNull(i) { 1983 result.AppendNull() 1984 } 1985 } 1986 } 1987 return nil 1988 } 1989 1990 func (b *builtinCoalesceStringSig) vectorized() bool { 1991 return true 1992 } 1993 1994 // NOTE: Coalesce just return the first non-null item, but vectorization do each item, which would incur additional errors. If this case happen, 1995 // the vectorization falls back to the scalar execution. 1996 func (b *builtinCoalesceTimeSig) fallbackEvalTime(input *chunk.Chunk, result *chunk.DeferredCauset) error { 1997 n := input.NumEvents() 1998 1999 x := result.Times() 2000 for i := 0; i < n; i++ { 2001 res, isNull, err := b.evalTime(input.GetEvent(i)) 2002 if err != nil { 2003 return err 2004 } 2005 result.SetNull(i, isNull) 2006 if isNull { 2007 continue 2008 } 2009 2010 x[i] = res 2011 2012 } 2013 return nil 2014 } 2015 2016 func (b *builtinCoalesceTimeSig) vecEvalTime(input *chunk.Chunk, result *chunk.DeferredCauset) error { 2017 n := input.NumEvents() 2018 result.ResizeTime(n, true) 2019 i64s := result.Times() 2020 buf1, err := b.bufSlabPredictor.get(types.ETDatetime, n) 2021 if err != nil { 2022 return err 2023 } 2024 defer b.bufSlabPredictor.put(buf1) 2025 sc := b.ctx.GetStochastikVars().StmtCtx 2026 beforeWarns := sc.WarningCount() 2027 for j := 0; j < len(b.args); j++ { 2028 err := b.args[j].VecEvalTime(b.ctx, input, buf1) 2029 afterWarns := sc.WarningCount() 2030 if err != nil || afterWarns > beforeWarns { 2031 if afterWarns > beforeWarns { 2032 sc.TruncateWarnings(int(beforeWarns)) 2033 } 2034 return b.fallbackEvalTime(input, result) 2035 } 2036 args := buf1.Times() 2037 for i := 0; i < n; i++ { 2038 if !buf1.IsNull(i) && result.IsNull(i) { 2039 i64s[i] = args[i] 2040 result.SetNull(i, false) 2041 } 2042 } 2043 } 2044 return nil 2045 } 2046 2047 func (b *builtinCoalesceTimeSig) vectorized() bool { 2048 return true 2049 } 2050 2051 // NOTE: Coalesce just return the first non-null item, but vectorization do each item, which would incur additional errors. If this case happen, 2052 // the vectorization falls back to the scalar execution. 2053 func (b *builtinCoalesceDurationSig) fallbackEvalDuration(input *chunk.Chunk, result *chunk.DeferredCauset) error { 2054 n := input.NumEvents() 2055 2056 x := result.GoDurations() 2057 for i := 0; i < n; i++ { 2058 res, isNull, err := b.evalDuration(input.GetEvent(i)) 2059 if err != nil { 2060 return err 2061 } 2062 result.SetNull(i, isNull) 2063 if isNull { 2064 continue 2065 } 2066 2067 x[i] = res.Duration 2068 2069 } 2070 return nil 2071 } 2072 2073 func (b *builtinCoalesceDurationSig) vecEvalDuration(input *chunk.Chunk, result *chunk.DeferredCauset) error { 2074 n := input.NumEvents() 2075 result.ResizeGoDuration(n, true) 2076 i64s := result.GoDurations() 2077 buf1, err := b.bufSlabPredictor.get(types.ETDuration, n) 2078 if err != nil { 2079 return err 2080 } 2081 defer b.bufSlabPredictor.put(buf1) 2082 sc := b.ctx.GetStochastikVars().StmtCtx 2083 beforeWarns := sc.WarningCount() 2084 for j := 0; j < len(b.args); j++ { 2085 err := b.args[j].VecEvalDuration(b.ctx, input, buf1) 2086 afterWarns := sc.WarningCount() 2087 if err != nil || afterWarns > beforeWarns { 2088 if afterWarns > beforeWarns { 2089 sc.TruncateWarnings(int(beforeWarns)) 2090 } 2091 return b.fallbackEvalDuration(input, result) 2092 } 2093 args := buf1.GoDurations() 2094 for i := 0; i < n; i++ { 2095 if !buf1.IsNull(i) && result.IsNull(i) { 2096 i64s[i] = args[i] 2097 result.SetNull(i, false) 2098 } 2099 } 2100 } 2101 return nil 2102 } 2103 2104 func (b *builtinCoalesceDurationSig) vectorized() bool { 2105 return true 2106 } 2107 2108 // NOTE: Coalesce just return the first non-null item, but vectorization do each item, which would incur additional errors. If this case happen, 2109 // the vectorization falls back to the scalar execution. 2110 func (b *builtinCoalesceJSONSig) fallbackEvalJSON(input *chunk.Chunk, result *chunk.DeferredCauset) error { 2111 n := input.NumEvents() 2112 2113 result.ReserveJSON(n) 2114 for i := 0; i < n; i++ { 2115 res, isNull, err := b.evalJSON(input.GetEvent(i)) 2116 if err != nil { 2117 return err 2118 } 2119 if isNull { 2120 result.AppendNull() 2121 continue 2122 } 2123 result.AppendJSON(res) 2124 } 2125 return nil 2126 } 2127 2128 func (b *builtinCoalesceJSONSig) vecEvalJSON(input *chunk.Chunk, result *chunk.DeferredCauset) error { 2129 n := input.NumEvents() 2130 argLen := len(b.args) 2131 2132 bufs := make([]*chunk.DeferredCauset, argLen) 2133 sc := b.ctx.GetStochastikVars().StmtCtx 2134 beforeWarns := sc.WarningCount() 2135 for i := 0; i < argLen; i++ { 2136 buf, err := b.bufSlabPredictor.get(types.ETInt, n) 2137 if err != nil { 2138 return err 2139 } 2140 defer b.bufSlabPredictor.put(buf) 2141 err = b.args[i].VecEvalJSON(b.ctx, input, buf) 2142 afterWarns := sc.WarningCount() 2143 if err != nil || afterWarns > beforeWarns { 2144 if afterWarns > beforeWarns { 2145 sc.TruncateWarnings(int(beforeWarns)) 2146 } 2147 return b.fallbackEvalJSON(input, result) 2148 } 2149 bufs[i] = buf 2150 } 2151 result.ReserveJSON(n) 2152 2153 for i := 0; i < n; i++ { 2154 for j := 0; j < argLen; j++ { 2155 if !bufs[j].IsNull(i) { 2156 result.AppendJSON(bufs[j].GetJSON(i)) 2157 break 2158 } 2159 if j == argLen-1 && bufs[j].IsNull(i) { 2160 result.AppendNull() 2161 } 2162 } 2163 } 2164 return nil 2165 } 2166 2167 func (b *builtinCoalesceJSONSig) vectorized() bool { 2168 return true 2169 }