aggregation

package
v0.0.0-...-e065498 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEvalUnsupportedOnAggregation = errors.NewKind("Unimplemented %s.Eval(). The code should have used AggregationBuffer.Eval(ctx).")
View Source
var ErrNoPartitions = errors.New("no partitions")
View Source
var ErrPartitionNotSet = errors.New("attempted to general a window frame interval before framer partition was set")
View Source
var ErrRangeIntervalTypeMismatch = errors.New("range bound type must match the order by expression type")
View Source
var ErrRangeInvalidOrderBy = sqlerr.NewKind("a range's order by must be one expression; found: %d")
View Source
var ErrUnsupportedJSONFunction = errors.NewKind("unsupported JSON function: %s")

ErrUnsupportedJSONFunction is returned when a unsupported JSON function is called.

View Source
var UnaryAggDefs support.GenDefs = []support.AggDef{
	{
		Name:     "AnyValue",
		Desc:     "returns any single value in the grouped rows",
		Nullable: true,
	},
	{
		Name:     "Avg",
		Desc:     "returns the average value of expr in all rows.",
		Nullable: true,
	},
	{
		Name:    "BitAnd",
		Desc:    "returns the bitwise AND of all bits in expr.",
		RetType: "sql.Uint64",
	},
	{
		Name:    "BitOr",
		Desc:    "returns the bitwise OR of all bits in expr.",
		RetType: "sql.Uint64",
	},
	{
		Name:    "BitXor",
		Desc:    "returns the bitwise XOR of all bits in expr.",
		RetType: "sql.Uint64",
	},
	{
		Name:    "Count",
		Desc:    "returns a count of the number of non-NULL values of expr in the rows retrieved by a SELECT statement.",
		RetType: "sql.Int64",
	},
	{
		Name: "First",
		Desc: "returns the first value in a sequence of elements of an aggregation.",
	},
	{
		Name:    "JsonArray",
		SqlName: "json_arrayagg",
		Desc:    "returns result set as a single JSON array.",
		RetType: "sql.JSON",
	},
	{
		Name: "Last",
		Desc: "returns the last value in a sequence of elements of an aggregation.",
	},
	{
		Name: "Max",
		Desc: "returns the maximum value of expr in all rows.",
	},
	{
		Name: "Min",
		Desc: "returns the minimum value of expr in all rows.",
	},
	{
		Name:     "Sum",
		Desc:     "returns the sum of expr in all rows",
		Nullable: false,
	},
}

Functions

func NewAnyValueBuffer

func NewAnyValueBuffer(child sql.Expression) *anyValueBuffer

func NewAvgBuffer

func NewAvgBuffer(child sql.Expression) *avgBuffer

func NewBitAndBuffer

func NewBitAndBuffer(child sql.Expression) *bitAndBuffer

func NewBitOrBuffer

func NewBitOrBuffer(child sql.Expression) *bitOrBuffer

func NewBitXorBuffer

func NewBitXorBuffer(child sql.Expression) *bitXorBuffer

func NewCountBuffer

func NewCountBuffer(child sql.Expression) *countBuffer

func NewCountDistinctBuffer

func NewCountDistinctBuffer(children []sql.Expression) *countDistinctBuffer

func NewEmptyGroupConcat

func NewEmptyGroupConcat() sql.Expression

func NewFirstBuffer

func NewFirstBuffer(child sql.Expression) *firstBuffer

func NewJSONObjectAgg

func NewJSONObjectAgg(key, value sql.Expression) sql.Expression

NewJSONObjectAgg creates a new JSONObjectAgg function.

func NewJsonArrayBuffer

func NewJsonArrayBuffer(child sql.Expression) *jsonArrayBuffer

func NewLastBuffer

func NewLastBuffer(child sql.Expression) *lastBuffer

func NewMaxBuffer

func NewMaxBuffer(child sql.Expression) *maxBuffer

func NewMinBuffer

func NewMinBuffer(child sql.Expression) *minBuffer

func NewRangeCurrentRowToCurrentRowFramer

func NewRangeCurrentRowToCurrentRowFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRangeCurrentRowToNFollowingFramer

func NewRangeCurrentRowToNFollowingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRangeCurrentRowToNPrecedingFramer

func NewRangeCurrentRowToNPrecedingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRangeCurrentRowToUnboundedFollowingFramer

func NewRangeCurrentRowToUnboundedFollowingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRangeNFollowingToCurrentRowFramer

func NewRangeNFollowingToCurrentRowFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRangeNFollowingToNFollowingFramer

func NewRangeNFollowingToNFollowingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRangeNFollowingToNPrecedingFramer

func NewRangeNFollowingToNPrecedingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRangeNFollowingToUnboundedFollowingFramer

func NewRangeNFollowingToUnboundedFollowingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRangeNPrecedingToCurrentRowFramer

func NewRangeNPrecedingToCurrentRowFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRangeNPrecedingToNFollowingFramer

func NewRangeNPrecedingToNFollowingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRangeNPrecedingToNPrecedingFramer

func NewRangeNPrecedingToNPrecedingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRangeNPrecedingToUnboundedFollowingFramer

func NewRangeNPrecedingToUnboundedFollowingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRangeUnboundedPrecedingToCurrentRowFramer

func NewRangeUnboundedPrecedingToCurrentRowFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRangeUnboundedPrecedingToNFollowingFramer

func NewRangeUnboundedPrecedingToNFollowingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRangeUnboundedPrecedingToNPrecedingFramer

func NewRangeUnboundedPrecedingToNPrecedingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRangeUnboundedPrecedingToUnboundedFollowingFramer

func NewRangeUnboundedPrecedingToUnboundedFollowingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRowsCurrentRowToCurrentRowFramer

func NewRowsCurrentRowToCurrentRowFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRowsCurrentRowToNFollowingFramer

func NewRowsCurrentRowToNFollowingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRowsCurrentRowToNPrecedingFramer

func NewRowsCurrentRowToNPrecedingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRowsCurrentRowToUnboundedFollowingFramer

func NewRowsCurrentRowToUnboundedFollowingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRowsNFollowingToCurrentRowFramer

func NewRowsNFollowingToCurrentRowFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRowsNFollowingToNFollowingFramer

func NewRowsNFollowingToNFollowingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRowsNFollowingToNPrecedingFramer

func NewRowsNFollowingToNPrecedingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRowsNFollowingToUnboundedFollowingFramer

func NewRowsNFollowingToUnboundedFollowingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRowsNPrecedingToCurrentRowFramer

func NewRowsNPrecedingToCurrentRowFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRowsNPrecedingToNFollowingFramer

func NewRowsNPrecedingToNFollowingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRowsNPrecedingToNPrecedingFramer

func NewRowsNPrecedingToNPrecedingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRowsNPrecedingToUnboundedFollowingFramer

func NewRowsNPrecedingToUnboundedFollowingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRowsUnboundedPrecedingToCurrentRowFramer

func NewRowsUnboundedPrecedingToCurrentRowFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRowsUnboundedPrecedingToNFollowingFramer

func NewRowsUnboundedPrecedingToNFollowingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRowsUnboundedPrecedingToNPrecedingFramer

func NewRowsUnboundedPrecedingToNPrecedingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewRowsUnboundedPrecedingToUnboundedFollowingFramer

func NewRowsUnboundedPrecedingToUnboundedFollowingFramer(frame sql.WindowFrame, window *sql.WindowDefinition) (sql.WindowFramer, error)

func NewSumBuffer

func NewSumBuffer(child sql.Expression) *sumBuffer

Types

type Aggregation

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

Aggregation comprises a sql.WindowFunction and a companion sql.WindowFramer. A parent WindowPartitionIter feeds [fn] with intervals from the [framer]. Iteration logic is divided between [fn] and [framer] depending on context. For example, some aggregation functions like PercentRank and CountAgg track peer groups within a partition, more state than the framer provides.

func NewAggregation

func NewAggregation(a sql.WindowFunction, f sql.WindowFramer) *Aggregation

type AnyValue

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

func NewAnyValue

func NewAnyValue(e sql.Expression) *AnyValue

func (*AnyValue) Children

func (a *AnyValue) Children() []sql.Expression

func (AnyValue) Description

func (a AnyValue) Description() string

func (*AnyValue) Eval

func (a *AnyValue) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

func (AnyValue) FunctionName

func (a AnyValue) FunctionName() string

func (*AnyValue) IsNullable

func (a *AnyValue) IsNullable() bool

func (*AnyValue) NewBuffer

func (a *AnyValue) NewBuffer() (sql.AggregationBuffer, error)

func (*AnyValue) NewWindowFunction

func (a *AnyValue) NewWindowFunction() (sql.WindowFunction, error)

func (*AnyValue) Resolved

func (a *AnyValue) Resolved() bool

func (*AnyValue) String

func (a *AnyValue) String() string

func (*AnyValue) Type

func (a *AnyValue) Type() sql.Type

func (*AnyValue) Window

func (a *AnyValue) Window() *sql.WindowDefinition

func (*AnyValue) WithChildren

func (a *AnyValue) WithChildren(children ...sql.Expression) (sql.Expression, error)

func (*AnyValue) WithWindow

func (a *AnyValue) WithWindow(window *sql.WindowDefinition) (sql.Aggregation, error)

type AnyValueAgg

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

func NewAnyValueAgg

func NewAnyValueAgg(e sql.Expression) *AnyValueAgg

func (*AnyValueAgg) Compute

func (a *AnyValueAgg) Compute(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) interface{}

func (*AnyValueAgg) DefaultFramer

func (a *AnyValueAgg) DefaultFramer() sql.WindowFramer

DefaultFramer returns a NewUnboundedPrecedingToCurrentRowFramer

func (*AnyValueAgg) Dispose

func (a *AnyValueAgg) Dispose()

func (*AnyValueAgg) StartPartition

func (a *AnyValueAgg) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) error

func (*AnyValueAgg) WithWindow

func (a *AnyValueAgg) WithWindow(w *sql.WindowDefinition) (sql.WindowFunction, error)

type Avg

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

func NewAvg

