Class InsertColumnReferences
Inserts column references between tables whenever required.
Inheritance
Implements
Inherited Members
Namespace: Mangrove.MetricSetTransformers.Normalization
Assembly: MetricSetTransformers.dll
Syntax
public class InsertColumnReferences : ChangeExpressions, IGenericExpressionVisitor<IEnumerable<Expression>>, IExpressionVisitor, IGenericVisitor<IEnumerable<Expression>>
Remarks
Note: this does not optimize (i.e., it creates new ColumnReference expressions if one already exists wrapping a given expression node).
If there are tables T1 -> T2 (reverse dependency order) and an expression e2 in T2 depends directly on an expression e1 in T1 which is not a ColumnReference, the SELECT statements produced by most emitters can fail. This transformer adds "wrapper" references e1 -> cr1 -> e2 to fix that.
Note: the precise condition for when to wrap e2 is the following: e2 needs wrap if its parent e1 is in another table and e1 is neither a ColumnReference nor a Constant. For example, if e2 = x+y with both x and y column references on T2, we do not wrap e2.
Note: this does not add intermediate expressions for dependencies which skip a table.
Methods
View SourceReplaceParent(Expression, Expression, Expression)
Declaration
protected override Expression ReplaceParent(Expression expr, Expression oldParent, Expression newParent)
Parameters
Type | Name | Description |
---|---|---|
Expression | expr | |
Expression | oldParent | |
Expression | newParent |
Returns
Type | Description |
---|---|
Expression |