Show / Hide Table of Contents

Class MetricsPlan

Handle for the (de)serializable contract, containing flat lists of Expression and Table objects, any needed binaries, and MetricSetMetadata.

Inheritance
Object
MetricsPlan
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Namespace: Mangrove.MetricSetSyntaxTree
Assembly: MetricSetSyntaxTree.dll
Syntax
public class MetricsPlan
Remarks

Concepts

What, conceptually, does a MetricsPlan represent? Fundamentally, it captures a specification of how to compute some values ("metrics", hence the name of this class). That description may not be fully complete, e.g. there may still be some wildcards like #Start# or #Flights#, and it may have more metrics than one finally intends to compute. A computation specification (MetricsPlan) may not initially be in a format which lends to easy script-generation, but for that we have a battery of IMetricsPlanTransformer objects for transforming a "raw" MetricsPlan produced by compiling a metric set into a "modified" MetricsPlan which may be passed into an emitter for script-generation. Along the way, assumptions about MetricsPlan objects are expressed via IMetricsPlanValidator objects.

Contents

A serialized MetricsPlan is actually a zip file, regardless of its file extension. The internal structure will look like:

package
    __references__
        *.jar
        *.dll
    AST.json

Properties

View Source

Expressions

All expressions (intermediate or not) in this MetricsPlan, given in no particular order.

Declaration
public IReadOnlyList<Expression> Expressions { get; }
Property Value
Type Description
IReadOnlyList<Expression>
View Source

Metadata

Generic metadata (e.g., metric set name) for this object.

Declaration
public MetricSetMetadata Metadata { get; }
Property Value
Type Description
MetricSetMetadata
View Source

References

Mapping name -> binary (whether DLL or JAR file).

Declaration
[JsonIgnore]
public IReadOnlyDictionary<string, MemoryStream> References { get; }
Property Value
Type Description
IReadOnlyDictionary<String, MemoryStream>
View Source

Tables

All tables in this MetricsPlan, given in no particular order.

Declaration
public IReadOnlyList<Table> Tables { get; }
Property Value
Type Description
IReadOnlyList<Table>

Methods

View Source

CreateValidMetricsPlan(IEnumerable<Expression>, IEnumerable<Table>, MetricSetMetadata, IMetricsPlanValidator, IReadOnlyDictionary<String, MemoryStream>)

Create a valid MetricsPlan using a validator to check that the MetricsPlan is a consistent object.

Declaration
public static MetricsPlan CreateValidMetricsPlan(IEnumerable<Expression> expressions, IEnumerable<Table> tables, MetricSetMetadata metadata, IMetricsPlanValidator validator, IReadOnlyDictionary<string, MemoryStream> references)
Parameters
Type Name Description
IEnumerable<Expression> expressions
IEnumerable<Table> tables
MetricSetMetadata metadata
IMetricsPlanValidator validator
IReadOnlyDictionary<String, MemoryStream> references
Returns
Type Description
MetricsPlan
Remarks

See AggregateValidator to run multiple validations.

View Source

Deserialize(Stream)

Create a MetricsPlan from the stream corresponding to a serialized one.

Declaration
public static MetricsPlan Deserialize(Stream serialized)
Parameters
Type Name Description
Stream serialized
Returns
Type Description
MetricsPlan
View Source

Load(String)

Construct a MetricsPlan and contents from a file containing a serialized plan.

Declaration
public static MetricsPlan Load(string path)
Parameters
Type Name Description
String path
Returns
Type Description
MetricsPlan
View Source

Save(String, FileMode)

Save this object to given path.

Declaration
public void Save(string path, FileMode mode = FileMode.OpenOrCreate)
Parameters
Type Name Description
String path
FileMode mode
View Source

Serialize()

Serialize this object and everything it contains as a stream.

Declaration
public Stream Serialize()
Returns
Type Description
Stream
View Source

ToString()

Pretty-print this MetricsPlan.

Declaration
public override string ToString()
Returns
Type Description
String
Overrides
Object.ToString()

Extension Methods

MetricsPlanExtensions.WithAddedExpressions(MetricsPlan, IEnumerable<Expression>, IMetricsPlanValidator)
MetricsPlanExtensions.WithAddedTablesAndExpressions(MetricsPlan, IEnumerable<Expression>, IEnumerable<Table>, IMetricsPlanValidator)
MetricsPlanExtensions.WithAddedResources(MetricsPlan, IDictionary<String, MemoryStream>, IMetricsPlanValidator)
MetricsPlanExtensions.With(MetricsPlan, IMetricsPlanValidator, Func<Aggregation, Table>, Func<DataSource, Table>, Func<ExternTable, Table>, Func<Join, Table>, Func<TableReference, Table>, Func<Union, Table>, Func<Aggregand, Expression>, Func<BinaryAggregation, Expression>, Func<BinaryOperation, Expression>, Func<ColumnReference, Expression>, Func<DataSourceColumn, Expression>, Func<Extern, Expression>, Func<Filter, Expression>, Func<JoinKey, Expression>, Func<Literal, Expression>, Func<TernaryOperation, Expression>, Func<UnaryAggregation, Expression>, Func<UnaryOperation, Expression>, Func<UnionExpression, Expression>, Func<VectorOperation, Expression>, Func<UnaryWindowFunction, Expression>)
MetricsPlanExtensions.Clone(MetricsPlan, MetricSetMetadata, IMetricsPlanValidator)
MetricsPlanExtensions.Clone(MetricsPlan, String)
MetricsPlanExtensions.Clone(MetricsPlan, IEnumerable<Expression>, IMetricsPlanValidator)
MetricsPlanExtensions.Clone(MetricsPlan, IEnumerable<Expression>, IEnumerable<Table>, IMetricsPlanValidator)
MetricsPlanExtensions.Clone(MetricsPlan, IReadOnlyDictionary<String, MemoryStream>, IMetricsPlanValidator)
MetricsPlanExtensions.Tables<T>(MetricsPlan)
MetricsPlanExtensions.TopExperimentUnitTable(MetricsPlan)
MetricsPlanExtensions.ExperimentUnitTables(MetricsPlan)
MetricsPlanExtensions.TryFindVariantColumn(MetricsPlan, out ColumnReference)
MetricsPlanExtensions.TryFindTimestampColumn(MetricsPlan, out ColumnReference)
MetricsPlanExtensions.TryFindUnique<T>(MetricsPlan, out ColumnReference)
MetricsPlanExtensions.TablesAtExperimentUnitLevel(MetricsPlan)
MetricsPlanExtensions.LeafExpressions(MetricsPlan)
MetricsPlanExtensions.LeafTables(MetricsPlan)
MetricsPlanExtensions.Metrics(MetricsPlan)
MetricsPlanExtensions.BaseTables(MetricsPlan)
MetricsPlanExtensions.TableToExpressionMapping(MetricsPlan)
MetricsPlanExtensions.BaseTable(MetricsPlan)
SegmentationExtensions.PropagateAggregands(MetricsPlan, IEnumerable<ColumnReference>)
ObjectExtensions.EventId(Object)
  • View Source
Back to top Generated by DocFX