func NewAvg(e sql.Expression) *Avg

func (*Avg) Children

func (a *Avg) Children() []sql.Expression

func (Avg) Description

func (a Avg) Description() string

func (*Avg) Eval

func (a *Avg) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

func (Avg) FunctionName

func (a Avg) FunctionName() string

func (*Avg) IsNullable

func (a *Avg) IsNullable() bool

func (*Avg) NewBuffer

func (a *Avg) NewBuffer() (sql.AggregationBuffer, error)

func (*Avg) NewWindowFunction

func (a *Avg) NewWindowFunction() (sql.WindowFunction, error)

func (*Avg) Resolved

func (a *Avg) Resolved() bool

func (*Avg) String

func (a *Avg) String() string

func (*Avg) Type

func (a *Avg) Type() sql.Type

func (*Avg) Window

func (a *Avg) Window() *sql.WindowDefinition

func (*Avg) WithChildren

func (a *Avg) WithChildren(children ...sql.Expression) (sql.Expression, error)

func (*Avg) WithWindow

func (a *Avg) WithWindow(window *sql.WindowDefinition) (sql.Aggregation, error)

type AvgAgg

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

func NewAvgAgg

func NewAvgAgg(e sql.Expression) *AvgAgg

func (*AvgAgg) Compute

func (a *AvgAgg) Compute(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) interface{}

func (*AvgAgg) DefaultFramer

func (a *AvgAgg) DefaultFramer() sql.WindowFramer

DefaultFramer returns a NewUnboundedPrecedingToCurrentRowFramer

func (*AvgAgg) Dispose

func (a *AvgAgg) Dispose()

func (*AvgAgg) NewSlidingFrameInterval

func (a *AvgAgg) NewSlidingFrameInterval(added, dropped sql.WindowInterval)

func (*AvgAgg) StartPartition

func (a *AvgAgg) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) error

func (*AvgAgg) WithWindow

func (a *AvgAgg) WithWindow(w *sql.WindowDefinition) (sql.WindowFunction, error)

type BitAnd

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

func NewBitAnd

func NewBitAnd(e sql.Expression) *BitAnd

func (*BitAnd) Children

func (a *BitAnd) Children() []sql.Expression

func (BitAnd) Description

func (a BitAnd) Description() string

func (*BitAnd) Eval

func (a *BitAnd) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

func (BitAnd) FunctionName

func (a BitAnd) FunctionName() string

func (*BitAnd) IsNullable

func (a *BitAnd) IsNullable() bool

func (*BitAnd) NewBuffer

func (a *BitAnd) NewBuffer() (sql.AggregationBuffer, error)

func (*BitAnd) NewWindowFunction

func (a *BitAnd) NewWindowFunction() (sql.WindowFunction, error)

func (*BitAnd) Resolved

func (a *BitAnd) Resolved() bool

func (*BitAnd) String

func (a *BitAnd) String() string

func (*BitAnd) Type

func (a *BitAnd) Type() sql.Type

func (*BitAnd) Window

func (a *BitAnd) Window() *sql.WindowDefinition

func (*BitAnd) WithChildren

func (a *BitAnd) WithChildren(children ...sql.Expression) (sql.Expression, error)

func (*BitAnd) WithWindow

func (a *BitAnd) WithWindow(window *sql.WindowDefinition) (sql.Aggregation, error)

type BitAndAgg

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

func NewBitAndAgg

func NewBitAndAgg(e sql.Expression) *BitAndAgg

func (*BitAndAgg) Compute

func (b *BitAndAgg) Compute(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) interface{}

func (*BitAndAgg) DefaultFramer

func (b *BitAndAgg) DefaultFramer() sql.WindowFramer

DefaultFramer returns a NewUnboundedPrecedingToCurrentRowFramer

func (*BitAndAgg) Dispose

func (b *BitAndAgg) Dispose()

func (*BitAndAgg) NewSlidingFrameInterval

func (b *BitAndAgg) NewSlidingFrameInterval(added, dropped sql.WindowInterval)

func (*BitAndAgg) StartPartition

func (b *BitAndAgg) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) error

func (*BitAndAgg) WithWindow

func (b *BitAndAgg) WithWindow(w *sql.WindowDefinition) (sql.WindowFunction, error)

type BitOr

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

func NewBitOr

func NewBitOr(e sql.Expression) *BitOr

func (*BitOr) Children

func (a *BitOr) Children() []sql.Expression

func (BitOr) Description

func (a BitOr) Description() string

func (*BitOr) Eval

func (a *BitOr) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

func (BitOr) FunctionName

func (a BitOr) FunctionName() string

func (*BitOr) IsNullable

func (a *BitOr) IsNullable() bool

func (*BitOr) NewBuffer

func (a *BitOr) NewBuffer() (sql.AggregationBuffer, error)

func (*BitOr) NewWindowFunction

func (a *BitOr) NewWindowFunction() (sql.WindowFunction, error)

func (*BitOr) Resolved

func (a *BitOr) Resolved() bool

func (*BitOr) String

func (a *BitOr) String() string

func (*BitOr) Type

func (a *BitOr) Type() sql.Type

func (*BitOr) Window

func (a *BitOr) Window() *sql.WindowDefinition

func (*BitOr) WithChildren

func (a *BitOr) WithChildren(children ...sql.Expression) (sql.Expression, error)

func (*BitOr) WithWindow

func (a *BitOr) WithWindow(window *sql.WindowDefinition) (sql.Aggregation, error)

type BitOrAgg

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

func NewBitOrAgg

func NewBitOrAgg(e sql.Expression) *BitOrAgg

func (*BitOrAgg) Compute

func (b *BitOrAgg) Compute(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) interface{}

func (*BitOrAgg) DefaultFramer

func (b *BitOrAgg) DefaultFramer() sql.WindowFramer

DefaultFramer returns a NewUnboundedPrecedingToCurrentRowFramer

func (*BitOrAgg) Dispose

func (b *BitOrAgg) Dispose()

func (*BitOrAgg) NewSlidingFrameInterval

func (b *BitOrAgg) NewSlidingFrameInterval(added, dropped sql.WindowInterval)

func (*BitOrAgg) StartPartition

func (b *BitOrAgg) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) error

func (*BitOrAgg) WithWindow

func (b *BitOrAgg) WithWindow(w *sql.WindowDefinition) (sql.WindowFunction, error)

type BitXor

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

func NewBitXor

func NewBitXor(e sql.Expression) *BitXor

func (*BitXor) Children

func (a *BitXor) Children() []sql.Expression

func (BitXor) Description

func (a BitXor) Description() string

func (*BitXor) Eval

func (a *BitXor) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

func (BitXor) FunctionName

func (a BitXor) FunctionName() string

func (*BitXor) IsNullable

func (a *BitXor) IsNullable() bool

func (*BitXor) NewBuffer

func (a *BitXor) NewBuffer() (sql.AggregationBuffer, error)

func (*BitXor) NewWindowFunction

func (a *BitXor) NewWindowFunction() (sql.WindowFunction, error)

func (*BitXor) Resolved

func (a *BitXor) Resolved() bool

func (*BitXor) String

func (a *BitXor) String() string

func (*BitXor) Type

func (a *BitXor) Type() sql.Type

func (*BitXor) Window

func (a *BitXor) Window() *sql.WindowDefinition

func (*BitXor) WithChildren

func (a *BitXor) WithChildren(children ...sql.Expression) (sql.Expression, error)

func (*BitXor) WithWindow

func (a *BitXor) WithWindow(window *sql.WindowDefinition) (sql.Aggregation, error)

type BitXorAgg

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

func NewBitXorAgg

func NewBitXorAgg(e sql.Expression) *BitXorAgg

func (*BitXorAgg) Compute

func (b *BitXorAgg) Compute(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) interface{}

func (*BitXorAgg) DefaultFramer

func (b *BitXorAgg) DefaultFramer() sql.WindowFramer

DefaultFramer returns a NewUnboundedPrecedingToCurrentRowFramer

func (*BitXorAgg) Dispose

func (b *BitXorAgg) Dispose()

func (*BitXorAgg) NewSlidingFrameInterval

func (b *BitXorAgg) NewSlidingFrameInterval(added, dropped sql.WindowInterval)

func (*BitXorAgg) StartPartition

func (b *BitXorAgg) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) error

func (*BitXorAgg) WithWindow

func (b *BitXorAgg) WithWindow(w *sql.WindowDefinition) (sql.WindowFunction, error)

type Count

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

func NewCount

func NewCount(e sql.Expression) *Count

func (*Count) Children

func (a *Count) Children() []sql.Expression

func (Count) Description

func (a Count) Description() string

func (*Count) Eval

func (a *Count) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

func (Count) FunctionName

func (a Count) FunctionName() string

func (*Count) IsNullable

func (a *Count) IsNullable() bool

func (*Count) NewBuffer

func (a *Count) NewBuffer() (sql.AggregationBuffer, error)

func (*Count) NewWindowFunction

func (a *Count) NewWindowFunction() (sql.WindowFunction, error)

func (*Count) Resolved

func (a *Count) Resolved() bool

func (*Count) String

func (a *Count) String() string

func (*Count) Type

func (a *Count) Type() sql.Type

func (*Count) Window

func (a *Count) Window() *sql.WindowDefinition

func (*Count) WithChildren

func (a *Count) WithChildren(children ...sql.Expression) (sql.Expression, error)

func (*Count) WithWindow

func (a *Count) WithWindow(window *sql.WindowDefinition) (sql.Aggregation, error)

type CountAgg

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

func NewCountAgg

func NewCountAgg(e sql.Expression) *CountAgg

func NewCountDistinctAgg

func NewCountDistinctAgg(e sql.Expression) *CountAgg

func (*CountAgg) Compute

func (a *CountAgg) Compute(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) interface{}

func (*CountAgg) DefaultFramer

func (a *CountAgg) DefaultFramer() sql.WindowFramer

DefaultFramer returns a NewPartitionFramer

func (*CountAgg) Dispose

func (a *CountAgg) Dispose()

