github.com/matrixorigin/matrixone@v1.2.0/pkg/sql/colexec/fill/fill.go (about)

     1  // Copyright 2021 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 fill
    16  
    17  import (
    18  	"bytes"
    19  	"fmt"
    20  
    21  	"github.com/matrixorigin/matrixone/pkg/container/batch"
    22  	"github.com/matrixorigin/matrixone/pkg/container/types"
    23  	"github.com/matrixorigin/matrixone/pkg/container/vector"
    24  	"github.com/matrixorigin/matrixone/pkg/pb/plan"
    25  	"github.com/matrixorigin/matrixone/pkg/sql/colexec"
    26  	"github.com/matrixorigin/matrixone/pkg/sql/plan/function"
    27  	"github.com/matrixorigin/matrixone/pkg/vm"
    28  	"github.com/matrixorigin/matrixone/pkg/vm/process"
    29  )
    30  
    31  const argName = "fill"
    32  
    33  func (arg *Argument) String(buf *bytes.Buffer) {
    34  	buf.WriteString(argName)
    35  	buf.WriteString(": fill")
    36  }
    37  
    38  func (arg *Argument) Prepare(proc *process.Process) (err error) {
    39  	ap := arg
    40  	ap.ctr = new(container)
    41  	ctr := ap.ctr
    42  	ctr.InitReceiver(proc, true)
    43  
    44  	f := true
    45  	for i := len(ap.AggIds) - 1; i >= 0; i-- {
    46  		if ap.AggIds[i] == function.MAX || ap.AggIds[i] == function.MIN || ap.AggIds[i] == function.SUM || ap.AggIds[i] == function.AVG {
    47  			ctr.colIdx = i
    48  			f = false
    49  			break
    50  		}
    51  	}
    52  	if f {
    53  		ap.FillType = plan.Node_NONE
    54  	}
    55  
    56  	switch ap.FillType {
    57  	case plan.Node_VALUE:
    58  		b := batch.NewWithSize(1)
    59  		b.SetVector(0, proc.GetVector(types.T_varchar.ToType()))
    60  		batch.SetLength(b, 1)
    61  		ctr.valVecs = make([]*vector.Vector, len(ap.FillVal))
    62  		for i, val := range ap.FillVal {
    63  			exe, err := colexec.NewExpressionExecutor(proc, val)
    64  			if err != nil {
    65  				return err
    66  			}
    67  			ctr.valVecs[i], err = exe.EvalWithoutResultReusing(proc, []*batch.Batch{b})
    68  			if err != nil {
    69  				exe.Free()
    70  				return err
    71  			}
    72  			exe.Free()
    73  		}
    74  		ctr.process = processValue
    75  	case plan.Node_PREV:
    76  		ctr.prevVecs = make([]*vector.Vector, ap.ColLen)
    77  		ctr.process = processPrev
    78  	case plan.Node_NEXT:
    79  		ctr.status = receiveBat
    80  		ctr.subStatus = findNull
    81  		ctr.process = processNext
    82  	case plan.Node_LINEAR:
    83  		for _, v := range ap.FillVal {
    84  			resetColRef(v, 0)
    85  			exe, err := colexec.NewExpressionExecutor(proc, v)
    86  			if err != nil {
    87  				return err
    88  			}
    89  			ctr.exes = append(ctr.exes, exe)
    90  			ctr.valVecs = make([]*vector.Vector, len(ap.FillVal))
    91  		}
    92  		ctr.process = processLinear
    93  	default:
    94  		ctr.process = processDefault
    95  	}
    96  
    97  	return nil
    98  }
    99  
   100  func (arg *Argument) Call(proc *process.Process) (vm.CallResult, error) {
   101  	if err, isCancel := vm.CancelCheck(proc); isCancel {
   102  		return vm.CancelResult, err
   103  	}
   104  
   105  	anal := proc.GetAnalyze(arg.GetIdx(), arg.GetParallelIdx(), arg.GetParallelMajor())
   106  	anal.Start()
   107  	defer anal.Stop()
   108  	ctr := arg.ctr
   109  
   110  	return ctr.process(ctr, arg, proc, anal)
   111  }
   112  
   113  func resetColRef(expr *plan.Expr, idx int) {
   114  	switch exprImpl := expr.Expr.(type) {
   115  	case *plan.Expr_Col:
   116  		exprImpl.Col.RelPos = -1
   117  		exprImpl.Col.ColPos = int32(idx)
   118  
   119  	case *plan.Expr_F:
   120  		for i, arg := range exprImpl.F.Args {
   121  			resetColRef(arg, i)
   122  		}
   123  	}
   124  }
   125  
   126  func processValue(ctr *container, ap *Argument, proc *process.Process, anal process.Analyze) (vm.CallResult, error) {
   127  	var err error
   128  	result := vm.NewCallResult()
   129  	if ctr.buf != nil {
   130  		proc.PutBatch(ctr.buf)
   131  		ctr.buf = nil
   132  	}
   133  	ctr.buf, _, err = ctr.ReceiveFromAllRegs(anal)
   134  	if err != nil {
   135  		return result, err
   136  	}
   137  	if ctr.buf == nil {
   138  		result.Batch = nil
   139  		result.Status = vm.ExecStop
   140  		return result, nil
   141  	}
   142  	for i := 0; i < ap.ColLen; i++ {
   143  		for j := 0; j < ctr.buf.Vecs[i].Length(); j++ {
   144  			if ctr.buf.Vecs[i].IsNull(uint64(j)) {
   145  				if err = setValue(ctr.buf.Vecs[i], ctr.valVecs[i], j, 0, proc); err != nil {
   146  					return result, err
   147  				}
   148  			}
   149  		}
   150  	}
   151  	result.Batch = ctr.buf
   152  	return result, nil
   153  }
   154  
   155  func (ctr *container) initIndex() {
   156  	ctr.nullIdx = 0
   157  	ctr.nullRow = 0
   158  	ctr.preIdx = 0
   159  	ctr.preRow = 0
   160  	ctr.curIdx = 0
   161  	ctr.curRow = 0
   162  	ctr.status = receiveBat
   163  	ctr.subStatus = findNullPre
   164  }
   165  
   166  func processNextCol(ctr *container, idx int, proc *process.Process) error {
   167  	var err error
   168  	ctr.initIndex()
   169  	k := 0
   170  	for {
   171  		switch ctr.status {
   172  		case receiveBat:
   173  			if k == len(ctr.bats) {
   174  				return nil
   175  			}
   176  			k++
   177  			if ctr.subStatus == findNull {
   178  				ctr.status = findNull
   179  			} else {
   180  				ctr.status = findValue
   181  			}
   182  
   183  		case findNull:
   184  			b := ctr.bats[ctr.preIdx]
   185  			hasNull := false
   186  			for ; ctr.preRow < b.RowCount(); ctr.preRow++ {
   187  				if b.Vecs[idx].IsNull(uint64(ctr.preRow)) {
   188  					hasNull = true
   189  					break
   190  				}
   191  			}
   192  			ctr.subStatus = findNull
   193  			if hasNull {
   194  				ctr.status = findValue
   195  			} else {
   196  				ctr.preIdx++
   197  				ctr.preRow = 0
   198  				ctr.status = receiveBat
   199  			}
   200  		case findValue:
   201  			ctr.curIdx = ctr.preIdx
   202  			ctr.curRow = ctr.preRow
   203  			b := ctr.bats[ctr.curIdx]
   204  			hasValue := false
   205  			for ; ctr.curRow < b.RowCount(); ctr.curRow++ {
   206  				if !b.Vecs[idx].IsNull(uint64(ctr.curRow)) {
   207  					hasValue = true
   208  					break
   209  				}
   210  			}
   211  			ctr.subStatus = findValue
   212  			if hasValue {
   213  				ctr.status = fillValue
   214  			} else {
   215  				ctr.status = receiveBat
   216  			}
   217  		case fillValue:
   218  			for ; ctr.preIdx < ctr.curIdx-1; ctr.preIdx++ {
   219  				for ; ctr.preRow < ctr.bats[ctr.preIdx].RowCount(); ctr.preRow++ {
   220  					vec := ctr.bats[ctr.preIdx].Vecs[idx]
   221  					if !vec.IsNull(uint64(ctr.preRow)) {
   222  						continue
   223  					}
   224  					err = setValue(vec, ctr.bats[ctr.curIdx].Vecs[idx], ctr.preRow, ctr.curRow, proc)
   225  					if err != nil {
   226  						return err
   227  					}
   228  
   229  				}
   230  				if ctr.preRow == ctr.bats[ctr.preRow].RowCount() {
   231  					ctr.preRow = 0
   232  				}
   233  			}
   234  
   235  			for ; ctr.preRow < ctr.curRow; ctr.preRow++ {
   236  				vec := ctr.bats[ctr.preIdx].Vecs[idx]
   237  				if !vec.IsNull(uint64(ctr.preRow)) {
   238  					continue
   239  				}
   240  				err = setValue(vec, ctr.bats[ctr.curIdx].Vecs[idx], ctr.preRow, ctr.curRow, proc)
   241  				if err != nil {
   242  					return err
   243  				}
   244  			}
   245  
   246  			ctr.status = findNull
   247  
   248  		}
   249  	}
   250  }
   251  
   252  func processPrev(ctr *container, ap *Argument, proc *process.Process, anal process.Analyze) (vm.CallResult, error) {
   253  	var err error
   254  	result := vm.NewCallResult()
   255  	if ctr.buf != nil {
   256  		proc.PutBatch(ctr.buf)
   257  		ctr.buf = nil
   258  	}
   259  	ctr.buf, _, err = ctr.ReceiveFromAllRegs(anal)
   260  	if err != nil {
   261  		return result, err
   262  	}
   263  	if ctr.buf == nil {
   264  		result.Batch = nil
   265  		result.Status = vm.ExecStop
   266  		return result, nil
   267  	}
   268  	for i := 0; i < ap.ColLen; i++ {
   269  		for j := 0; j < ctr.buf.Vecs[i].Length(); j++ {
   270  			if ctr.buf.Vecs[i].IsNull(uint64(j)) {
   271  				if ctr.prevVecs[i] != nil {
   272  					if err = setValue(ctr.buf.Vecs[i], ctr.prevVecs[i], j, 0, proc); err != nil {
   273  						return result, err
   274  					}
   275  				}
   276  			} else {
   277  				if ctr.prevVecs[i] == nil {
   278  					ctr.prevVecs[i] = proc.GetVector(*ctr.buf.Vecs[i].GetType())
   279  					err = appendValue(ctr.prevVecs[i], ctr.buf.Vecs[i], j, proc)
   280  					if err != nil {
   281  						return result, err
   282  					}
   283  				} else {
   284  					if err = setValue(ctr.prevVecs[i], ctr.buf.Vecs[i], 0, j, proc); err != nil {
   285  						return result, err
   286  					}
   287  				}
   288  
   289  			}
   290  		}
   291  	}
   292  	result.Batch = ctr.buf
   293  	return result, nil
   294  }
   295  
   296  func processLinearCol(ctr *container, proc *process.Process, idx int) error {
   297  	var err error
   298  
   299  	ctr.initIndex()
   300  	k := 0
   301  
   302  	for {
   303  		switch ctr.status {
   304  		case receiveBat:
   305  			if k == len(ctr.bats) {
   306  				return nil
   307  			}
   308  			k++
   309  			if ctr.subStatus == findNullPre {
   310  				ctr.status = findNullPre
   311  			} else {
   312  				ctr.status = findValue
   313  			}
   314  		case findNullPre:
   315  			b := ctr.bats[ctr.nullIdx]
   316  
   317  			if ctr.nullIdx > ctr.preRow {
   318  				if b.Vecs[idx].IsNull(uint64(ctr.nullIdx)) {
   319  					ctr.status = findValue
   320  					continue
   321  				}
   322  			}
   323  
   324  			hasNullPre := false
   325  			ctr.preRow = ctr.nullRow - 1
   326  			for ; ctr.nullRow < b.RowCount(); ctr.nullRow++ {
   327  				if ctr.preRow >= 0 && b.Vecs[idx].IsNull(uint64(ctr.nullRow)) && !b.Vecs[idx].IsNull(uint64(ctr.preRow)) {
   328  					hasNullPre = true
   329  					break
   330  				}
   331  				ctr.preRow++
   332  			}
   333  
   334  			ctr.subStatus = findNullPre
   335  			if hasNullPre {
   336  				ctr.status = findValue
   337  			} else {
   338  				if b.Vecs[idx].IsNull(uint64(ctr.preRow)) {
   339  					ctr.preIdx++
   340  					ctr.nullRow = 0
   341  				}
   342  				ctr.nullIdx++
   343  				ctr.nullRow = 0
   344  				ctr.status = receiveBat
   345  			}
   346  		case findValue:
   347  			ctr.curIdx = ctr.nullIdx
   348  			ctr.curRow = ctr.nullRow
   349  			b := ctr.bats[ctr.curIdx]
   350  			hasValue := false
   351  			for ; ctr.curRow < b.RowCount(); ctr.curRow++ {
   352  				if !b.Vecs[idx].IsNull(uint64(ctr.curRow)) {
   353  					hasValue = true
   354  					break
   355  				}
   356  			}
   357  			ctr.subStatus = findValue
   358  			if hasValue {
   359  				ctr.status = fillValue
   360  			} else {
   361  				ctr.status = receiveBat
   362  			}
   363  		case fillValue:
   364  			b := batch.NewWithSize(2)
   365  			b.Vecs[0] = proc.GetVector(*ctr.bats[ctr.preIdx].Vecs[idx].GetType())
   366  			err = appendValue(b.Vecs[0], ctr.bats[ctr.preIdx].Vecs[idx], ctr.preRow, proc)
   367  			if err != nil {
   368  				return err
   369  			}
   370  			b.Vecs[1] = proc.GetVector(*ctr.bats[ctr.curIdx].Vecs[idx].GetType())
   371  			err = appendValue(b.Vecs[1], ctr.bats[ctr.curIdx].Vecs[idx], ctr.curRow, proc)
   372  			if err != nil {
   373  				return err
   374  			}
   375  			b.SetRowCount(1)
   376  			ctr.valVecs[idx], err = ctr.exes[idx].EvalWithoutResultReusing(proc, []*batch.Batch{b})
   377  			if err != nil {
   378  				return err
   379  			}
   380  
   381  			ctr.preRow++
   382  			for ; ctr.preIdx < ctr.curIdx-1; ctr.preIdx++ {
   383  				for ; ctr.preRow < ctr.bats[ctr.preIdx].RowCount(); ctr.preRow++ {
   384  
   385  					vec := ctr.bats[ctr.preIdx].Vecs[idx]
   386  					if !vec.IsNull(uint64(ctr.preRow)) {
   387  						continue
   388  					}
   389  					err = setValue(vec, ctr.valVecs[idx], ctr.preRow, 0, proc)
   390  					if err != nil {
   391  						return err
   392  					}
   393  
   394  				}
   395  				if ctr.preRow == ctr.bats[ctr.preRow].RowCount() {
   396  					ctr.preRow = 0
   397  				}
   398  			}
   399  
   400  			for ; ctr.preRow < ctr.curRow; ctr.preRow++ {
   401  				vec := ctr.bats[ctr.preIdx].Vecs[idx]
   402  				if !vec.IsNull(uint64(ctr.preRow)) {
   403  					continue
   404  				}
   405  				err = setValue(vec, ctr.valVecs[idx], ctr.preRow, 0, proc)
   406  				if err != nil {
   407  					return err
   408  				}
   409  			}
   410  
   411  			ctr.nullIdx = ctr.preIdx
   412  			ctr.nullRow = ctr.preRow
   413  			ctr.status = findNullPre
   414  		}
   415  	}
   416  }
   417  
   418  func processNext(ctr *container, ap *Argument, proc *process.Process, anal process.Analyze) (vm.CallResult, error) {
   419  	var err error
   420  	result := vm.NewCallResult()
   421  	if ctr.done {
   422  		if ctr.idx == len(ctr.bats) {
   423  			result.Batch = nil
   424  			result.Status = vm.ExecStop
   425  			return result, nil
   426  		}
   427  		result.Batch = ctr.bats[ctr.idx]
   428  		result.Status = vm.ExecNext
   429  		ctr.idx++
   430  		return result, nil
   431  	}
   432  	for {
   433  		bat, end, err := ctr.ReceiveFromAllRegs(anal)
   434  		if err != nil {
   435  			return result, err
   436  		}
   437  		if end {
   438  			break
   439  		}
   440  		ctr.bats = append(ctr.bats, bat)
   441  	}
   442  	if len(ctr.bats) == 0 {
   443  		result.Batch = nil
   444  		result.Status = vm.ExecStop
   445  		return result, nil
   446  	}
   447  	for i := range ctr.bats[0].Vecs {
   448  		if err = processNextCol(ctr, i, proc); err != nil {
   449  			return result, err
   450  		}
   451  	}
   452  	ctr.done = true
   453  	result.Batch = ctr.bats[ctr.idx]
   454  	result.Status = vm.ExecNext
   455  	ctr.idx++
   456  	return result, nil
   457  }
   458  
   459  func processLinear(ctr *container, ap *Argument, proc *process.Process, anal process.Analyze) (vm.CallResult, error) {
   460  	var err error
   461  	result := vm.NewCallResult()
   462  	if ctr.done {
   463  		if ctr.idx == len(ctr.bats) {
   464  			result.Batch = nil
   465  			result.Status = vm.ExecStop
   466  			return result, nil
   467  		}
   468  		result.Batch = ctr.bats[ctr.idx]
   469  		result.Status = vm.ExecNext
   470  		ctr.idx++
   471  		return result, nil
   472  	}
   473  	for {
   474  		bat, end, err := ctr.ReceiveFromAllRegs(anal)
   475  		if err != nil {
   476  			return result, err
   477  		}
   478  		if end {
   479  			break
   480  		}
   481  		ctr.bats = append(ctr.bats, bat)
   482  	}
   483  	if len(ctr.bats) == 0 {
   484  		result.Batch = nil
   485  		result.Status = vm.ExecStop
   486  		return result, nil
   487  	}
   488  	for i := range ctr.bats[0].Vecs {
   489  		if err = processLinearCol(ctr, proc, i); err != nil {
   490  			return result, err
   491  		}
   492  	}
   493  	ctr.done = true
   494  	result.Batch = ctr.bats[ctr.idx]
   495  	result.Status = vm.ExecNext
   496  	ctr.idx++
   497  	return result, nil
   498  }
   499  
   500  func processDefault(ctr *container, ap *Argument, proc *process.Process, anal process.Analyze) (vm.CallResult, error) {
   501  	var err error
   502  	result := vm.NewCallResult()
   503  	if ctr.buf != nil {
   504  		proc.PutBatch(ctr.buf)
   505  		ctr.buf = nil
   506  	}
   507  	ctr.buf, _, err = ctr.ReceiveFromAllRegs(anal)
   508  	if err != nil {
   509  		return result, err
   510  	}
   511  	if ctr.buf == nil {
   512  		result.Batch = nil
   513  		result.Status = vm.ExecStop
   514  		return result, nil
   515  	}
   516  	result.Batch = ctr.buf
   517  	return result, nil
   518  }
   519  
   520  func appendValue(v, w *vector.Vector, j int, proc *process.Process) error {
   521  	var err error
   522  	switch v.GetType().Oid {
   523  	case types.T_bool:
   524  		err = vector.AppendFixed[bool](v, vector.GetFixedAt[bool](w, j), false, proc.Mp())
   525  	case types.T_bit:
   526  		err = vector.AppendFixed[uint64](v, vector.GetFixedAt[uint64](w, j), false, proc.Mp())
   527  	case types.T_int8:
   528  		err = vector.AppendFixed[int8](v, vector.GetFixedAt[int8](w, j), false, proc.Mp())
   529  	case types.T_int16:
   530  		err = vector.AppendFixed[int16](v, vector.GetFixedAt[int16](w, j), false, proc.Mp())
   531  	case types.T_int32:
   532  		err = vector.AppendFixed[int32](v, vector.GetFixedAt[int32](w, j), false, proc.Mp())
   533  	case types.T_int64:
   534  		err = vector.AppendFixed[int64](v, vector.GetFixedAt[int64](w, j), false, proc.Mp())
   535  	case types.T_uint8:
   536  		err = vector.AppendFixed[uint8](v, vector.GetFixedAt[uint8](w, j), false, proc.Mp())
   537  	case types.T_uint16:
   538  		err = vector.AppendFixed[uint16](v, vector.GetFixedAt[uint16](w, j), false, proc.Mp())
   539  	case types.T_uint32:
   540  		err = vector.AppendFixed[uint32](v, vector.GetFixedAt[uint32](w, j), false, proc.Mp())
   541  	case types.T_uint64:
   542  		err = vector.AppendFixed[uint64](v, vector.GetFixedAt[uint64](w, j), false, proc.Mp())
   543  	case types.T_float32:
   544  		err = vector.AppendFixed[float32](v, vector.GetFixedAt[float32](w, j), false, proc.Mp())
   545  	case types.T_float64:
   546  		err = vector.AppendFixed[float64](v, vector.GetFixedAt[float64](w, j), false, proc.Mp())
   547  	case types.T_date:
   548  		err = vector.AppendFixed[types.Date](v, vector.GetFixedAt[types.Date](w, j), false, proc.Mp())
   549  	case types.T_datetime:
   550  		err = vector.AppendFixed[types.Datetime](v, vector.GetFixedAt[types.Datetime](w, j), false, proc.Mp())
   551  	case types.T_time:
   552  		err = vector.AppendFixed[types.Time](v, vector.GetFixedAt[types.Time](w, j), false, proc.Mp())
   553  	case types.T_timestamp:
   554  		err = vector.AppendFixed[types.Timestamp](v, vector.GetFixedAt[types.Timestamp](w, j), false, proc.Mp())
   555  	case types.T_enum:
   556  		err = vector.AppendFixed[types.Enum](v, vector.GetFixedAt[types.Enum](w, j), false, proc.Mp())
   557  	case types.T_decimal64:
   558  		err = vector.AppendFixed[types.Decimal64](v, vector.GetFixedAt[types.Decimal64](w, j), false, proc.Mp())
   559  	case types.T_decimal128:
   560  		err = vector.AppendFixed[types.Decimal128](v, vector.GetFixedAt[types.Decimal128](w, j), false, proc.Mp())
   561  	case types.T_uuid:
   562  		err = vector.AppendFixed[types.Uuid](v, vector.GetFixedAt[types.Uuid](w, j), false, proc.Mp())
   563  	case types.T_TS:
   564  		err = vector.AppendFixed[types.TS](v, vector.GetFixedAt[types.TS](w, j), false, proc.Mp())
   565  	case types.T_Rowid:
   566  		err = vector.AppendFixed[types.Rowid](v, vector.GetFixedAt[types.Rowid](w, j), false, proc.Mp())
   567  	case types.T_char, types.T_varchar, types.T_binary, types.T_varbinary,
   568  		types.T_json, types.T_blob, types.T_text,
   569  		types.T_array_float32, types.T_array_float64:
   570  		err = vector.AppendBytes(v, w.GetBytesAt(j), false, proc.Mp())
   571  	default:
   572  		panic(fmt.Sprintf("unexpect type %s for function set value in fill query", v.GetType()))
   573  	}
   574  	return err
   575  }
   576  
   577  func setValue(v, w *vector.Vector, i, j int, proc *process.Process) error {
   578  	if v.HasNull() {
   579  		v.GetNulls().Del(uint64(i))
   580  	}
   581  	var err error
   582  	switch v.GetType().Oid {
   583  	case types.T_bool:
   584  		err = vector.SetFixedAt[bool](v, i, vector.GetFixedAt[bool](w, j))
   585  	case types.T_bit:
   586  		err = vector.SetFixedAt[uint64](v, i, vector.GetFixedAt[uint64](w, j))
   587  	case types.T_int8:
   588  		err = vector.SetFixedAt[int8](v, i, vector.GetFixedAt[int8](w, j))
   589  	case types.T_int16:
   590  		err = vector.SetFixedAt[int16](v, i, vector.GetFixedAt[int16](w, j))
   591  	case types.T_int32:
   592  		err = vector.SetFixedAt[int32](v, i, vector.GetFixedAt[int32](w, j))
   593  	case types.T_int64:
   594  		err = vector.SetFixedAt[int64](v, i, vector.GetFixedAt[int64](w, j))
   595  	case types.T_uint8:
   596  		err = vector.SetFixedAt[uint8](v, i, vector.GetFixedAt[uint8](w, j))
   597  	case types.T_uint16:
   598  		err = vector.SetFixedAt[uint16](v, i, vector.GetFixedAt[uint16](w, j))
   599  	case types.T_uint32:
   600  		err = vector.SetFixedAt[uint32](v, i, vector.GetFixedAt[uint32](w, j))
   601  	case types.T_uint64:
   602  		err = vector.SetFixedAt[uint64](v, i, vector.GetFixedAt[uint64](w, j))
   603  	case types.T_float32:
   604  		err = vector.SetFixedAt[float32](v, i, vector.GetFixedAt[float32](w, j))
   605  	case types.T_float64:
   606  		err = vector.SetFixedAt[float64](v, i, vector.GetFixedAt[float64](w, j))
   607  	case types.T_date:
   608  		err = vector.SetFixedAt[types.Date](v, i, vector.GetFixedAt[types.Date](w, j))
   609  	case types.T_datetime:
   610  		err = vector.SetFixedAt[types.Datetime](v, i, vector.GetFixedAt[types.Datetime](w, j))
   611  	case types.T_time:
   612  		err = vector.SetFixedAt[types.Time](v, i, vector.GetFixedAt[types.Time](w, j))
   613  	case types.T_timestamp:
   614  		err = vector.SetFixedAt[types.Timestamp](v, i, vector.GetFixedAt[types.Timestamp](w, j))
   615  	case types.T_enum:
   616  		err = vector.SetFixedAt[types.Enum](v, i, vector.GetFixedAt[types.Enum](w, j))
   617  	case types.T_decimal64:
   618  		err = vector.SetFixedAt[types.Decimal64](v, i, vector.GetFixedAt[types.Decimal64](w, j))
   619  	case types.T_decimal128:
   620  		err = vector.SetFixedAt[types.Decimal128](v, i, vector.GetFixedAt[types.Decimal128](w, j))
   621  	case types.T_uuid:
   622  		err = vector.SetFixedAt[types.Uuid](v, i, vector.GetFixedAt[types.Uuid](w, j))
   623  	case types.T_TS:
   624  		err = vector.SetFixedAt[types.TS](v, i, vector.GetFixedAt[types.TS](w, j))
   625  	case types.T_Rowid:
   626  		err = vector.SetFixedAt[types.Rowid](v, i, vector.GetFixedAt[types.Rowid](w, j))
   627  	case types.T_char, types.T_varchar, types.T_binary, types.T_varbinary,
   628  		types.T_json, types.T_blob, types.T_text,
   629  		types.T_array_float32, types.T_array_float64:
   630  		err = vector.SetBytesAt(v, i, w.GetBytesAt(j), proc.Mp())
   631  	default:
   632  		panic(fmt.Sprintf("unexpect type %s for function set value in fill query", v.GetType()))
   633  	}
   634  	return err
   635  }