cockroach: github.com/cockroachdb/cockroach/pkg/internal/sqlsmith Index | Files

package sqlsmith

import "github.com/cockroachdb/cockroach/pkg/internal/sqlsmith"

Index

Package Files

alter.go random.go relational.go sampler.go scalar.go schema.go scope.go sqlsmith.go type.go

Constants

const (
    SeedTable = "" /* 657 byte string literal not displayed */

    VecSeedTable = "" /* 266 byte string literal not displayed */

)

type Context Uses

type Context struct {
    // contains filtered or unexported fields
}

Context holds information about what kinds of expressions are legal at a particular place in a query.

type Smither Uses

type Smither struct {
    // contains filtered or unexported fields
}

Smither is a sqlsmith generator.

func NewSmither Uses

func NewSmither(db *gosql.DB, rnd *rand.Rand, opts ...SmitherOption) (*Smither, error)

NewSmither creates a new Smither. db is used to populate existing tables for use as column references. It can be nil to skip table population.

func (*Smither) Generate Uses

func (s *Smither) Generate() string

Generate returns a random SQL string.

func (*Smither) GenerateExpr Uses

func (s *Smither) GenerateExpr() tree.TypedExpr

GenerateExpr returns a random SQL expression that does not depend on any tables or columns.

func (*Smither) ReloadSchemas Uses

func (s *Smither) ReloadSchemas() error

ReloadSchemas loads tables from the database.

type SmitherOption Uses

type SmitherOption interface {
    Apply(*Smither)
}

SmitherOption is an option for the Smither client.

func AvoidConsts Uses

func AvoidConsts() SmitherOption

AvoidConsts causes the Smither to prefer column references over generating constants.

func CompareMode Uses

func CompareMode() SmitherOption

CompareMode causes the Smither to generate statements that have deterministic output.

func DisableCRDBFns Uses

func DisableCRDBFns() SmitherOption

DisableCRDBFns causes the Smither to disable crdb_internal functions.

func DisableImpureFns Uses

func DisableImpureFns() SmitherOption

DisableImpureFns causes the Smither to disable impure functions.

func DisableLimits Uses

func DisableLimits() SmitherOption

DisableLimits causes the Smither to disable LIMIT clauses.

func DisableMutations Uses

func DisableMutations() SmitherOption

DisableMutations causes the Smither to not emit statements that could mutate any on-disk data.

func DisableWindowFuncs Uses

func DisableWindowFuncs() SmitherOption

DisableWindowFuncs disables window functions.

func DisableWith Uses

func DisableWith() SmitherOption

DisableWith causes the Smither to not emit WITH clauses.

func IgnoreFNs Uses

func IgnoreFNs(regex string) SmitherOption

IgnoreFNs causes the Smither to ignore functions that match the regex.

func OutputSort Uses

func OutputSort() SmitherOption

OutputSort adds a top-level ORDER BY on all columns.

func PostgresMode Uses

func PostgresMode() SmitherOption

PostgresMode causes the Smither to generate statements that work identically in Postgres and Cockroach.

func SimpleDatums Uses

func SimpleDatums() SmitherOption

SimpleDatums causes the Smither to emit simpler constant datums.

func Vectorizable Uses

func Vectorizable() SmitherOption

Vectorizable causes the Smither to limit query generation to queries supported by vectorized execution.

type WeightedSampler Uses

type WeightedSampler struct {
    // contains filtered or unexported fields
}

WeightedSampler is a weighted sampler.

func NewWeightedSampler Uses

func NewWeightedSampler(weights []int, seed int64) *WeightedSampler

NewWeightedSampler creates a WeightedSampler that produces indexes corresponding to positions in weights. They are returned at the relative frequency of the values of weights. For example, if weights is {1, 3}, reading 4 values from Next would return `0` one time and `1` three times in some random order. All weights must be >= 1.

func (*WeightedSampler) Next Uses

func (w *WeightedSampler) Next() int

Next returns the next weighted sample index.

Package sqlsmith imports 18 packages (graph) and is imported by 3 packages. Updated 2019-09-14. Refresh now. Tools for package owners.