func (*CountAgg) NewSlidingFrameInterval

func (a *CountAgg) NewSlidingFrameInterval(added, dropped sql.WindowInterval)

func (*CountAgg) StartPartition

func (a *CountAgg) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) error

func (*CountAgg) WithWindow

func (a *CountAgg) WithWindow(w *sql.WindowDefinition) (sql.WindowFunction, error)

type CountDistinct

type CountDistinct struct {
	expression.NaryExpression
	// contains filtered or unexported fields
}

func NewCountDistinct

func NewCountDistinct(exprs ...sql.Expression) *CountDistinct

func (*CountDistinct) Children

func (a *CountDistinct) Children() []sql.Expression

Children implements the Expression interface.

func (*CountDistinct) Description

func (a *CountDistinct) Description() string

Description implements the FunctionExpression interface.

func (*CountDistinct) Eval

func (a *CountDistinct) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*CountDistinct) FunctionName

func (a *CountDistinct) FunctionName() string

FunctionName implements the FunctionExpression interface.

func (*CountDistinct) IsNullable

func (a *CountDistinct) IsNullable() bool

IsNullable implements the Expression interface.

func (*CountDistinct) NewBuffer

func (a *CountDistinct) NewBuffer() (sql.AggregationBuffer, error)

NewBuffer implements the Aggregation interface.

func (*CountDistinct) NewWindowFunction

func (a *CountDistinct) NewWindowFunction() (sql.WindowFunction, error)

NewWindowFunction implements the WindowAdaptableExpression interface.

func (*CountDistinct) String

func (a *CountDistinct) String() string

String implements the ValueStats interface.

func (*CountDistinct) Type

func (a *CountDistinct) Type() sql.Type

Type implements the Expression interface.

func (*CountDistinct) Window

func (a *CountDistinct) Window() *sql.WindowDefinition

Window implements the Aggregation interface.

func (*CountDistinct) WithChildren

func (a *CountDistinct) WithChildren(children ...sql.Expression) (sql.Expression, error)

WithChildren implements the Expression interface.

func (*CountDistinct) WithWindow

func (a *CountDistinct) WithWindow(window *sql.WindowDefinition) (sql.Aggregation, error)

WithWindow implements the Aggregation interface.

type DenseRank

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

func NewDenseRank

func NewDenseRank(orderBy []sql.Expression) *DenseRank

func (*DenseRank) Compute

func (a *DenseRank) Compute(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) interface{}

Compute returns the number of unique elements before the current peer group (rank) + 1. ex: [1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6] => every 3 returns uint64(3) because there are 2 unique values less than 3

func (DenseRank) DefaultFramer

func (a DenseRank) DefaultFramer() sql.WindowFramer

func (DenseRank) Dispose

func (a DenseRank) Dispose()

func (DenseRank) NewSlidingFrameInterval

func (a DenseRank) NewSlidingFrameInterval(added, dropped sql.WindowInterval)

func (DenseRank) StartPartition

func (a DenseRank) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buffer sql.WindowBuffer) error

func (DenseRank) WithWindow

func (a DenseRank) WithWindow(w *sql.WindowDefinition) (sql.WindowFunction, error)

type First

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

func NewFirst

func NewFirst(e sql.Expression) *First

func (*First) Children

func (a *First) Children() []sql.Expression

func (First) Description

func (a First) Description() string

func (*First) Eval

func (a *First) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

func (First) FunctionName

func (a First) FunctionName() string

func (*First) IsNullable

func (a *First) IsNullable() bool

func (*First) NewBuffer

func (a *First) NewBuffer() (sql.AggregationBuffer, error)

func (*First) NewWindowFunction

func (a *First) NewWindowFunction() (sql.WindowFunction, error)

func (*First) Resolved

func (a *First) Resolved() bool

func (*First) String

func (a *First) String() string

func (*First) Type

func (a *First) Type() sql.Type

func (*First) Window

func (a *First) Window() *sql.WindowDefinition

func (*First) WithChildren

func (a *First) WithChildren(children ...sql.Expression) (sql.Expression, error)

func (*First) WithWindow

func (a *First) WithWindow(window *sql.WindowDefinition) (sql.Aggregation, error)

type FirstAgg

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

func NewFirstAgg

func NewFirstAgg(e sql.Expression) *FirstAgg

func (*FirstAgg) Compute

func (a *FirstAgg) Compute(ctx *sql.Context, interval sql.WindowInterval, buffer sql.WindowBuffer) interface{}

func (*FirstAgg) DefaultFramer

func (a *FirstAgg) DefaultFramer() sql.WindowFramer

DefaultFramer returns a NewUnboundedPrecedingToCurrentRowFramer

func (*FirstAgg) Dispose

func (a *FirstAgg) Dispose()

func (*FirstAgg) NewSlidingFrameInterval

func (a *FirstAgg) NewSlidingFrameInterval(added, dropped sql.WindowInterval)

func (*FirstAgg) StartPartition

func (a *FirstAgg) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buffer sql.WindowBuffer) error

func (*FirstAgg) WithWindow

func (a *FirstAgg) WithWindow(w *sql.WindowDefinition) (sql.WindowFunction, error)

type GroupByFramer

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

func NewGroupByFramer

func NewGroupByFramer() *GroupByFramer

func (*GroupByFramer) FirstIdx

func (f *GroupByFramer) FirstIdx() int

func (*GroupByFramer) Interval

func (f *GroupByFramer) Interval() (sql.WindowInterval, error)

func (*GroupByFramer) LastIdx

func (f *GroupByFramer) LastIdx() int

func (*GroupByFramer) NewFramer

func (f *GroupByFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*GroupByFramer) Next

func (f *GroupByFramer) Next(ctx *sql.Context, buffer sql.WindowBuffer) (sql.WindowInterval, error)

func (*GroupByFramer) SlidingInterval

type GroupConcat

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

func NewGroupConcat

func NewGroupConcat(distinct string, orderBy sql.SortFields, separator string, selectExprs []sql.Expression, maxLen int) (*GroupConcat, error)

func (*GroupConcat) Children

func (g *GroupConcat) Children() []sql.Expression

Children implements the Expression interface.

func (*GroupConcat) Description

func (g *GroupConcat) Description() string

Description implements sql.FunctionExpression

func (*GroupConcat) Eval

func (g *GroupConcat) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*GroupConcat) FunctionName

func (g *GroupConcat) FunctionName() string

FunctionName implements sql.FunctionExpression

func (*GroupConcat) IsNullable

func (g *GroupConcat) IsNullable() bool

IsNullable implements the Expression interface.

func (*GroupConcat) NewBuffer

func (g *GroupConcat) NewBuffer() (sql.AggregationBuffer, error)

NewBuffer creates a new buffer for the aggregation.

func (*GroupConcat) NewWindowFunction

func (g *GroupConcat) NewWindowFunction() (sql.WindowFunction, error)

NewWindowFunctionAggregation implements sql.WindowAdaptableExpression

func (*GroupConcat) Resolved

func (g *GroupConcat) Resolved() bool

Resolved implements the Expression interface.

func (*GroupConcat) String

func (g *GroupConcat) String() string

func (*GroupConcat) Type

func (g *GroupConcat) Type() sql.Type

Type implements the Expression interface. cc: https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_group-concat for explanations on return type.

func (*GroupConcat) Window

func (g *GroupConcat) Window() *sql.WindowDefinition

Window implements sql.Aggregation

func (*GroupConcat) WithChildren

func (g *GroupConcat) WithChildren(children ...sql.Expression) (sql.Expression, error)

WithChildren implements the Expression interface.

func (*GroupConcat) WithWindow

func (g *GroupConcat) WithWindow(window *sql.WindowDefinition) (sql.Aggregation, error)

WithWindow implements sql.Aggregation

type GroupConcatAgg

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

func NewGroupConcatAgg

func NewGroupConcatAgg(gc *GroupConcat) *GroupConcatAgg

func (*GroupConcatAgg) Compute

func (a *GroupConcatAgg) Compute(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) interface{}

func (*GroupConcatAgg) DefaultFramer

func (a *GroupConcatAgg) DefaultFramer() sql.WindowFramer

DefaultFramer returns a NewUnboundedPrecedingToCurrentRowFramer

func (*GroupConcatAgg) Dispose

func (a *GroupConcatAgg) Dispose()

func (*GroupConcatAgg) NewSlidingFrameInterval

func (a *GroupConcatAgg) NewSlidingFrameInterval(added, dropped sql.WindowInterval)

func (*GroupConcatAgg) StartPartition

func (a *GroupConcatAgg) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) error

func (*GroupConcatAgg) WithWindow

type JSONObjectAgg

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

JSON_OBJECTAGG(key, value) [over_clause]

JSONObjectAgg Takes two column names or expressions as arguments, the first of these being used as a key and the second as a value, and returns a JSON object containing key-value pairs. Returns NULL if the result contains no rows, or in the event of an error. An error occurs if any key name is NULL or the number of arguments is not equal to 2.

https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_json-objectagg

see also: https://dev.mysql.com/doc/refman/8.0/en/json.html#json-normalization

func (*JSONObjectAgg) Children

func (j *JSONObjectAgg) Children() []sql.Expression

Children implements the Expression interface.

func (*JSONObjectAgg) Description

func (j *JSONObjectAgg) Description() string

Description implements sql.FunctionExpression

func (*JSONObjectAgg) Eval

func (j *JSONObjectAgg) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*JSONObjectAgg) FunctionName

func (j *JSONObjectAgg) FunctionName() string

FunctionName implements sql.FunctionExpression

func (*JSONObjectAgg) IsNullable

func (j *JSONObjectAgg) IsNullable() bool

IsNullable implements the Expression interface.

func (*JSONObjectAgg) NewBuffer

func (j *JSONObjectAgg) NewBuffer() (sql.AggregationBuffer, error)

NewBuffer implements the Aggregation interface.

func (*JSONObjectAgg) NewWindowFunction

func (j *JSONObjectAgg) NewWindowFunction() (sql.WindowFunction, error)

