group

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2017 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package group represents group stage of analysis. Group stage group values from expand stage. The values are grouped under the same name and type (result: [name, type] => value aggregation). This stage counts all statistics above the data.

Index

Constants

This section is empty.

Variables

View Source
var BsonFieldName string

BsonFieldName represents field name

View Source
var LengthHistogramTypes = []string{
	"string",
	"array",
	"object",
}

LengthHistogramTypes - types for which a histogram is created from the lengths. if LengthHistogramResolution > 0

View Source
var StoreAvgValueTypes = []string{
	"double",
	"bool",
	"int",
	"long",
	"decimal",
}

StoreAvgValueTypes - types for which the average value is calculated and stored, if options.StoreMinMaxAvgValue == true

View Source
var StoreBottomValuesTypes = []string{
	"double",
	"string",
	"date",
	"int",
	"timestamp",
	"long",
	"decimal",
}

StoreBottomValuesTypes - types for which are saved least occurring value, if options.StoreBottomNValues > 0

View Source
var StoreCountOfUniqueTypes = []string{
	"double",
	"string",
	"date",
	"int",
	"timestamp",
	"long",
	"decimal",
}

StoreCountOfUniqueTypes - types for which is stored number of unique values if options.StoreCountOfUnique == true

View Source
var StoreLengthTypes = []string{
	"string",
	"array",
	"object",
}

StoreLengthTypes - types for which the minimum, maximum, and average values are stored, if options.StoreMinMaxAvgLength == true

View Source
var StoreMinMaxValueTypes = []string{
	"objectId",
	"double",
	"string",
	"bool",
	"date",
	"int",
	"timestamp",
	"long",
	"decimal",
}

StoreMinMaxValueTypes - Types for which the minimum and maximum values are calculated and stored, if options.StoreMinMaxAvgValue == true

View Source
var StoreTopValuesTypes = []string{
	"double",
	"string",
	"date",
	"int",
	"timestamp",
	"long",
	"decimal",
}

StoreTopValuesTypes - types for which are saved most occurring value, if options.StoreTopNValues > 0

View Source
var StoreValueTypes []string

StoreValueTypes - types for which is calculated frequency distribution of value.

View Source
var TopBottomValuesTypes []string

TopBottomValuesTypes = STORE_TOP_VALUES_TYPES + STORE_BOTTOM_VALUES_TYPES

View Source
var ValueHistogramTypes = []string{
	"double",
	"date",
	"int",
	"long",
	"decimal",
}

ValueHistogramTypes - types for which a histogram is created from the values. if ValueHistogramResolution > 0

Functions

func NormalizeType

func NormalizeType(t *analysis.Type, location *time.Location)

NormalizeType normalizes data from the database.

func ResultChannelToSlice

func ResultChannelToSlice(ch <-chan Result) []interface{}

ResultChannelToSlice reads Result channel into slice.

func ToResultChannel

func ToResultChannel(inCh interface{}, location *time.Location, concurrency int, bufferSize int) <-chan Result

ToResultChannel converts input channel to Result channel. The input may by raw []byte channel or Result channel (no conversion).

Types

type Options

type Options struct {
	ProcessObjectIdAsDate bool // objectId will be converted to date and analysis
	//MaxItemsForFreqAnalysis   uint // for the frequency analysis (unique, top, bottom), the first N samples will be used, zero = all items
	StoreMinMaxAvgValue   bool // store minimum, maximum and average value if possible
	StoreMinMaxAvgLength  bool // store minimum, maximum and average length
	StoreCountOfUnique    bool // store number of unique values
	StoreTopNValues       uint // saves the N values that most occur, zero = disabled
	StoreBottomNValues    uint // saves the N values that least occur, zero = disabled
	StoreWeekdayHistogram bool
	StoreHourHistogram    bool
	ValueHistogramMaxRes  uint // create histogram from values, zero = disabled
	LengthHistogramMaxRes uint // create histogram from length of values, zero = disabled
}

Options for group stage.

func (*Options) IsNecessaryToCalcLengthFreq

func (options *Options) IsNecessaryToCalcLengthFreq() bool

IsNecessaryToCalcLengthFreq - will be length frequency distribution needed for further calculations?

func (*Options) IsNecessaryToCalcValueFreq

func (options *Options) IsNecessaryToCalcValueFreq() bool

IsNecessaryToCalcValueFreq - will be value frequency distribution needed for further calculations?

type Result

type Result struct {
	Name string        `bson:"n"`
	Type analysis.Type `bson:",inline"`
}

Result - values from expand stage are grouped by name and type.

type StageFactory

type StageFactory func(options *Options) *analysis.Stage

StageFactory prototype.

Directories

Path Synopsis
Package groupInDB is the implementation of the group stage that runs in database.
Package groupInDB is the implementation of the group stage that runs in database.
Package groupLocally is the implementation of the group stage that runs locally.
Package groupLocally is the implementation of the group stage that runs locally.
Package groupTests contains common tests for group stage.
Package groupTests contains common tests for group stage.

Jump to

Keyboard shortcuts

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