Class SegmentationExtensions
Wrapper for segmentation-related extension methods. You shouldn't ever need to refer directly to this class.
Inherited Members
Namespace: Mangrove.MetricSetTransformers.Segmentation
Assembly: MetricSetTransformers.dll
Syntax
public static class SegmentationExtensions
Methods
View SourceColumnReferenceToSegmentTupleMap(IEnumerable<Expression>, IEnumerable<(ColumnReference expr, Int32 group, Boolean flag)>)
Collect all the ColumnReference represented by pairs of strings (table name, column name) that depend (are children of) a given list of segment expressions.
Declaration
public static IDictionary<(string Table, string Expression), (ColumnReference, int, bool)> ColumnReferenceToSegmentTupleMap(this IEnumerable<Expression> expressions, IEnumerable<(ColumnReference expr, int group, bool flag)> segmentTuples)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Expression> | expressions | |
IEnumerable<ValueTuple<ColumnReference, Int32, Boolean>> | segmentTuples |
Returns
Type | Description |
---|---|
IDictionary<ValueTuple<String, String>, ValueTuple<ColumnReference, Int32, Boolean>> |
Remarks
Because the output of the class is used in expression visitors where the expressions will change, but not their names, it is better to identify the column references with a pair of corresponding string names.
PropagateAggregands(MetricsPlan, IEnumerable<ColumnReference>)
Creates and propagates Aggregand from a Table to all of its children. Result is a collection of ColumnReference wrapping the newly created aggregands plus the original ColumnReference themselves.
Declaration
public static ISet<ColumnReference> PropagateAggregands(this MetricsPlan plan, IEnumerable<ColumnReference> startingExpressions)
Parameters
Type | Name | Description |
---|---|---|
MetricsPlan | plan | |
IEnumerable<ColumnReference> | startingExpressions |
Returns
Type | Description |
---|---|
ISet<ColumnReference> |
Remarks
Used for segmentation. If a column defines a segment (so is used in "group by" statement) we need to group by the value of this column all the way up to the top level of aggregation.