NewWindowFunctionAggregation implements sql.WindowAdaptableExpression

func (*JSONObjectAgg) Resolved

func (j *JSONObjectAgg) Resolved() bool

Resolved implements the Expression interface.

func (*JSONObjectAgg) String

func (j *JSONObjectAgg) String() string

func (*JSONObjectAgg) Type

func (j *JSONObjectAgg) Type() sql.Type

Type implements the Expression interface.

func (*JSONObjectAgg) Window

func (j *JSONObjectAgg) Window() *sql.WindowDefinition

Window implements sql.Aggregation

func (*JSONObjectAgg) WithChildren

func (j *JSONObjectAgg) WithChildren(children ...sql.Expression) (sql.Expression, error)

WithChildren implements the Expression interface.

func (*JSONObjectAgg) WithWindow

func (j *JSONObjectAgg) WithWindow(window *sql.WindowDefinition) (sql.Aggregation, error)

WithWindow implements sql.Aggregation

type JsonArray

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

func NewJsonArray

func NewJsonArray(e sql.Expression) *JsonArray

func (*JsonArray) Children

func (a *JsonArray) Children() []sql.Expression

func (JsonArray) Description

func (a JsonArray) Description() string

func (*JsonArray) Eval

func (a *JsonArray) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

func (JsonArray) FunctionName

func (a JsonArray) FunctionName() string

func (*JsonArray) IsNullable

func (a *JsonArray) IsNullable() bool

func (*JsonArray) NewBuffer

func (a *JsonArray) NewBuffer() (sql.AggregationBuffer, error)

func (*JsonArray) NewWindowFunction

func (a *JsonArray) NewWindowFunction() (sql.WindowFunction, error)

func (*JsonArray) Resolved

func (a *JsonArray) Resolved() bool

func (*JsonArray) String

func (a *JsonArray) String() string

func (*JsonArray) Type

func (a *JsonArray) Type() sql.Type

func (*JsonArray) Window

func (a *JsonArray) Window() *sql.WindowDefinition

func (*JsonArray) WithChildren

func (a *JsonArray) WithChildren(children ...sql.Expression) (sql.Expression, error)

func (*JsonArray) WithWindow

func (a *JsonArray) WithWindow(window *sql.WindowDefinition) (sql.Aggregation, error)

type Lag

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

func NewLag

func NewLag(expr, def sql.Expression, offset int) *Lag

func (*Lag) Compute

func (a *Lag) Compute(ctx *sql.Context, interval sql.WindowInterval, buffer sql.WindowBuffer) interface{}

func (*Lag) DefaultFramer

func (a *Lag) DefaultFramer() sql.WindowFramer

DefaultFramer returns a NewPartitionFramer

func (*Lag) Dispose

func (a *Lag) Dispose()

func (*Lag) NewSlidingFrameInterval

func (a *Lag) NewSlidingFrameInterval(added, dropped sql.WindowInterval)

func (*Lag) StartPartition

func (a *Lag) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buffer sql.WindowBuffer) error

func (*Lag) WithWindow

func (a *Lag) WithWindow(w *sql.WindowDefinition) (sql.WindowFunction, error)

type Last

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

func NewLast

func NewLast(e sql.Expression) *Last

func (*Last) Children

func (a *Last) Children() []sql.Expression

func (Last) Description

func (a Last) Description() string

func (*Last) Eval

func (a *Last) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

func (Last) FunctionName

func (a Last) FunctionName() string

func (*Last) IsNullable

func (a *Last) IsNullable() bool

func (*Last) NewBuffer

func (a *Last) NewBuffer() (sql.AggregationBuffer, error)

func (*Last) NewWindowFunction

func (a *Last) NewWindowFunction() (sql.WindowFunction, error)

func (*Last) Resolved

func (a *Last) Resolved() bool

func (*Last) String

func (a *Last) String() string

func (*Last) Type

func (a *Last) Type() sql.Type

func (*Last) Window

func (a *Last) Window() *sql.WindowDefinition

func (*Last) WithChildren

func (a *Last) WithChildren(children ...sql.Expression) (sql.Expression, error)

func (*Last) WithWindow

func (a *Last) WithWindow(window *sql.WindowDefinition) (sql.Aggregation, error)

type LastAgg

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

func NewLastAgg

func NewLastAgg(e sql.Expression) *LastAgg

func (*LastAgg) Compute

func (a *LastAgg) Compute(ctx *sql.Context, interval sql.WindowInterval, buffer sql.WindowBuffer) interface{}

func (*LastAgg) DefaultFramer

func (a *LastAgg) DefaultFramer() sql.WindowFramer

DefaultFramer returns a NewUnboundedPrecedingToCurrentRowFramer

func (*LastAgg) Dispose

func (a *LastAgg) Dispose()

func (*LastAgg) NewSlidingFrameInterval

func (a *LastAgg) NewSlidingFrameInterval(added, dropped sql.WindowInterval)

func (*LastAgg) StartPartition

func (a *LastAgg) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buffer sql.WindowBuffer) error

func (*LastAgg) WithWindow

func (a *LastAgg) WithWindow(w *sql.WindowDefinition) (sql.WindowFunction, error)

type Lead

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

func NewLead

func NewLead(expr, def sql.Expression, offset int) *Lead

func (*Lead) Compute

func (a *Lead) Compute(ctx *sql.Context, interval sql.WindowInterval, buffer sql.WindowBuffer) interface{}

func (*Lead) DefaultFramer

func (a *Lead) DefaultFramer() sql.WindowFramer

DefaultFramer returns a NewPartitionFramer

func (*Lead) Dispose

func (a *Lead) Dispose()

func (*Lead) NewSlidingFrameInterval

func (a *Lead) NewSlidingFrameInterval(added, dropped sql.WindowInterval)

func (*Lead) StartPartition

func (a *Lead) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buffer sql.WindowBuffer) error

func (*Lead) WithWindow

func (a *Lead) WithWindow(w *sql.WindowDefinition) (sql.WindowFunction, error)

type Max

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

func NewMax

func NewMax(e sql.Expression) *Max

func (*Max) Children

func (a *Max) Children() []sql.Expression

func (Max) Description

func (a Max) Description() string

func (*Max) Eval

func (a *Max) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

func (Max) FunctionName

func (a Max) FunctionName() string

func (*Max) IsNullable

func (a *Max) IsNullable() bool

func (*Max) NewBuffer

func (a *Max) NewBuffer() (sql.AggregationBuffer, error)

func (*Max) NewWindowFunction

func (a *Max) NewWindowFunction() (sql.WindowFunction, error)

func (*Max) Resolved

func (a *Max) Resolved() bool

func (*Max) String

func (a *Max) String() string

func (*Max) Type

func (a *Max) Type() sql.Type

func (*Max) Window

func (a *Max) Window() *sql.WindowDefinition

func (*Max) WithChildren

func (a *Max) WithChildren(children ...sql.Expression) (sql.Expression, error)

func (*Max) WithWindow

func (a *Max) WithWindow(window *sql.WindowDefinition) (sql.Aggregation, error)

type MaxAgg

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

func NewMaxAgg

func NewMaxAgg(e sql.Expression) *MaxAgg

func (*MaxAgg) Compute

func (a *MaxAgg) Compute(ctx *sql.Context, interval sql.WindowInterval, buffer sql.WindowBuffer) interface{}

func (*MaxAgg) DefaultFramer

func (a *MaxAgg) DefaultFramer() sql.WindowFramer

DefaultFramer returns a NewPartitionFramer

func (*MaxAgg) Dispose

func (a *MaxAgg) Dispose()

func (*MaxAgg) NewSlidingFrameInterval

func (a *MaxAgg) NewSlidingFrameInterval(added, dropped sql.WindowInterval)

func (*MaxAgg) StartPartition

func (a *MaxAgg) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buffer sql.WindowBuffer) error

func (*MaxAgg) WithWindow

func (a *MaxAgg) WithWindow(w *sql.WindowDefinition) (sql.WindowFunction, error)

type Min

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

func NewMin

func NewMin(e sql.Expression) *Min

func (*Min) Children

func (a *Min) Children() []sql.Expression

func (Min) Description

func (a Min) Description() string

func (*Min) Eval

func (a *Min) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

func (Min) FunctionName

func (a Min) FunctionName() string

func (*Min) IsNullable

func (a *Min) IsNullable() bool

func (*Min) NewBuffer

func (a *Min) NewBuffer() (sql.AggregationBuffer, error)

func (*Min) NewWindowFunction

func (a *Min) NewWindowFunction() (sql.WindowFunction, error)

func (*Min) Resolved

func (a *Min) Resolved() bool

func (*Min) String

func (a *Min) String() string

func (*Min) Type

func (a *Min) Type() sql.Type

func (*Min) Window

func (a *Min) Window() *sql.WindowDefinition

func (*Min) WithChildren

func (a *Min) WithChildren(children ...sql.Expression) (sql.Expression, error)

func (*Min) WithWindow

func (a *Min) WithWindow(window *sql.WindowDefinition) (sql.Aggregation, error)

type MinAgg

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

func NewMinAgg

func NewMinAgg(e sql.Expression) *MinAgg

func (*MinAgg) Compute

func (a *MinAgg) Compute(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) interface{}

func (*MinAgg) DefaultFramer

func (a *MinAgg) DefaultFramer() sql.WindowFramer

DefaultFramer returns a NewUnboundedPrecedingToCurrentRowFramer

func (*MinAgg) Dispose

func (a *MinAgg) Dispose()

func (*MinAgg) NewSlidingFrameInterval

func (a *MinAgg) NewSlidingFrameInterval(added, dropped sql.WindowInterval)

func (*MinAgg) StartPartition

func (a *MinAgg) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buffer sql.WindowBuffer) error

func (*MinAgg) WithWindow

func (a *MinAgg) WithWindow(w *sql.WindowDefinition) (sql.WindowFunction, error)

type PartitionFramer

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

func NewPartitionFramer

func NewPartitionFramer() *PartitionFramer

func (*PartitionFramer) Close

