testutil

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TestUtilMp = mpool.MustNewZeroNoFixed()

	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)
	}

	MakeUint16Vector = func(values []uint16, nsp []uint64) *vector.Vector {
		return makeVector(values, nsp, uint16Type)
	}

	MakeVarcharVector = func(values []string, nsp []uint64) *vector.Vector {
		return makeStringVector(values, nsp, varcharType)
	}

	MakeTextVector = func(values []string, nsp []uint64) *vector.Vector {
		return makeStringVector(values, nsp, textType)
	}
)

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.

View Source
var (
	MakeScalarNull = func(typ types.T, length int) *vector.Vector {
		return vector.NewConstNull(typ.ToType(), length, NewProc().Mp())
	}
	MakeScalarInt64 = func(v int64, length int) *vector.Vector {
		return makeScalar(v, length, int64Type)
	}

	MakeScalarVarchar = func(value string, length int) *vector.Vector {
		return makeScalarString(value, length, varcharType)
	}
)

functions to make a scalar vector for test.

View Source
var NewProc = NewProcess

Functions

func CompareVectors added in v0.6.0

func CompareVectors(expected *vector.Vector, got *vector.Vector) bool

func NewArrayVector added in v1.1.0

func NewArrayVector[T types.RealNumbers](n int, typ types.Type, m *mpool.MPool, random bool, vs [][]T) *vector.Vector

func NewBatch

func NewBatch(ts []types.Type, random bool, n int, m *mpool.MPool) *batch.Batch

func NewBatchWithNulls added in v0.6.0

func NewBatchWithNulls(ts []types.Type, random bool, n int, m *mpool.MPool) *batch.Batch

func NewBatchWithVectors added in v0.6.0

func NewBatchWithVectors(vs []*vector.Vector, zs []int64) *batch.Batch

func NewBlockidVector added in v0.8.0

func NewBlockidVector(n int, typ types.Type, m *mpool.MPool, _ bool, vs []types.Blockid) *vector.Vector

func NewBoolVector

func NewBoolVector(n int, typ types.Type, m *mpool.MPool, _ bool, vs []bool) *vector.Vector

func NewDateVector

func NewDateVector(n int, typ types.Type, m *mpool.MPool, random bool, vs []string) *vector.Vector

func NewDatetimeVector

func NewDatetimeVector(n int, typ types.Type, m *mpool.MPool, random bool, vs []string) *vector.Vector

func NewDecimal128Vector

func NewDecimal128Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []types.Decimal128) *vector.Vector

func NewDecimal64Vector

func NewDecimal64Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []types.Decimal64) *vector.Vector

func NewETLFS added in v1.1.0

func NewETLFS() fileservice.FileService

func NewFS added in v0.6.0

func NewFS() *fileservice.FileServices

func NewFloat32Vector

func NewFloat32Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []float32) *vector.Vector

func NewFloat64Vector

func NewFloat64Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []float64) *vector.Vector

func NewInt16Vector

func NewInt16Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []int16) *vector.Vector

func NewInt32Vector

func NewInt32Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []int32) *vector.Vector

func NewInt64Vector

func NewInt64Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []int64) *vector.Vector

func NewInt8Vector

func NewInt8Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []int8) *vector.Vector

func NewJsonVector added in v0.6.0

func NewJsonVector(n int, typ types.Type, m *mpool.MPool, _ bool, vs []string) *vector.Vector

func NewProcess added in v0.6.0

func NewProcess() *process.Process

func NewProcessWithMPool added in v0.6.0

func NewProcessWithMPool(mp *mpool.MPool) *process.Process

func NewRowidVector added in v0.7.0

func NewRowidVector(n int, typ types.Type, m *mpool.MPool, _ bool, vs []types.Rowid) *vector.Vector

func NewSharedFS added in v1.1.0

func NewSharedFS() fileservice.FileService

func NewStringVector

func NewStringVector(n int, typ types.Type, m *mpool.MPool, random bool, vs []string) *vector.Vector

func NewTimeVector added in v0.6.0

func NewTimeVector(n int, typ types.Type, m *mpool.MPool, random bool, vs []string) *vector.Vector

func NewTimestampVector

func NewTimestampVector(n int, typ types.Type, m *mpool.MPool, random bool, vs []string) *vector.Vector

func NewTsVector added in v0.7.0

func NewTsVector(n int, typ types.Type, m *mpool.MPool, _ bool, vs []types.TS) *vector.Vector

func NewUInt16Vector

func NewUInt16Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []uint16) *vector.Vector

func NewUInt32Vector

func NewUInt32Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []uint32) *vector.Vector

func NewUInt64Vector

func NewUInt64Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []uint64) *vector.Vector

func NewUInt8Vector

func NewUInt8Vector(n int, typ types.Type, m *mpool.MPool, random bool, vs []uint8) *vector.Vector

func NewVector

func NewVector(n int, typ types.Type, m *mpool.MPool, random bool, Values interface{}) *vector.Vector

func OperatorCatchBatch added in v0.8.0

func OperatorCatchBatch(operatorName string, bat *batch.Batch) string

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.

func NewFunctionTestResult added in v0.7.0

func NewFunctionTestResult(typ types.Type, wantErr bool, wanted any, nullList []bool) FunctionTestResult

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL