testutils

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildFilters

func BuildFilters(
	t *testing.T, f *norm.Factory, semaCtx *tree.SemaContext, evalCtx *tree.EvalContext, input string,
) memo.FiltersExpr

BuildFilters builds the given input string as a FiltersExpr and returns it. Calls a subset of the normalization rules that would apply if these filters were built as part of a Select or Join.

func BuildQuery

func BuildQuery(
	t *testing.T, o *xform.Optimizer, catalog cat.Catalog, evalCtx *tree.EvalContext, sql string,
)

BuildQuery initializes an optimizer and builds the given sql statement.

func BuildScalar

func BuildScalar(
	t *testing.T, f *norm.Factory, semaCtx *tree.SemaContext, evalCtx *tree.EvalContext, input string,
) opt.ScalarExpr

BuildScalar builds the given input string as a ScalarExpr and returns it.

func GetTestFiles

func GetTestFiles(tb testing.TB, testdataGlob string) []string

GetTestFiles returns the set of test files that matches the Glob pattern.

Types

type ScalarVars

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

ScalarVars is a helper used to populate the metadata with specified columns, useful for tests involving scalar expressions.

func (*ScalarVars) Cols

func (sv *ScalarVars) Cols() opt.ColSet

Cols returns all the columns.

func (*ScalarVars) ComputedCols

func (sv *ScalarVars) ComputedCols() map[opt.ColumnID]tree.Expr

ComputedCols returns a map of computed column expressions.

func (*ScalarVars) Init

func (sv *ScalarVars) Init(md *opt.Metadata, vars []string) error

Init parses variables definition strings, adds new columns to the metadata, and initializes the ScalarVars.

Each definition string is of the form:

"<var-name> type1 [not null]

The not-null columns can be retrieved via NotNullCols().

func (*ScalarVars) NotNullCols

func (sv *ScalarVars) NotNullCols() opt.ColSet

NotNullCols returns the columns that correspond to not null variables.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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