func (f *PartitionFramer) Close()

func (*PartitionFramer) FirstIdx

func (f *PartitionFramer) FirstIdx() int

func (*PartitionFramer) Interval

func (f *PartitionFramer) Interval() (sql.WindowInterval, error)

func (*PartitionFramer) LastIdx

func (f *PartitionFramer) LastIdx() int

func (*PartitionFramer) NewFramer

func (f *PartitionFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*PartitionFramer) Next

func (*PartitionFramer) SlidingInterval

type PeerGroupFramer

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

func NewPeerGroupFramer

func NewPeerGroupFramer(orderBy []sql.Expression) *PeerGroupFramer

func (*PeerGroupFramer) FirstIdx

func (f *PeerGroupFramer) FirstIdx() int

func (*PeerGroupFramer) Interval

func (f *PeerGroupFramer) Interval() (sql.WindowInterval, error)

func (*PeerGroupFramer) LastIdx

func (f *PeerGroupFramer) LastIdx() int

func (*PeerGroupFramer) NewFramer

func (f *PeerGroupFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*PeerGroupFramer) Next

type PercentRank

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

func NewPercentRank

func NewPercentRank(orderBy []sql.Expression) *PercentRank

func (*PercentRank) Compute

func (a *PercentRank) Compute(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) interface{}

Compute returns the number of elements before the current peer group (rank), and returns (rank - 1)/(rows - 1). ex: [1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6] => every 3 returns float64(4) / float64(9), because there are 4 values less than 3, and there are (10 - 1) total rows in the list.

func (PercentRank) DefaultFramer

func (a PercentRank) DefaultFramer() sql.WindowFramer

func (PercentRank) Dispose

func (a PercentRank) Dispose()

func (PercentRank) NewSlidingFrameInterval

func (a PercentRank) NewSlidingFrameInterval(added, dropped sql.WindowInterval)

func (PercentRank) StartPartition

func (a PercentRank) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buffer sql.WindowBuffer) error

func (PercentRank) WithWindow

func (a PercentRank) WithWindow(w *sql.WindowDefinition) (sql.WindowFunction, error)

type RangeCurrentRowToCurrentRowFramer

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

func (*RangeCurrentRowToCurrentRowFramer) FirstIdx

func (f *RangeCurrentRowToCurrentRowFramer) FirstIdx() int

func (*RangeCurrentRowToCurrentRowFramer) Interval

func (f *RangeCurrentRowToCurrentRowFramer) Interval() (sql.WindowInterval, error)

func (*RangeCurrentRowToCurrentRowFramer) LastIdx

func (f *RangeCurrentRowToCurrentRowFramer) LastIdx() int

func (*RangeCurrentRowToCurrentRowFramer) NewFramer

func (f *RangeCurrentRowToCurrentRowFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RangeCurrentRowToCurrentRowFramer) Next

func (f *RangeCurrentRowToCurrentRowFramer) Next(ctx *sql.Context, buf sql.WindowBuffer) (sql.WindowInterval, error)

type RangeCurrentRowToNFollowingFramer

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

func (*RangeCurrentRowToNFollowingFramer) FirstIdx

func (f *RangeCurrentRowToNFollowingFramer) FirstIdx() int

func (*RangeCurrentRowToNFollowingFramer) Interval

func (f *RangeCurrentRowToNFollowingFramer) Interval() (sql.WindowInterval, error)

func (*RangeCurrentRowToNFollowingFramer) LastIdx

func (f *RangeCurrentRowToNFollowingFramer) LastIdx() int

func (*RangeCurrentRowToNFollowingFramer) NewFramer

func (f *RangeCurrentRowToNFollowingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RangeCurrentRowToNFollowingFramer) Next

func (f *RangeCurrentRowToNFollowingFramer) Next(ctx *sql.Context, buf sql.WindowBuffer) (sql.WindowInterval, error)

type RangeCurrentRowToNPrecedingFramer

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

func (*RangeCurrentRowToNPrecedingFramer) FirstIdx

func (f *RangeCurrentRowToNPrecedingFramer) FirstIdx() int

func (*RangeCurrentRowToNPrecedingFramer) Interval

func (f *RangeCurrentRowToNPrecedingFramer) Interval() (sql.WindowInterval, error)

func (*RangeCurrentRowToNPrecedingFramer) LastIdx

func (f *RangeCurrentRowToNPrecedingFramer) LastIdx() int

func (*RangeCurrentRowToNPrecedingFramer) NewFramer

func (f *RangeCurrentRowToNPrecedingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RangeCurrentRowToNPrecedingFramer) Next

func (f *RangeCurrentRowToNPrecedingFramer) Next(ctx *sql.Context, buf sql.WindowBuffer) (sql.WindowInterval, error)

type RangeCurrentRowToUnboundedFollowingFramer

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

func (*RangeCurrentRowToUnboundedFollowingFramer) FirstIdx

func (f *RangeCurrentRowToUnboundedFollowingFramer) FirstIdx() int

func (*RangeCurrentRowToUnboundedFollowingFramer) Interval

func (f *RangeCurrentRowToUnboundedFollowingFramer) Interval() (sql.WindowInterval, error)

func (*RangeCurrentRowToUnboundedFollowingFramer) LastIdx

func (f *RangeCurrentRowToUnboundedFollowingFramer) LastIdx() int

func (*RangeCurrentRowToUnboundedFollowingFramer) NewFramer

func (f *RangeCurrentRowToUnboundedFollowingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RangeCurrentRowToUnboundedFollowingFramer) Next

func (f *RangeCurrentRowToUnboundedFollowingFramer) Next(ctx *sql.Context, buf sql.WindowBuffer) (sql.WindowInterval, error)

type RangeNFollowingToCurrentRowFramer

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

func (*RangeNFollowingToCurrentRowFramer) FirstIdx

func (f *RangeNFollowingToCurrentRowFramer) FirstIdx() int

func (*RangeNFollowingToCurrentRowFramer) Interval

func (f *RangeNFollowingToCurrentRowFramer) Interval() (sql.WindowInterval, error)

func (*RangeNFollowingToCurrentRowFramer) LastIdx

func (f *RangeNFollowingToCurrentRowFramer) LastIdx() int

func (*RangeNFollowingToCurrentRowFramer) NewFramer

func (f *RangeNFollowingToCurrentRowFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RangeNFollowingToCurrentRowFramer) Next

func (f *RangeNFollowingToCurrentRowFramer) Next(ctx *sql.Context, buf sql.WindowBuffer) (sql.WindowInterval, error)

type RangeNFollowingToNFollowingFramer

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

func (*RangeNFollowingToNFollowingFramer) FirstIdx

func (f *RangeNFollowingToNFollowingFramer) FirstIdx() int

func (*RangeNFollowingToNFollowingFramer) Interval

func (f *RangeNFollowingToNFollowingFramer) Interval() (sql.WindowInterval, error)

func (*RangeNFollowingToNFollowingFramer) LastIdx

func (f *RangeNFollowingToNFollowingFramer) LastIdx() int

func (*RangeNFollowingToNFollowingFramer) NewFramer

func (f *RangeNFollowingToNFollowingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RangeNFollowingToNFollowingFramer) Next

func (f *RangeNFollowingToNFollowingFramer) Next(ctx *sql.Context, buf sql.WindowBuffer) (sql.WindowInterval, error)

type RangeNFollowingToNPrecedingFramer

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

func (*RangeNFollowingToNPrecedingFramer) FirstIdx

func (f *RangeNFollowingToNPrecedingFramer) FirstIdx() int

func (*RangeNFollowingToNPrecedingFramer) Interval

func (f *RangeNFollowingToNPrecedingFramer) Interval() (sql.WindowInterval, error)

func (*RangeNFollowingToNPrecedingFramer) LastIdx

func (f *RangeNFollowingToNPrecedingFramer) LastIdx() int

func (*RangeNFollowingToNPrecedingFramer) NewFramer

func (f *RangeNFollowingToNPrecedingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RangeNFollowingToNPrecedingFramer) Next

func (f *RangeNFollowingToNPrecedingFramer) Next(ctx *sql.Context, buf sql.WindowBuffer) (sql.WindowInterval, error)

type RangeNFollowingToUnboundedFollowingFramer

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

func (*RangeNFollowingToUnboundedFollowingFramer) FirstIdx

func (f *RangeNFollowingToUnboundedFollowingFramer) FirstIdx() int

func (*RangeNFollowingToUnboundedFollowingFramer) Interval

func (f *RangeNFollowingToUnboundedFollowingFramer) Interval() (sql.WindowInterval, error)

func (*RangeNFollowingToUnboundedFollowingFramer) LastIdx

func (f *RangeNFollowingToUnboundedFollowingFramer) LastIdx() int

func (*RangeNFollowingToUnboundedFollowingFramer) NewFramer

func (f *RangeNFollowingToUnboundedFollowingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RangeNFollowingToUnboundedFollowingFramer) Next

func (f *RangeNFollowingToUnboundedFollowingFramer) Next(ctx *sql.Context, buf sql.WindowBuffer) (sql.WindowInterval, error)

type RangeNPrecedingToCurrentRowFramer

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

func (*RangeNPrecedingToCurrentRowFramer) FirstIdx

func (f *RangeNPrecedingToCurrentRowFramer) FirstIdx() int

func (*RangeNPrecedingToCurrentRowFramer) Interval

func (f *RangeNPrecedingToCurrentRowFramer) Interval() (sql.WindowInterval, error)

func (*RangeNPrecedingToCurrentRowFramer) LastIdx

func (f *RangeNPrecedingToCurrentRowFramer) LastIdx() int

func (*RangeNPrecedingToCurrentRowFramer) NewFramer

func (f *RangeNPrecedingToCurrentRowFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RangeNPrecedingToCurrentRowFramer) Next

func (f *RangeNPrecedingToCurrentRowFramer) Next(ctx *sql.Context, buf sql.WindowBuffer) (sql.WindowInterval, error)

type RangeNPrecedingToNFollowingFramer

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

func (*RangeNPrecedingToNFollowingFramer) FirstIdx

func (f *RangeNPrecedingToNFollowingFramer) FirstIdx() int

func (*RangeNPrecedingToNFollowingFramer) Interval

func (f *RangeNPrecedingToNFollowingFramer) Interval() (sql.WindowInterval, error)

func (*RangeNPrecedingToNFollowingFramer) LastIdx

func (f *RangeNPrecedingToNFollowingFramer) LastIdx() int

func (*RangeNPrecedingToNFollowingFramer) NewFramer

func (f *RangeNPrecedingToNFollowingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RangeNPrecedingToNFollowingFramer) Next

func (f *RangeNPrecedingToNFollowingFramer) Next(ctx *sql.Context, buf sql.WindowBuffer) (sql.WindowInterval, error)

type RangeNPrecedingToNPrecedingFramer

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

func (*RangeNPrecedingToNPrecedingFramer) FirstIdx

func (f *RangeNPrecedingToNPrecedingFramer) FirstIdx() int

func (*RangeNPrecedingToNPrecedingFramer) Interval

func (f *RangeNPrecedingToNPrecedingFramer) Interval() (sql.WindowInterval, error)

func (*RangeNPrecedingToNPrecedingFramer) LastIdx

func (f *RangeNPrecedingToNPrecedingFramer) LastIdx() int

func (*RangeNPrecedingToNPrecedingFramer) NewFramer

func (f *RangeNPrecedingToNPrecedingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RangeNPrecedingToNPrecedingFramer) Next

func (f *RangeNPrecedingToNPrecedingFramer) Next(ctx *sql.Context, buf sql.WindowBuffer) (sql.WindowInterval, error)

type RangeNPrecedingToUnboundedFollowingFramer

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

func (*RangeNPrecedingToUnboundedFollowingFramer) FirstIdx

func (f *RangeNPrecedingToUnboundedFollowingFramer) FirstIdx() int

func (*RangeNPrecedingToUnboundedFollowingFramer) Interval

func (f *RangeNPrecedingToUnboundedFollowingFramer) Interval() (sql.WindowInterval, error)

func (*RangeNPrecedingToUnboundedFollowingFramer) LastIdx

func (f *RangeNPrecedingToUnboundedFollowingFramer) LastIdx() int

func (*RangeNPrecedingToUnboundedFollowingFramer) NewFramer

func (f *RangeNPrecedingToUnboundedFollowingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RangeNPrecedingToUnboundedFollowingFramer) Next

func (f *RangeNPrecedingToUnboundedFollowingFramer) Next(ctx *sql.Context, buf sql.WindowBuffer) (sql.WindowInterval, error)

type RangeUnboundedPrecedingToCurrentRowFramer

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

func (*RangeUnboundedPrecedingToCurrentRowFramer) FirstIdx

func (f *RangeUnboundedPrecedingToCurrentRowFramer) FirstIdx() int

func (*RangeUnboundedPrecedingToCurrentRowFramer) Interval

func (f *RangeUnboundedPrecedingToCurrentRowFramer) Interval() (sql.WindowInterval, error)

func (*RangeUnboundedPrecedingToCurrentRowFramer) LastIdx

func (f *RangeUnboundedPrecedingToCurrentRowFramer) LastIdx() int

func (*RangeUnboundedPrecedingToCurrentRowFramer) NewFramer

func (f *RangeUnboundedPrecedingToCurrentRowFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RangeUnboundedPrecedingToCurrentRowFramer) Next

func (f *RangeUnboundedPrecedingToCurrentRowFramer) Next(ctx *sql.Context, buf sql.WindowBuffer) (sql.WindowInterval, error)

type RangeUnboundedPrecedingToNFollowingFramer

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

func (*RangeUnboundedPrecedingToNFollowingFramer) FirstIdx

func (f *RangeUnboundedPrecedingToNFollowingFramer) FirstIdx() int

func (*RangeUnboundedPrecedingToNFollowingFramer) Interval

func (f *RangeUnboundedPrecedingToNFollowingFramer) Interval() (sql.WindowInterval, error)

func (*RangeUnboundedPrecedingToNFollowingFramer) LastIdx

func (f *RangeUnboundedPrecedingToNFollowingFramer) LastIdx() int

func (*RangeUnboundedPrecedingToNFollowingFramer) NewFramer

func (f *RangeUnboundedPrecedingToNFollowingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RangeUnboundedPrecedingToNFollowingFramer) Next

func (f *RangeUnboundedPrecedingToNFollowingFramer) Next(ctx *sql.Context, buf sql.WindowBuffer) (sql.WindowInterval, error)

type RangeUnboundedPrecedingToNPrecedingFramer

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

func (*RangeUnboundedPrecedingToNPrecedingFramer) FirstIdx

func (f *RangeUnboundedPrecedingToNPrecedingFramer) FirstIdx() int

func (*RangeUnboundedPrecedingToNPrecedingFramer) Interval

func (f *RangeUnboundedPrecedingToNPrecedingFramer) Interval() (sql.WindowInterval, error)

func (*RangeUnboundedPrecedingToNPrecedingFramer) LastIdx

func (f *RangeUnboundedPrecedingToNPrecedingFramer) LastIdx() int

func (*RangeUnboundedPrecedingToNPrecedingFramer) NewFramer

func (f *RangeUnboundedPrecedingToNPrecedingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RangeUnboundedPrecedingToNPrecedingFramer) Next

func (f *RangeUnboundedPrecedingToNPrecedingFramer) Next(ctx *sql.Context, buf sql.WindowBuffer) (sql.WindowInterval, error)

type RangeUnboundedPrecedingToUnboundedFollowingFramer

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

func (*RangeUnboundedPrecedingToUnboundedFollowingFramer) FirstIdx

func (f *RangeUnboundedPrecedingToUnboundedFollowingFramer) FirstIdx() int

func (*RangeUnboundedPrecedingToUnboundedFollowingFramer) Interval

func (f *RangeUnboundedPrecedingToUnboundedFollowingFramer) Interval() (sql.WindowInterval, error)

func (*RangeUnboundedPrecedingToUnboundedFollowingFramer) LastIdx

func (f *RangeUnboundedPrecedingToUnboundedFollowingFramer) LastIdx() int

func (*RangeUnboundedPrecedingToUnboundedFollowingFramer) NewFramer

func (f *RangeUnboundedPrecedingToUnboundedFollowingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RangeUnboundedPrecedingToUnboundedFollowingFramer) Next

func (f *RangeUnboundedPrecedingToUnboundedFollowingFramer) Next(ctx *sql.Context, buf sql.WindowBuffer) (sql.WindowInterval, error)

type Rank

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

func NewRank

func NewRank(orderBy []sql.Expression) *Rank

func (Rank) Compute

func (a Rank) Compute(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) interface{}

Compute returns the number of elements before the current peer group (rank) + 1. ex: [1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6] => every 3 returns uint64(5) because there are 4 values less than 3

func (Rank) DefaultFramer

func (a Rank) DefaultFramer() sql.WindowFramer

func (Rank) Dispose

func (a Rank) Dispose()

func (Rank) NewSlidingFrameInterval

func (a Rank) NewSlidingFrameInterval(added, dropped sql.WindowInterval)

func (Rank) StartPartition

func (a Rank) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buffer sql.WindowBuffer) error

func (Rank) WithWindow

func (a Rank) WithWindow(w *sql.WindowDefinition) (sql.WindowFunction, error)

type RowNumber

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

func NewRowNumber

func NewRowNumber() *RowNumber

func (*RowNumber) Compute

func (a *RowNumber) Compute(ctx *sql.Context, interval sql.WindowInterval, buffer sql.WindowBuffer) interface{}

func (*RowNumber) DefaultFramer

func (a *RowNumber) DefaultFramer() sql.WindowFramer

DefaultFramer returns a NewPartitionFramer

func (*RowNumber) Dispose

func (a *RowNumber) Dispose()

func (*RowNumber) NewSlidingFrameInterval

func (a *RowNumber) NewSlidingFrameInterval(added, dropped sql.WindowInterval)

func (*RowNumber) StartPartition

func (a *RowNumber) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buffer sql.WindowBuffer) error

func (*RowNumber) WithWindow

func (a *RowNumber) WithWindow(w *sql.WindowDefinition) (sql.WindowFunction, error)

type RowsCurrentRowToCurrentRowFramer

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

func (*RowsCurrentRowToCurrentRowFramer) FirstIdx

func (f *RowsCurrentRowToCurrentRowFramer) FirstIdx() int

func (*RowsCurrentRowToCurrentRowFramer) Interval

func (f *RowsCurrentRowToCurrentRowFramer) Interval() (sql.WindowInterval, error)

func (*RowsCurrentRowToCurrentRowFramer) LastIdx

func (f *RowsCurrentRowToCurrentRowFramer) LastIdx() int

func (*RowsCurrentRowToCurrentRowFramer) NewFramer

func (f *RowsCurrentRowToCurrentRowFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RowsCurrentRowToCurrentRowFramer) Next

func (f *RowsCurrentRowToCurrentRowFramer) Next(ctx *sql.Context, buffer sql.WindowBuffer) (sql.WindowInterval, error)

type RowsCurrentRowToNFollowingFramer

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

func (*RowsCurrentRowToNFollowingFramer) FirstIdx

func (f *RowsCurrentRowToNFollowingFramer) FirstIdx() int

func (*RowsCurrentRowToNFollowingFramer) Interval

func (f *RowsCurrentRowToNFollowingFramer) Interval() (sql.WindowInterval, error)

func (*RowsCurrentRowToNFollowingFramer) LastIdx

func (f *RowsCurrentRowToNFollowingFramer) LastIdx() int

func (*RowsCurrentRowToNFollowingFramer) NewFramer

func (f *RowsCurrentRowToNFollowingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RowsCurrentRowToNFollowingFramer) Next

func (f *RowsCurrentRowToNFollowingFramer) Next(ctx *sql.Context, buffer sql.WindowBuffer) (sql.WindowInterval, error)

type RowsCurrentRowToNPrecedingFramer

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

