Class InsertIntermediateComputations
Inserts intermeaditate computations for expressions that skip tables.
Inheritance
Implements
Inherited Members
Namespace: Mangrove.MetricSetTransformers.Normalization
Assembly: MetricSetTransformers.dll
Syntax
public class InsertIntermediateComputations : ChangeExpressions, IGenericExpressionVisitor<IEnumerable<Expression>>, IExpressionVisitor, IGenericVisitor<IEnumerable<Expression>>
Remarks
Skiping tables means having expression dependency a -> c with a in table A, c in table C and table dependency A -> B -> C with some table B. This class would replace the chain a -> c with a -> b -> c with the corresponding expression b from table B.
NOTE: by default, we want to replace aggregations as well. This can only be done if all aggregations are of recursive type as defined by IsRecursive(UnaryAggregation). It will throw an exception if there are non-recursive aggregations. By setting the replaceAggregations flag to false we can prevent replacing any aggregations.
NOTE: expressions of types ColumnReference cannot be replaced if the intermediate tables are of type Aggregation. In such cases it will throw an exception because this should never happen: there is no unique way to pass a ColumnReference through an Aggregation.
For recursive aggregations the replacement works as follows. For example, SUM<User>(R) is replaced by SUM<User>SUM<Session>(R) where R is a page-level signal and the aggregation levels are User-Session-Page.
Constructors
View SourceInsertIntermediateComputations()
Declaration
public InsertIntermediateComputations()
InsertIntermediateComputations(Func<Expression, Table, Expression, Expression>)
Declaration
public InsertIntermediateComputations(Func<Expression, Table, Expression, Expression> intermediateExpressionsFactory)
Parameters
Type | Name | Description |
---|---|---|
Func<Expression, Table, Expression, Expression> | intermediateExpressionsFactory | A function describing how to create intermediate expressions on tables. Given a child expression, a table, and the previous expression, it decides what expression to add to that table. If the result of the function is null, no new expressions will be added to the table. |
InsertIntermediateComputations(Func<Expression, Table, Expression, Boolean>)
Use the default rules for inserting intermediate expressions defined by
Mangrove.MetricSetTransformers.Normalization.InsertIntermediateComputations.CreateIntermediateExpressionFactory(System.Func{Mangrove.MetricSetSyntaxTree.Expression,Mangrove.MetricSetSyntaxTree.Table,Mangrove.MetricSetSyntaxTree.Expression,System.Boolean}),
but modify them to ignore any case when ignore
evaluates to true.
Declaration
public InsertIntermediateComputations(Func<Expression, Table, Expression, bool> ignore)
Parameters
Type | Name | Description |
---|---|---|
Func<Expression, Table, Expression, Boolean> | ignore | When the value is true, all the default rules will be ignored and no expression wouldbe inserted. |
Remarks
In some cases, it is beneficial to allow some Expressions to skip Tables. For example, it could give a better perf for a vectorized engine where packing and unpacking the computations is expensive.
Methods
View SourceChange(Aggregand)
Declaration
protected override Expression Change(Aggregand agd)
Parameters
Type | Name | Description |
---|---|---|
Aggregand | agd |
Returns
Type | Description |
---|---|
Expression |
Overrides
View SourceChange(BinaryOperation)
Declaration
protected override Expression Change(BinaryOperation b)
Parameters
Type | Name | Description |
---|---|---|
BinaryOperation | b |
Returns
Type | Description |
---|---|
Expression |
Overrides
View SourceChange(ColumnReference)
Declaration
protected override Expression Change(ColumnReference cr)
Parameters
Type | Name | Description |
---|---|---|
ColumnReference | cr |
Returns
Type | Description |
---|---|
Expression |
Overrides
View SourceChange(Extern)
Declaration
protected override Expression Change(Extern ext)
Parameters
Type | Name | Description |
---|---|---|
Extern | ext |
Returns
Type | Description |
---|---|
Expression |
Overrides
View SourceChange(Filter)
Declaration
protected override Expression Change(Filter f)
Parameters
Type | Name | Description |
---|---|---|
Filter | f |
Returns
Type | Description |
---|---|
Expression |
Overrides
View SourceChange(JoinKey)
Declaration
protected override Expression Change(JoinKey k)
Parameters
Type | Name | Description |
---|---|---|
JoinKey | k |
Returns
Type | Description |
---|---|
Expression |
Overrides
View SourceChange(TernaryOperation)
Declaration
protected override Expression Change(TernaryOperation t)
Parameters
Type | Name | Description |
---|---|---|
TernaryOperation | t |
Returns
Type | Description |
---|---|
Expression |
Overrides
View SourceChange(UnaryAggregation)
Declaration
protected override Expression Change(UnaryAggregation agg)
Parameters
Type | Name | Description |
---|---|---|
UnaryAggregation | agg |
Returns
Type | Description |
---|---|
Expression |
Overrides
View SourceChange(UnaryOperation)
Declaration
protected override Expression Change(UnaryOperation u)
Parameters
Type | Name | Description |
---|---|---|
UnaryOperation | u |
Returns
Type | Description |
---|---|
Expression |
Overrides
View SourceChange(UnaryWindowFunction)
Declaration
protected override Expression Change(UnaryWindowFunction w)
Parameters
Type | Name | Description |
---|---|---|
UnaryWindowFunction | w |
Returns
Type | Description |
---|---|
Expression |