aggregates

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Aggregates = map[string]physical.AggregateDetails{
	"array_agg": {
		Description: "Creates an array of all items in the group.",
		Descriptors: ArrayOverloads,
	},
	"array_agg_distinct": {
		Description: "Creates an array of distinct items in the group.",
		Descriptors: DistinctAggregateOverloads(ArrayOverloads),
	},
	"count": {
		Description: "Counts all items in the group.",
		Descriptors: CountOverloads,
	},
	"count_distinct": {
		Description: "Counts distinct items in the group.",
		Descriptors: DistinctAggregateOverloads(CountOverloads),
	},
	"sum": {
		Description: "Sums all items in the group.",
		Descriptors: SumOverloads,
	},
	"sum_distinct": {
		Description: "Sums distinct items in the group.",
		Descriptors: DistinctAggregateOverloads(SumOverloads),
	},
	"avg": {
		Description: "Averages all items in the group.",
		Descriptors: AverageOverloads,
	},
	"avg_distinct": {
		Description: "Averages distinct items in the group.",
		Descriptors: DistinctAggregateOverloads(AverageOverloads),
	},
	"max": {
		Description: "Returns maximum item in the group.",
		Descriptors: MaxOverloads,
	},
	"min": {
		Description: "Returns minimum item in the group.",
		Descriptors: MinOverloads,
	},
}
View Source
var ArrayOverloads = []physical.AggregateDescriptor{
	{
		TypeFn: func(t octosql.Type) (octosql.Type, bool) {
			return octosql.Type{TypeID: octosql.TypeIDList, List: struct{ Element *octosql.Type }{Element: &t}}, true
		},
		Prototype: NewArrayPrototype(),
	},
}
View Source
var AverageOverloads = []physical.AggregateDescriptor{
	{
		ArgumentType: octosql.Int,
		OutputType:   octosql.Int,
		Prototype:    NewAverageIntPrototype(),
	},
	{
		ArgumentType: octosql.Float,
		OutputType:   octosql.Float,
		Prototype:    NewAverageFloatPrototype(),
	},
	{
		ArgumentType: octosql.Duration,
		OutputType:   octosql.Duration,
		Prototype:    NewAverageDurationPrototype(),
	},
}
View Source
var CountOverloads = []physical.AggregateDescriptor{
	{
		ArgumentType: octosql.Any,
		OutputType:   octosql.Int,
		Prototype:    NewCountPrototype(),
	},
}
View Source
var MaxOverloads = []physical.AggregateDescriptor{
	{
		ArgumentType: octosql.Int,
		OutputType:   octosql.Int,
		Prototype:    NewMaxPrototype(),
	},
	{
		ArgumentType: octosql.Float,
		OutputType:   octosql.Float,
		Prototype:    NewMaxPrototype(),
	},
	{
		ArgumentType: octosql.Duration,
		OutputType:   octosql.Duration,
		Prototype:    NewMaxPrototype(),
	},
	{
		ArgumentType: octosql.Time,
		OutputType:   octosql.Time,
		Prototype:    NewMaxPrototype(),
	},
}
View Source
var MinOverloads = []physical.AggregateDescriptor{
	{
		ArgumentType: octosql.Int,
		OutputType:   octosql.Int,
		Prototype:    NewMinPrototype(),
	},
	{
		ArgumentType: octosql.Float,
		OutputType:   octosql.Float,
		Prototype:    NewMinPrototype(),
	},
	{
		ArgumentType: octosql.Duration,
		OutputType:   octosql.Duration,
		Prototype:    NewMinPrototype(),
	},
}
View Source
var SumOverloads = []physical.AggregateDescriptor{
	{
		ArgumentType: octosql.Int,
		OutputType:   octosql.Int,
		Prototype:    NewSumIntPrototype(),
	},
	{
		ArgumentType: octosql.Float,
		OutputType:   octosql.Float,
		Prototype:    NewSumFloatPrototype(),
	},
	{
		ArgumentType: octosql.Duration,
		OutputType:   octosql.Duration,
		Prototype:    NewSumDurationPrototype(),
	},
}

Functions

func DistinctAggregateOverloads

func DistinctAggregateOverloads(overloads []physical.AggregateDescriptor) []physical.AggregateDescriptor

func NewArrayPrototype

func NewArrayPrototype() func() nodes.Aggregate

func NewAverageDurationPrototype

func NewAverageDurationPrototype() func() nodes.Aggregate

func NewAverageFloatPrototype

func NewAverageFloatPrototype() func() nodes.Aggregate

func NewAverageIntPrototype

func NewAverageIntPrototype() func() nodes.Aggregate

func NewCountPrototype

func NewCountPrototype() func() nodes.Aggregate

func NewDistinctPrototype

func NewDistinctPrototype(wrapped func() nodes.Aggregate) func() nodes.Aggregate

func NewMaxPrototype

func NewMaxPrototype() func() nodes.Aggregate

func NewMinPrototype

func NewMinPrototype() func() nodes.Aggregate

func NewSumDurationPrototype

func NewSumDurationPrototype() func() nodes.Aggregate

func NewSumFloatPrototype

func NewSumFloatPrototype() func() nodes.Aggregate

func NewSumIntPrototype

func NewSumIntPrototype() func() nodes.Aggregate

Types

type Array

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

TODO: Elements should be sorted as they come, not sorted by value in a BTree.

func (*Array) Add

func (c *Array) Add(retraction bool, value octosql.Value) bool

func (*Array) Trigger

func (c *Array) Trigger() octosql.Value

type AverageDuration

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

func (*AverageDuration) Add

func (c *AverageDuration) Add(retraction bool, value octosql.Value) bool

func (*AverageDuration) Trigger

func (c *AverageDuration) Trigger() octosql.Value

type AverageFloat

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

func (*AverageFloat) Add

func (c *AverageFloat) Add(retraction bool, value octosql.Value) bool

func (*AverageFloat) Trigger

func (c *AverageFloat) Trigger() octosql.Value

type AverageInt

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

func (*AverageInt) Add

func (c *AverageInt) Add(retraction bool, value octosql.Value) bool

func (*AverageInt) Trigger

func (c *AverageInt) Trigger() octosql.Value

type Count

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

func (*Count) Add

func (c *Count) Add(retraction bool, value octosql.Value) bool

func (*Count) Trigger

func (c *Count) Trigger() octosql.Value

type Distinct

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

func (*Distinct) Add

func (c *Distinct) Add(retraction bool, value octosql.Value) bool

func (*Distinct) Trigger

func (c *Distinct) Trigger() octosql.Value

type Max

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

func (*Max) Add

func (c *Max) Add(retraction bool, value octosql.Value) bool

func (*Max) Trigger

func (c *Max) Trigger() octosql.Value

type Min

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

func (*Min) Add

func (c *Min) Add(retraction bool, value octosql.Value) bool

func (*Min) Trigger

func (c *Min) Trigger() octosql.Value

type SumDuration

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

func (*SumDuration) Add

func (c *SumDuration) Add(retraction bool, value octosql.Value) bool

func (*SumDuration) Trigger

func (c *SumDuration) Trigger() octosql.Value

type SumFloat

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

func (*SumFloat) Add

func (c *SumFloat) Add(retraction bool, value octosql.Value) bool

func (*SumFloat) Trigger

func (c *SumFloat) Trigger() octosql.Value

type SumInt

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

func (*SumInt) Add

func (c *SumInt) Add(retraction bool, value octosql.Value) bool

func (*SumInt) Trigger

func (c *SumInt) Trigger() octosql.Value

Jump to

Keyboard shortcuts

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