func (*RowsCurrentRowToNPrecedingFramer) FirstIdx

func (f *RowsCurrentRowToNPrecedingFramer) FirstIdx() int

func (*RowsCurrentRowToNPrecedingFramer) Interval

func (f *RowsCurrentRowToNPrecedingFramer) Interval() (sql.WindowInterval, error)

func (*RowsCurrentRowToNPrecedingFramer) LastIdx

func (f *RowsCurrentRowToNPrecedingFramer) LastIdx() int

func (*RowsCurrentRowToNPrecedingFramer) NewFramer

func (f *RowsCurrentRowToNPrecedingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RowsCurrentRowToNPrecedingFramer) Next

func (f *RowsCurrentRowToNPrecedingFramer) Next(ctx *sql.Context, buffer sql.WindowBuffer) (sql.WindowInterval, error)

type RowsCurrentRowToUnboundedFollowingFramer

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

func (*RowsCurrentRowToUnboundedFollowingFramer) FirstIdx

func (f *RowsCurrentRowToUnboundedFollowingFramer) FirstIdx() int

func (*RowsCurrentRowToUnboundedFollowingFramer) Interval

func (f *RowsCurrentRowToUnboundedFollowingFramer) Interval() (sql.WindowInterval, error)

func (*RowsCurrentRowToUnboundedFollowingFramer) LastIdx

func (f *RowsCurrentRowToUnboundedFollowingFramer) LastIdx() int

func (*RowsCurrentRowToUnboundedFollowingFramer) NewFramer

func (f *RowsCurrentRowToUnboundedFollowingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RowsCurrentRowToUnboundedFollowingFramer) Next

func (f *RowsCurrentRowToUnboundedFollowingFramer) Next(ctx *sql.Context, buffer sql.WindowBuffer) (sql.WindowInterval, error)

type RowsNFollowingToCurrentRowFramer

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

func (*RowsNFollowingToCurrentRowFramer) FirstIdx

func (f *RowsNFollowingToCurrentRowFramer) FirstIdx() int

func (*RowsNFollowingToCurrentRowFramer) Interval

func (f *RowsNFollowingToCurrentRowFramer) Interval() (sql.WindowInterval, error)

func (*RowsNFollowingToCurrentRowFramer) LastIdx

func (f *RowsNFollowingToCurrentRowFramer) LastIdx() int

func (*RowsNFollowingToCurrentRowFramer) NewFramer

func (f *RowsNFollowingToCurrentRowFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RowsNFollowingToCurrentRowFramer) Next

func (f *RowsNFollowingToCurrentRowFramer) Next(ctx *sql.Context, buffer sql.WindowBuffer) (sql.WindowInterval, error)

type RowsNFollowingToNFollowingFramer

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

func (*RowsNFollowingToNFollowingFramer) FirstIdx

func (f *RowsNFollowingToNFollowingFramer) FirstIdx() int

func (*RowsNFollowingToNFollowingFramer) Interval

func (f *RowsNFollowingToNFollowingFramer) Interval() (sql.WindowInterval, error)

func (*RowsNFollowingToNFollowingFramer) LastIdx

func (f *RowsNFollowingToNFollowingFramer) LastIdx() int

func (*RowsNFollowingToNFollowingFramer) NewFramer

func (f *RowsNFollowingToNFollowingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RowsNFollowingToNFollowingFramer) Next

func (f *RowsNFollowingToNFollowingFramer) Next(ctx *sql.Context, buffer sql.WindowBuffer) (sql.WindowInterval, error)

type RowsNFollowingToNPrecedingFramer

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

func (*RowsNFollowingToNPrecedingFramer) FirstIdx

func (f *RowsNFollowingToNPrecedingFramer) FirstIdx() int

func (*RowsNFollowingToNPrecedingFramer) Interval

func (f *RowsNFollowingToNPrecedingFramer) Interval() (sql.WindowInterval, error)

func (*RowsNFollowingToNPrecedingFramer) LastIdx

func (f *RowsNFollowingToNPrecedingFramer) LastIdx() int

func (*RowsNFollowingToNPrecedingFramer) NewFramer

func (f *RowsNFollowingToNPrecedingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RowsNFollowingToNPrecedingFramer) Next

func (f *RowsNFollowingToNPrecedingFramer) Next(ctx *sql.Context, buffer sql.WindowBuffer) (sql.WindowInterval, error)

type RowsNFollowingToUnboundedFollowingFramer

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

func (*RowsNFollowingToUnboundedFollowingFramer) FirstIdx

func (f *RowsNFollowingToUnboundedFollowingFramer) FirstIdx() int

func (*RowsNFollowingToUnboundedFollowingFramer) Interval

func (f *RowsNFollowingToUnboundedFollowingFramer) Interval() (sql.WindowInterval, error)

func (*RowsNFollowingToUnboundedFollowingFramer) LastIdx

func (f *RowsNFollowingToUnboundedFollowingFramer) LastIdx() int

func (*RowsNFollowingToUnboundedFollowingFramer) NewFramer

func (f *RowsNFollowingToUnboundedFollowingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RowsNFollowingToUnboundedFollowingFramer) Next

func (f *RowsNFollowingToUnboundedFollowingFramer) Next(ctx *sql.Context, buffer sql.WindowBuffer) (sql.WindowInterval, error)

type RowsNPrecedingToCurrentRowFramer

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

func (*RowsNPrecedingToCurrentRowFramer) FirstIdx

func (f *RowsNPrecedingToCurrentRowFramer) FirstIdx() int

func (*RowsNPrecedingToCurrentRowFramer) Interval

func (f *RowsNPrecedingToCurrentRowFramer) Interval() (sql.WindowInterval, error)

func (*RowsNPrecedingToCurrentRowFramer) LastIdx

func (f *RowsNPrecedingToCurrentRowFramer) LastIdx() int

func (*RowsNPrecedingToCurrentRowFramer) NewFramer

func (f *RowsNPrecedingToCurrentRowFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RowsNPrecedingToCurrentRowFramer) Next

func (f *RowsNPrecedingToCurrentRowFramer) Next(ctx *sql.Context, buffer sql.WindowBuffer) (sql.WindowInterval, error)

type RowsNPrecedingToNFollowingFramer

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

func (*RowsNPrecedingToNFollowingFramer) FirstIdx

func (f *RowsNPrecedingToNFollowingFramer) FirstIdx() int

func (*RowsNPrecedingToNFollowingFramer) Interval

func (f *RowsNPrecedingToNFollowingFramer) Interval() (sql.WindowInterval, error)

func (*RowsNPrecedingToNFollowingFramer) LastIdx

func (f *RowsNPrecedingToNFollowingFramer) LastIdx() int

func (*RowsNPrecedingToNFollowingFramer) NewFramer

func (f *RowsNPrecedingToNFollowingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RowsNPrecedingToNFollowingFramer) Next

func (f *RowsNPrecedingToNFollowingFramer) Next(ctx *sql.Context, buffer sql.WindowBuffer) (sql.WindowInterval, error)

type RowsNPrecedingToNPrecedingFramer

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

func (*RowsNPrecedingToNPrecedingFramer) FirstIdx

func (f *RowsNPrecedingToNPrecedingFramer) FirstIdx() int

func (*RowsNPrecedingToNPrecedingFramer) Interval

func (f *RowsNPrecedingToNPrecedingFramer) Interval() (sql.WindowInterval, error)

func (*RowsNPrecedingToNPrecedingFramer) LastIdx

func (f *RowsNPrecedingToNPrecedingFramer) LastIdx() int

func (*RowsNPrecedingToNPrecedingFramer) NewFramer

func (f *RowsNPrecedingToNPrecedingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RowsNPrecedingToNPrecedingFramer) Next

func (f *RowsNPrecedingToNPrecedingFramer) Next(ctx *sql.Context, buffer sql.WindowBuffer) (sql.WindowInterval, error)

type RowsNPrecedingToUnboundedFollowingFramer

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

func (*RowsNPrecedingToUnboundedFollowingFramer) FirstIdx

func (f *RowsNPrecedingToUnboundedFollowingFramer) FirstIdx() int

func (*RowsNPrecedingToUnboundedFollowingFramer) Interval

func (f *RowsNPrecedingToUnboundedFollowingFramer) Interval() (sql.WindowInterval, error)

func (*RowsNPrecedingToUnboundedFollowingFramer) LastIdx

func (f *RowsNPrecedingToUnboundedFollowingFramer) LastIdx() int

func (*RowsNPrecedingToUnboundedFollowingFramer) NewFramer

func (f *RowsNPrecedingToUnboundedFollowingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RowsNPrecedingToUnboundedFollowingFramer) Next

func (f *RowsNPrecedingToUnboundedFollowingFramer) Next(ctx *sql.Context, buffer sql.WindowBuffer) (sql.WindowInterval, error)

type RowsUnboundedPrecedingToCurrentRowFramer

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

func NewUnboundedPrecedingToCurrentRowFramer

func NewUnboundedPrecedingToCurrentRowFramer() *RowsUnboundedPrecedingToCurrentRowFramer

NewUnboundedPrecedingToCurrentRowFramer generates sql.WindowInterval from the first row in a partition to the current row.

Ex: partition = [0, 1, 2, 3, 4, 5] => frames: {0,0}, {0,1}, {0,2}, {0,3}, {0,4}, {0,5} rows: [0], [0,1], [0,1,2], [1,2,3,4], [1,2,3,4], [1,2,3,4,5]

func (*RowsUnboundedPrecedingToCurrentRowFramer) FirstIdx

func (f *RowsUnboundedPrecedingToCurrentRowFramer) FirstIdx() int

func (*RowsUnboundedPrecedingToCurrentRowFramer) Interval

func (f *RowsUnboundedPrecedingToCurrentRowFramer) Interval() (sql.WindowInterval, error)

func (*RowsUnboundedPrecedingToCurrentRowFramer) LastIdx

func (f *RowsUnboundedPrecedingToCurrentRowFramer) LastIdx() int

func (*RowsUnboundedPrecedingToCurrentRowFramer) NewFramer

