Documentation ¶
Index ¶
- Variables
- func CompareVectors(expected *vector.Vector, got *vector.Vector) bool
- func MakeBatchZs(n int, random bool) []int64
- func MakeDecimal128ArrByFloat64Arr(input []float64, scale int32) []types.Decimal128
- func MakeDecimal128ArrByInt64Arr(input []int64) []types.Decimal128
- func MakeDecimal128Type(width, scalar int32) types.Type
- func MakeDecimal64ArrByFloat64Arr(input []float64, scale int32) []types.Decimal64
- func MakeDecimal64ArrByInt64Arr(input []int64) []types.Decimal64
- func MakeDecimal64Type(width, scalar int32) types.Type
- func MakeRandomStrings(cardinality, targetRows int) []string
- func NewBatch(ts []types.Type, random bool, n int, m *mpool.MPool) *batch.Batch
- func NewBatchWithNulls(ts []types.Type, random bool, n int, m *mpool.MPool) *batch.Batch
- func NewBatchWithVectors(vs []*vector.Vector, zs []int64) *batch.Batch
- func NewBlockidVector(n int, typ types.Type, m *mpool.MPool, _ bool, vs []types.Blockid) *vector.Vector
- func NewBoolVector(n int, typ types.Type, m *mpool.MPool, _ bool, vs []bool) *vector.Vector
- func NewDateVector(n int, typ types.Type, m *mpool.MPool, random bool, vs []string) *vector.Vector
- func NewDatetimeVector(n int, typ types.Type, m *mpool.MPool, random bool, vs []string) *vector.Vector
- func NewDecimal128Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []types.Decimal128) *vector.Vector
- func NewDecimal64Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []types.Decimal64) *vector.Vector
- func NewFS() *fileservice.FileServices
- func NewFloat32Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []float32) *vector.Vector
- func NewFloat64Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []float64) *vector.Vector
- func NewInt16Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []int16) *vector.Vector
- func NewInt32Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []int32) *vector.Vector
- func NewInt64Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []int64) *vector.Vector
- func NewInt8Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []int8) *vector.Vector
- func NewJsonVector(n int, typ types.Type, m *mpool.MPool, _ bool, vs []string) *vector.Vector
- func NewProcess() *process.Process
- func NewProcessWithMPool(mp *mpool.MPool) *process.Process
- func NewRowidVector(n int, typ types.Type, m *mpool.MPool, _ bool, vs []types.Rowid) *vector.Vector
- func NewStringVector(n int, typ types.Type, m *mpool.MPool, random bool, vs []string) *vector.Vector
- func NewTimeVector(n int, typ types.Type, m *mpool.MPool, random bool, vs []string) *vector.Vector
- func NewTimestampVector(n int, typ types.Type, m *mpool.MPool, random bool, vs []string) *vector.Vector
- func NewTsVector(n int, typ types.Type, m *mpool.MPool, _ bool, vs []types.TS) *vector.Vector
- func NewUInt16Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []uint16) *vector.Vector
- func NewUInt32Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []uint32) *vector.Vector
- func NewUInt64Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []uint64) *vector.Vector
- func NewUInt8Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []uint8) *vector.Vector
- func NewVector(n int, typ types.Type, m *mpool.MPool, random bool, Values interface{}) *vector.Vector
- func OperatorCatchBatch(operatorName string, bat *batch.Batch) string
- func SetupAutoIncrService()
- type FunctionTestCase
- type FunctionTestInput
- type FunctionTestResult
Constants ¶
This section is empty.
Variables ¶
var ( TestUtilMp = mpool.MustNewZeroNoFixed() MakeBoolVector = func(values []bool) *vector.Vector { return makeVector(values, nil, boolType) } MakeBooleanlVector = func(values []bool, nsp []uint64) *vector.Vector { return makeVector(values, nsp, boolType) } MakeInt64Vector = func(values []int64, nsp []uint64) *vector.Vector { return makeVector(values, nsp, int64Type) } MakeInt32Vector = func(values []int32, nsp []uint64) *vector.Vector { return makeVector(values, nsp, int32Type) } MakeInt16Vector = func(values []int16, nsp []uint64) *vector.Vector { return makeVector(values, nsp, int16Type) } MakeRowIdVector = func(values []types.Rowid, nsp []uint64) *vector.Vector { return makeVector(values, nsp, rowIdType) } MakeInt8Vector = func(values []int8, nsp []uint64) *vector.Vector { return makeVector(values, nsp, int8Type) } MakeUint64Vector = func(values []uint64, nsp []uint64) *vector.Vector { return makeVector(values, nsp, uint64Type) } MakeUint32Vector = func(values []uint32, nsp []uint64) *vector.Vector { return makeVector(values, nsp, uint32Type) } MakeUint16Vector = func(values []uint16, nsp []uint64) *vector.Vector { return makeVector(values, nsp, uint16Type) } MakeUint8Vector = func(values []uint8, nsp []uint64) *vector.Vector { return makeVector(values, nsp, uint8Type) } MakeFloat32Vector = func(values []float32, nsp []uint64) *vector.Vector { return makeVector(values, nsp, float32Type) } MakeFloat64Vector = func(values []float64, nsp []uint64) *vector.Vector { return makeVector(values, nsp, float64Type) } MakeCharVector = func(values []string, nsp []uint64) *vector.Vector { return makeStringVector(values, nsp, charType) } MakeVarcharVector = func(values []string, nsp []uint64) *vector.Vector { return makeStringVector(values, nsp, varcharType) } MakeBinaryVector = func(values []string, nsp []uint64) *vector.Vector { return makeStringVector(values, nsp, binaryType) } MakeVarbinaryVector = func(values []string, nsp []uint64) *vector.Vector { return makeStringVector(values, nsp, varbinaryType) } MakeBlobVector = func(values []string, nsp []uint64) *vector.Vector { return makeStringVector(values, nsp, blobType) } MakeTextVector = func(values []string, nsp []uint64) *vector.Vector { return makeStringVector(values, nsp, textType) } MakeDecimal64Vector = func(values []int64, nsp []uint64, _ types.Type) *vector.Vector { cols := make([]types.Decimal64, len(values)) for i, v := range values { d := types.Decimal64(v) cols[i] = d } return makeVector(cols, nsp, decimal64Type) } MakeDecimal128Vector = func(values []int64, nsp []uint64, _ types.Type) *vector.Vector { cols := make([]types.Decimal128, len(values)) for i, v := range values { d := types.Decimal128{B0_63: uint64(v), B64_127: 0} if v < 0 { d.B64_127 = ^d.B64_127 } cols[i] = d } return makeVector(cols, nsp, decimal128Type) } MakeDateVector = func(values []string, nsp []uint64) *vector.Vector { ds := make([]types.Date, len(values)) ns := nulls.Build(len(values), nsp...) for i, s := range values { if nulls.Contains(ns, uint64(i)) { continue } d, err := types.ParseDateCast(s) if err != nil { panic(err) } ds[i] = d } vec := vector.NewVec(types.T_date.ToType()) vector.AppendFixedList(vec, ds, nil, TestUtilMp) vec.SetNulls(ns) return vec } MakeTimeVector = func(values []string, nsp []uint64) *vector.Vector { ds := make([]types.Time, len(values)) ns := nulls.Build(len(values), nsp...) for i, s := range values { if nulls.Contains(ns, uint64(i)) { continue } d, err := types.ParseTime(s, 6) if err != nil { panic(err) } ds[i] = d } vec := vector.NewVec(types.T_time.ToType()) vector.AppendFixedList(vec, ds, nil, TestUtilMp) vec.SetNulls(ns) return vec } MakeDateTimeVector = func(values []string, nsp []uint64) *vector.Vector { ds := make([]types.Datetime, len(values)) ns := nulls.Build(len(values), nsp...) for i, s := range values { if nulls.Contains(ns, uint64(i)) { continue } d, err := types.ParseDatetime(s, 6) if err != nil { panic(err) } ds[i] = d } vec := vector.NewVec(types.T_datetime.ToType()) vector.AppendFixedList(vec, ds, nil, TestUtilMp) vec.SetNulls(ns) return vec } MakeTimeStampVector = func(values []string, nsp []uint64) *vector.Vector { ds := make([]types.Timestamp, len(values)) ns := nulls.Build(len(values), nsp...) for i, s := range values { if nulls.Contains(ns, uint64(i)) { continue } d, err := types.ParseTimestamp(time.Local, s, 6) if err != nil { panic(err) } ds[i] = d } vec := vector.NewVec(types.T_timestamp.ToType()) vector.AppendFixedList(vec, ds, nil, TestUtilMp) vec.SetNulls(ns) return vec } MakeUuidVector = func(values []types.Uuid, nsp []uint64) *vector.Vector { ns := nulls.Build(len(values), nsp...) vec := vector.NewVec(uuidType) vector.AppendFixedList(vec, values, nil, TestUtilMp) vec.SetNulls(ns) return vec } MakeUuidVectorByString = func(values []string, nsp []uint64) *vector.Vector { ds := make([]types.Uuid, len(values)) ns := nulls.Build(len(values), nsp...) for i, s := range values { if nulls.Contains(ns, uint64(i)) { continue } d, err := types.ParseUuid(s) if err != nil { panic(err) } ds[i] = d } vec := vector.NewVec(types.T_uuid.ToType()) vector.AppendFixedList(vec, ds, nil, TestUtilMp) vec.SetNulls(ns) return vec } )
All vectors generated by the Make Function, their memory is not allocated through the memory pool if you want to generate a vector in memory pool, use NewFunction to instead of MakeFunction.
var ( MakeScalarNull = func(typ types.T, length int) *vector.Vector { return vector.NewConstNull(typ.ToType(), length, NewProc().Mp()) } MakeScalarBool = func(v bool, length int) *vector.Vector { return makeScalar(v, length, boolType) } MakeScalarInt64 = func(v int64, length int) *vector.Vector { return makeScalar(v, length, int64Type) } MakeScalarInt32 = func(v int32, length int) *vector.Vector { return makeScalar(v, length, int32Type) } MakeScalarInt16 = func(v int16, length int) *vector.Vector { return makeScalar(v, length, int16Type) } MakeScalarInt8 = func(v int8, length int) *vector.Vector { return makeScalar(v, length, int8Type) } MakeScalarUint64 = func(v uint64, length int) *vector.Vector { return makeScalar(v, length, uint64Type) } MakeScalarUint3 = func(v uint32, length int) *vector.Vector { return makeScalar(v, length, uint32Type) } MakeScalarUint16 = func(v uint16, length int) *vector.Vector { return makeScalar(v, length, uint16Type) } MakeScalarUint8 = func(v uint8, length int) *vector.Vector { return makeScalar(v, length, uint8Type) } MakeScalarFloat32 = func(v float32, length int) *vector.Vector { return makeScalar(v, length, float32Type) } MakeScalarFloat64 = func(v float64, length int) *vector.Vector { return makeScalar(v, length, float64Type) } MakeScalarChar = func(value string, length int) *vector.Vector { return makeScalarString(value, length, charType) } MakeScalarVarchar = func(value string, length int) *vector.Vector { return makeScalarString(value, length, varcharType) } MakeTextVarchar = func(value string, length int) *vector.Vector { return makeScalarString(value, length, textType) } MakeScalarDate = func(value string, length int) *vector.Vector { d, err := types.ParseDateCast(value) if err != nil { panic(err) } return makeScalar(d, length, dateType) } MakeScalarTime = func(value string, length int) *vector.Vector { d, err := types.ParseTime(value, 6) if err != nil { panic(err) } return makeScalar(d, length, timeType) } MakeScalarDateTime = func(value string, length int) *vector.Vector { d, err := types.ParseDatetime(value, 6) if err != nil { panic(err) } return makeScalar(d, length, datetimeType) } MakeScalarTimeStamp = func(value string, length int) *vector.Vector { d, err := types.ParseTimestamp(time.Local, value, 6) if err != nil { panic(err) } return makeScalar(d, length, timestampType) } MakeScalarDecimal64 = func(v int64, length int, _ types.Type) *vector.Vector { d := types.Decimal64(v) return makeScalar(d, length, decimal64Type) } MakeScalarDecimal128 = func(v uint64, length int, _ types.Type) *vector.Vector { d := types.Decimal128{B0_63: uint64(v), B64_127: 0} return makeScalar(d, length, decimal128Type) } MakeScalarDecimal128ByFloat64 = func(v float64, length int, typ types.Type) *vector.Vector { val := fmt.Sprintf("%f", v) _, scale, err := types.Parse128(val) typ.Scale = scale if err != nil { panic(err) } dec128Val, err := types.ParseDecimal128(val, 38, scale) if err != nil { panic(err) } return makeScalar(dec128Val, length, decimal128Type) } )
functions to make a scalar vector for test.
var NewProc = NewProcess
Functions ¶
func CompareVectors ¶ added in v0.6.0
func MakeBatchZs ¶ added in v0.6.0
func MakeDecimal128ArrByFloat64Arr ¶ added in v0.6.0
func MakeDecimal128ArrByFloat64Arr(input []float64, scale int32) []types.Decimal128
func MakeDecimal128ArrByInt64Arr ¶ added in v0.6.0
func MakeDecimal128ArrByInt64Arr(input []int64) []types.Decimal128
func MakeDecimal128Type ¶ added in v0.6.0
func MakeDecimal64ArrByFloat64Arr ¶ added in v0.6.0
func MakeDecimal64ArrByInt64Arr ¶ added in v0.6.0
func MakeDecimal64Type ¶ added in v0.6.0
func MakeRandomStrings ¶ added in v0.6.0
func NewBatchWithNulls ¶ added in v0.6.0
func NewBatchWithVectors ¶ added in v0.6.0
func NewBlockidVector ¶ added in v0.8.0
func NewBoolVector ¶
func NewDateVector ¶
func NewDatetimeVector ¶
func NewDecimal128Vector ¶
func NewDecimal64Vector ¶
func NewFS ¶ added in v0.6.0
func NewFS() *fileservice.FileServices
func NewFloat32Vector ¶
func NewFloat64Vector ¶
func NewInt16Vector ¶
func NewInt32Vector ¶
func NewInt64Vector ¶
func NewInt8Vector ¶
func NewJsonVector ¶ added in v0.6.0
func NewProcess ¶ added in v0.6.0
func NewProcessWithMPool ¶ added in v0.6.0
func NewRowidVector ¶ added in v0.7.0
func NewStringVector ¶
func NewTimeVector ¶ added in v0.6.0
func NewTimestampVector ¶
func NewTsVector ¶ added in v0.7.0
func NewUInt16Vector ¶
func NewUInt32Vector ¶
func NewUInt64Vector ¶
func NewUInt8Vector ¶
func OperatorCatchBatch ¶ added in v0.8.0
OperatorCatchBatch return a string with format
`insert operator catch a batch, batch length is 100, [vec 0 : len is 100]`
func SetupAutoIncrService ¶ added in v0.8.0
func SetupAutoIncrService()
Types ¶
type FunctionTestCase ¶ added in v0.7.0
type FunctionTestCase struct {
// contains filtered or unexported fields
}
func NewFunctionTestCase ¶ added in v0.7.0
func NewFunctionTestCase( proc *process.Process, inputs []FunctionTestInput, wanted FunctionTestResult, fn fEvalFn) FunctionTestCase
NewFunctionTestCase generate a testcase for built-in function F. fn is the evaluate method of F.
func (*FunctionTestCase) BenchMarkRun ¶ added in v0.7.0
func (fc *FunctionTestCase) BenchMarkRun() error
BenchMarkRun will run the function case N times without correctness check for result.
func (*FunctionTestCase) DebugRun ¶ added in v0.7.0
func (fc *FunctionTestCase) DebugRun() (*vector.Vector, error)
DebugRun will not run the compare logic for function result but return the result vector directly.
func (*FunctionTestCase) GetResultVectorDirectly ¶ added in v0.8.0
func (fc *FunctionTestCase) GetResultVectorDirectly() *vector.Vector
func (*FunctionTestCase) Run ¶ added in v0.7.0
func (fc *FunctionTestCase) Run() (succeed bool, errInfo string)
Run will run the function case and do the correctness check for result.
type FunctionTestInput ¶ added in v0.7.0
type FunctionTestInput struct {
// contains filtered or unexported fields
}
FunctionTestInput the values should fit to typ. for example: if typ is int64, the values should be []int64 if your typ is string type (varchar or others), the values should be []string.
func NewFunctionTestConstInput ¶ added in v0.8.0
func NewFunctionTestConstInput(typ types.Type, values any, nullList []bool) FunctionTestInput
func NewFunctionTestInput ¶ added in v0.7.0
func NewFunctionTestInput(typ types.Type, values any, nullList []bool) FunctionTestInput
type FunctionTestResult ¶ added in v0.7.0
type FunctionTestResult struct {
// contains filtered or unexported fields
}
FunctionTestResult the wanted should fit to typ. for example: if typ is int64, the wanted should be []int64 if your typ is string type (varchar or others), the wanted should be []string.