Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColAggregation ¶ added in v0.16.0
type ColAggregation interface { // InputName returns the name of the input column. InputName() string // InputIndex returns the index of the input column. InputIndex() int // SetInputIndex sets the index of the input column. SetInputIndex(int) // OutputName returns the name of the output column. OutputName() string // RenameOutput returns a copy of the ColAggregation with a new output column name. RenameOutput(string) ColAggregation // NeedInclusiveWindow returns true if the ColAggregation needs to have inclusive windows. NeedInclusiveWindow() bool // Type returns the return type of the ColAggregation. Type() bow.Type // GetReturnType returns the return type of the ColAggregation depending on an input and an iterator type. GetReturnType(inputType, iteratorType bow.Type) bow.Type // Func returns the ColAggregationFunc of the ColAggregation. Func() ColAggregationFunc // Transformations returns the transformation functions of the ColAggregation. Transformations() []transformation.Func // SetTransformations returns a copy of the ColAggregation with new transformations functions. SetTransformations(...transformation.Func) ColAggregation }
ColAggregation is a set of methods to aggregate and transform a Window.
func NewColAggregation ¶ added in v0.16.0
func NewColAggregation(inputName string, needInclusiveWindow bool, typ bow.Type, fn ColAggregationFunc) ColAggregation
NewColAggregation returns a new ColAggregation.
type ColAggregationConstruct ¶ added in v0.16.0
type ColAggregationConstruct func(colName string) ColAggregation
type ColAggregationFunc ¶ added in v0.16.0
type ColInterpolation ¶ added in v0.16.0
type ColInterpolation struct {
// contains filtered or unexported fields
}
ColInterpolation is used to interpolate a column.
func NewColInterpolation ¶ added in v0.16.0
func NewColInterpolation(colName string, inputTypes []bow.Type, fn ColInterpolationFunc) ColInterpolation
NewColInterpolation returns a new ColInterpolation.
type ColInterpolationFunc ¶ added in v0.16.0
type ColInterpolationFunc func(colIndex int, window Window, fullBow, prevRow bow.Bow) (interface{}, error)
ColInterpolationFunc is a function that take a column index, a Window, the full bow.Bow and the previous row, and provides a value at the start of the Window.
type Options ¶
Options sets options for IntervalRolling: - Offset: interval to move the window start, can be negative. - Inclusive: sets if the window needs to be inclusive; i.e., includes the last point. - PrevRow: extra point before the window to enable better interpolation.
type Rolling ¶
type Rolling interface { // Aggregate aggregates each column by using a ColAggregation. Aggregate(...ColAggregation) Rolling // Interpolate fills each window by interpolating its start if missing. Interpolate(...ColInterpolation) Rolling // NumWindows returns the total number of windows in the Bow. NumWindows() (int, error) // HasNext returns true if the next call to Next() will return a new Window. HasNext() bool // Next returns the next Window, along with its index. Next() (windowIndex int, window *Window, err error) // Bow returns the Bow from the Rolling. Bow() (bow.Bow, error) }
Rolling enables processing a Bow via windows. Use Interpolate() and/or Aggregate() to transform windows. Use Next() to iterate over windows. Use Bow() to get the processed Bow.
func IntervalRolling ¶
IntervalRolling returns a new interval-based Rolling with: - b: Bow to process in windows - colName: column on which the interval is based on - interval: numeric value independent of any unit, length of the windows All windows except the last one may be empty.
type Window ¶
type Window struct { Bow bow.Bow FirstIndex int IntervalColIndex int FirstValue int64 LastValue int64 IsInclusive bool }
Window represents an interval-based window of data with: Bow: data FirstIndex: index (across all windows) of first row in this window (-1 if none) IntervalColIndex: index of the interval column FirstValue: Window first value LastValue: Window last value IsInclusive: Window is inclusive, i.e. includes the last point at the end of the interval
func (Window) UnsetInclusive ¶
UnsetInclusive returns a copy of the Window with the IsInclusive parameter set to false and with the last row sliced off. Returns the unchanged Window if the IsInclusive parameter is not set.