func (f *RowsUnboundedPrecedingToCurrentRowFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RowsUnboundedPrecedingToCurrentRowFramer) Next

func (f *RowsUnboundedPrecedingToCurrentRowFramer) Next(ctx *sql.Context, buffer sql.WindowBuffer) (sql.WindowInterval, error)

type RowsUnboundedPrecedingToNFollowingFramer

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

func (*RowsUnboundedPrecedingToNFollowingFramer) FirstIdx

func (f *RowsUnboundedPrecedingToNFollowingFramer) FirstIdx() int

func (*RowsUnboundedPrecedingToNFollowingFramer) Interval

func (f *RowsUnboundedPrecedingToNFollowingFramer) Interval() (sql.WindowInterval, error)

func (*RowsUnboundedPrecedingToNFollowingFramer) LastIdx

func (f *RowsUnboundedPrecedingToNFollowingFramer) LastIdx() int

func (*RowsUnboundedPrecedingToNFollowingFramer) NewFramer

func (f *RowsUnboundedPrecedingToNFollowingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RowsUnboundedPrecedingToNFollowingFramer) Next

func (f *RowsUnboundedPrecedingToNFollowingFramer) Next(ctx *sql.Context, buffer sql.WindowBuffer) (sql.WindowInterval, error)

type RowsUnboundedPrecedingToNPrecedingFramer

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

func (*RowsUnboundedPrecedingToNPrecedingFramer) FirstIdx

func (f *RowsUnboundedPrecedingToNPrecedingFramer) FirstIdx() int

func (*RowsUnboundedPrecedingToNPrecedingFramer) Interval

func (f *RowsUnboundedPrecedingToNPrecedingFramer) Interval() (sql.WindowInterval, error)

func (*RowsUnboundedPrecedingToNPrecedingFramer) LastIdx

func (f *RowsUnboundedPrecedingToNPrecedingFramer) LastIdx() int

func (*RowsUnboundedPrecedingToNPrecedingFramer) NewFramer

func (f *RowsUnboundedPrecedingToNPrecedingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RowsUnboundedPrecedingToNPrecedingFramer) Next

func (f *RowsUnboundedPrecedingToNPrecedingFramer) Next(ctx *sql.Context, buffer sql.WindowBuffer) (sql.WindowInterval, error)

type RowsUnboundedPrecedingToUnboundedFollowingFramer

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

func (*RowsUnboundedPrecedingToUnboundedFollowingFramer) FirstIdx

func (f *RowsUnboundedPrecedingToUnboundedFollowingFramer) FirstIdx() int

func (*RowsUnboundedPrecedingToUnboundedFollowingFramer) Interval

func (f *RowsUnboundedPrecedingToUnboundedFollowingFramer) Interval() (sql.WindowInterval, error)

func (*RowsUnboundedPrecedingToUnboundedFollowingFramer) LastIdx

func (f *RowsUnboundedPrecedingToUnboundedFollowingFramer) LastIdx() int

func (*RowsUnboundedPrecedingToUnboundedFollowingFramer) NewFramer

func (f *RowsUnboundedPrecedingToUnboundedFollowingFramer) NewFramer(interval sql.WindowInterval) (sql.WindowFramer, error)

func (*RowsUnboundedPrecedingToUnboundedFollowingFramer) Next

func (f *RowsUnboundedPrecedingToUnboundedFollowingFramer) Next(ctx *sql.Context, buffer sql.WindowBuffer) (sql.WindowInterval, error)

type Sum

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

func NewSum

func NewSum(e sql.Expression) *Sum

func (*Sum) Children

func (a *Sum) Children() []sql.Expression

func (Sum) Description

func (a Sum) Description() string

func (*Sum) Eval

func (a *Sum) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

func (Sum) FunctionName

func (a Sum) FunctionName() string

func (*Sum) IsNullable

func (a *Sum) IsNullable() bool

func (*Sum) NewBuffer

func (a *Sum) NewBuffer() (sql.AggregationBuffer, error)

func (*Sum) NewWindowFunction

func (a *Sum) NewWindowFunction() (sql.WindowFunction, error)

func (*Sum) Resolved

func (a *Sum) Resolved() bool

func (*Sum) String

func (a *Sum) String() string

func (*Sum) Type

func (a *Sum) Type() sql.Type

func (*Sum) Window

func (a *Sum) Window() *sql.WindowDefinition

func (*Sum) WithChildren

func (a *Sum) WithChildren(children ...sql.Expression) (sql.Expression, error)

func (*Sum) WithWindow

func (a *Sum) WithWindow(window *sql.WindowDefinition) (sql.Aggregation, error)

type SumAgg

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

func NewSumAgg

func NewSumAgg(e sql.Expression) *SumAgg

func (*SumAgg) Compute

func (a *SumAgg) Compute(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) interface{}

func (*SumAgg) DefaultFramer

func (a *SumAgg) DefaultFramer() sql.WindowFramer

DefaultFramer returns a NewUnboundedPrecedingToCurrentRowFramer

func (*SumAgg) Dispose

func (a *SumAgg) Dispose()

func (*SumAgg) NewSlidingFrameInterval

func (a *SumAgg) NewSlidingFrameInterval(added, dropped sql.WindowInterval)

func (*SumAgg) StartPartition

func (a *SumAgg) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) error

func (*SumAgg) WithWindow

func (a *SumAgg) WithWindow(w *sql.WindowDefinition) (sql.WindowFunction, error)

type WindowIter

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

WindowIter is a wrapper that evaluates a set of WindowPartitionIter.

The current implementation has 3 steps: 1. Materialize [iter] and duplicate a sql.WindowBuffer for each partition. 2. Collect rows from child partitions. 3. Rearrange partition results into the projected ordering given by [outputOrdinals].

We assume [outputOrdinals] is appropriately sized for [partitionIters].

func NewWindowIter

func NewWindowIter(partitionIters []*WindowPartitionIter, outputOrdinals [][]int, iter sql.RowIter) *WindowIter

func (*WindowIter) Close

func (i *WindowIter) Close(ctx *sql.Context) error

Close implements sql.RowIter

func (*WindowIter) Dispose

func (i *WindowIter) Dispose()

Dispose implements sql.Disposable

func (*WindowIter) Next

func (i *WindowIter) Next(ctx *sql.Context) (sql.Row, error)

Next implements sql.RowIter

type WindowPartition

type WindowPartition struct {
	PartitionBy []sql.Expression
	SortBy      sql.SortFields
	Aggs        []*Aggregation
}

WindowPartition is an Aggregation set with unique partition and sorting keys. There may be several WindowPartitions in one query, but each has unique key set. A WindowPartitionIter is used to evaluate a WindowPartition with a specific sql.RowIter.

func NewWindowPartition

func NewWindowPartition(partitionBy []sql.Expression, sortBy sql.SortFields, aggs []*Aggregation) *WindowPartition

func (*WindowPartition) AddAggregation

func (w *WindowPartition) AddAggregation(agg *Aggregation)

type WindowPartitionIter

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

WindowPartitionIter evaluates a WindowPartition with a sql.RowIter child. A parent WindowIter is expected to maintain the projection ordering for WindowPartition output columns.

WindowPartitionIter will return rows sorted in the same order generated by [child]. This is accomplished privately by appending the sort ordering index to [i.input] rows during materializeInput, and removing after sortAndFilterOutput.

Next currently materializes [i.input] and [i.output] before returning the first result, regardless of Limit or other expressions.

func NewWindowPartitionIter

func NewWindowPartitionIter(windowBlock *WindowPartition) *WindowPartitionIter

func (*WindowPartitionIter) Close

func (i *WindowPartitionIter) Close(ctx *sql.Context) error

func (*WindowPartitionIter) Dispose

func (i *WindowPartitionIter) Dispose()

func (*WindowPartitionIter) Next

func (i *WindowPartitionIter) Next(ctx *sql.Context) (sql.Row, error)

func (*WindowPartitionIter) WindowBlock

func (i *WindowPartitionIter) WindowBlock() *WindowPartition

type WindowedJSONArrayAgg

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

func NewJsonArrayAgg

func NewJsonArrayAgg(expr sql.Expression) *WindowedJSONArrayAgg

func (*WindowedJSONArrayAgg) Compute

func (a *WindowedJSONArrayAgg) Compute(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) interface{}

func (*WindowedJSONArrayAgg) DefaultFramer

func (a *WindowedJSONArrayAgg) DefaultFramer() sql.WindowFramer

DefaultFramer returns a NewUnboundedPrecedingToCurrentRowFramer

func (*WindowedJSONArrayAgg) Dispose

func (a *WindowedJSONArrayAgg) Dispose()

func (*WindowedJSONArrayAgg) NewSlidingFrameInterval

func (a *WindowedJSONArrayAgg) NewSlidingFrameInterval(added, dropped sql.WindowInterval)

func (*WindowedJSONArrayAgg) StartPartition

func (a *WindowedJSONArrayAgg) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) error

func (*WindowedJSONArrayAgg) WithWindow

type WindowedJSONObjectAgg

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

func NewWindowedJSONObjectAgg

func NewWindowedJSONObjectAgg(j *JSONObjectAgg) *WindowedJSONObjectAgg

func (*WindowedJSONObjectAgg) Compute

func (a *WindowedJSONObjectAgg) Compute(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) interface{}

func (*WindowedJSONObjectAgg) DefaultFramer

func (a *WindowedJSONObjectAgg) DefaultFramer() sql.WindowFramer

DefaultFramer returns a NewUnboundedPrecedingToCurrentRowFramer

func (*WindowedJSONObjectAgg) Dispose

func (a *WindowedJSONObjectAgg) Dispose()

func (*WindowedJSONObjectAgg) NewSlidingFrameInterval

func (a *WindowedJSONObjectAgg) NewSlidingFrameInterval(added, dropped sql.WindowInterval)

func (*WindowedJSONObjectAgg) StartPartition

func (a *WindowedJSONObjectAgg) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) error

func (*WindowedJSONObjectAgg) WithWindow

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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