Files
tidb/expression/builtin_control_vec_generated.go
2019-09-12 15:21:46 +08:00

476 lines
9.0 KiB
Go

// Copyright 2019 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by go generate in expression/generator; DO NOT EDIT.
package expression
import (
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/util/chunk"
)
func (b *builtinIfIntSig) vecEvalInt(input *chunk.Chunk, result *chunk.Column) error {
n := input.NumRows()
buf0, err := b.bufAllocator.get(types.ETInt, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf0)
if err := b.args[0].VecEvalInt(b.ctx, input, buf0); err != nil {
return err
}
buf1, err := b.bufAllocator.get(types.ETInt, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf1)
if err := b.args[1].VecEvalInt(b.ctx, input, buf1); err != nil {
return err
}
buf2, err := b.bufAllocator.get(types.ETInt, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf2)
if err := b.args[2].VecEvalInt(b.ctx, input, buf2); err != nil {
return err
}
result.ResizeInt64(n, false)
arg0 := buf0.Int64s()
arg1 := buf1.Int64s()
arg2 := buf2.Int64s()
rs := result.Int64s()
for i := 0; i < n; i++ {
arg := arg0[i]
isNull0 := buf0.IsNull(i)
switch {
case isNull0 || arg == 0:
if buf2.IsNull(i) {
result.SetNull(i, true)
} else {
rs[i] = arg2[i]
}
case arg != 0:
if buf1.IsNull(i) {
result.SetNull(i, true)
} else {
rs[i] = arg1[i]
}
}
}
return nil
}
func (b *builtinIfIntSig) vectorized() bool {
return true
}
func (b *builtinIfRealSig) vecEvalReal(input *chunk.Chunk, result *chunk.Column) error {
n := input.NumRows()
buf0, err := b.bufAllocator.get(types.ETInt, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf0)
if err := b.args[0].VecEvalInt(b.ctx, input, buf0); err != nil {
return err
}
buf1, err := b.bufAllocator.get(types.ETReal, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf1)
if err := b.args[1].VecEvalReal(b.ctx, input, buf1); err != nil {
return err
}
buf2, err := b.bufAllocator.get(types.ETReal, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf2)
if err := b.args[2].VecEvalReal(b.ctx, input, buf2); err != nil {
return err
}
result.ResizeFloat64(n, false)
arg0 := buf0.Int64s()
arg1 := buf1.Float64s()
arg2 := buf2.Float64s()
rs := result.Float64s()
for i := 0; i < n; i++ {
arg := arg0[i]
isNull0 := buf0.IsNull(i)
switch {
case isNull0 || arg == 0:
if buf2.IsNull(i) {
result.SetNull(i, true)
} else {
rs[i] = arg2[i]
}
case arg != 0:
if buf1.IsNull(i) {
result.SetNull(i, true)
} else {
rs[i] = arg1[i]
}
}
}
return nil
}
func (b *builtinIfRealSig) vectorized() bool {
return true
}
func (b *builtinIfDecimalSig) vecEvalDecimal(input *chunk.Chunk, result *chunk.Column) error {
n := input.NumRows()
buf0, err := b.bufAllocator.get(types.ETInt, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf0)
if err := b.args[0].VecEvalInt(b.ctx, input, buf0); err != nil {
return err
}
buf1, err := b.bufAllocator.get(types.ETDecimal, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf1)
if err := b.args[1].VecEvalDecimal(b.ctx, input, buf1); err != nil {
return err
}
buf2, err := b.bufAllocator.get(types.ETDecimal, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf2)
if err := b.args[2].VecEvalDecimal(b.ctx, input, buf2); err != nil {
return err
}
result.ResizeDecimal(n, false)
arg0 := buf0.Int64s()
arg1 := buf1.Decimals()
arg2 := buf2.Decimals()
rs := result.Decimals()
for i := 0; i < n; i++ {
arg := arg0[i]
isNull0 := buf0.IsNull(i)
switch {
case isNull0 || arg == 0:
if buf2.IsNull(i) {
result.SetNull(i, true)
} else {
rs[i] = arg2[i]
}
case arg != 0:
if buf1.IsNull(i) {
result.SetNull(i, true)
} else {
rs[i] = arg1[i]
}
}
}
return nil
}
func (b *builtinIfDecimalSig) vectorized() bool {
return true
}
func (b *builtinIfStringSig) vecEvalString(input *chunk.Chunk, result *chunk.Column) error {
n := input.NumRows()
buf0, err := b.bufAllocator.get(types.ETInt, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf0)
if err := b.args[0].VecEvalInt(b.ctx, input, buf0); err != nil {
return err
}
buf1, err := b.bufAllocator.get(types.ETString, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf1)
if err := b.args[1].VecEvalString(b.ctx, input, buf1); err != nil {
return err
}
buf2, err := b.bufAllocator.get(types.ETString, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf2)
if err := b.args[2].VecEvalString(b.ctx, input, buf2); err != nil {
return err
}
result.ReserveString(n)
arg0 := buf0.Int64s()
for i := 0; i < n; i++ {
arg := arg0[i]
isNull0 := buf0.IsNull(i)
switch {
case isNull0 || arg == 0:
if buf2.IsNull(i) {
result.AppendNull()
} else {
result.AppendString(buf2.GetString(i))
}
case arg != 0:
if buf1.IsNull(i) {
result.AppendNull()
} else {
result.AppendString(buf1.GetString(i))
}
}
}
return nil
}
func (b *builtinIfStringSig) vectorized() bool {
return true
}
func (b *builtinIfTimeSig) vecEvalTime(input *chunk.Chunk, result *chunk.Column) error {
n := input.NumRows()
buf0, err := b.bufAllocator.get(types.ETInt, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf0)
if err := b.args[0].VecEvalInt(b.ctx, input, buf0); err != nil {
return err
}
buf1, err := b.bufAllocator.get(types.ETDatetime, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf1)
if err := b.args[1].VecEvalTime(b.ctx, input, buf1); err != nil {
return err
}
buf2, err := b.bufAllocator.get(types.ETDatetime, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf2)
if err := b.args[2].VecEvalTime(b.ctx, input, buf2); err != nil {
return err
}
result.ResizeTime(n, false)
arg0 := buf0.Int64s()
arg1 := buf1.Times()
arg2 := buf2.Times()
rs := result.Times()
for i := 0; i < n; i++ {
arg := arg0[i]
isNull0 := buf0.IsNull(i)
switch {
case isNull0 || arg == 0:
if buf2.IsNull(i) {
result.SetNull(i, true)
} else {
rs[i] = arg2[i]
}
case arg != 0:
if buf1.IsNull(i) {
result.SetNull(i, true)
} else {
rs[i] = arg1[i]
}
}
}
return nil
}
func (b *builtinIfTimeSig) vectorized() bool {
return true
}
func (b *builtinIfDurationSig) vecEvalDuration(input *chunk.Chunk, result *chunk.Column) error {
n := input.NumRows()
buf0, err := b.bufAllocator.get(types.ETInt, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf0)
if err := b.args[0].VecEvalInt(b.ctx, input, buf0); err != nil {
return err
}
buf1, err := b.bufAllocator.get(types.ETDuration, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf1)
if err := b.args[1].VecEvalDuration(b.ctx, input, buf1); err != nil {
return err
}
buf2, err := b.bufAllocator.get(types.ETDuration, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf2)
if err := b.args[2].VecEvalDuration(b.ctx, input, buf2); err != nil {
return err
}
result.ResizeGoDuration(n, false)
arg0 := buf0.Int64s()
arg1 := buf1.GoDurations()
arg2 := buf2.GoDurations()
rs := result.GoDurations()
for i := 0; i < n; i++ {
arg := arg0[i]
isNull0 := buf0.IsNull(i)
switch {
case isNull0 || arg == 0:
if buf2.IsNull(i) {
result.SetNull(i, true)
} else {
rs[i] = arg2[i]
}
case arg != 0:
if buf1.IsNull(i) {
result.SetNull(i, true)
} else {
rs[i] = arg1[i]
}
}
}
return nil
}
func (b *builtinIfDurationSig) vectorized() bool {
return true
}
func (b *builtinIfJSONSig) vecEvalJSON(input *chunk.Chunk, result *chunk.Column) error {
n := input.NumRows()
buf0, err := b.bufAllocator.get(types.ETInt, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf0)
if err := b.args[0].VecEvalInt(b.ctx, input, buf0); err != nil {
return err
}
buf1, err := b.bufAllocator.get(types.ETJson, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf1)
if err := b.args[1].VecEvalJSON(b.ctx, input, buf1); err != nil {
return err
}
buf2, err := b.bufAllocator.get(types.ETJson, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf2)
if err := b.args[2].VecEvalJSON(b.ctx, input, buf2); err != nil {
return err
}
result.ReserveJSON(n)
arg0 := buf0.Int64s()
for i := 0; i < n; i++ {
arg := arg0[i]
isNull0 := buf0.IsNull(i)
switch {
case isNull0 || arg == 0:
if buf2.IsNull(i) {
result.AppendNull()
} else {
result.AppendJSON(buf2.GetJSON(i))
}
case arg != 0:
if buf1.IsNull(i) {
result.AppendNull()
} else {
result.AppendJSON(buf1.GetJSON(i))
}
}
}
return nil
}
func (b *builtinIfJSONSig) vectorized() bool {
return true
}