Class NormalizeColumnReferenceDependencies
Finds expressions which depend on other column references within the same table and removes the dependency within the table.
Implements
Inherited Members
Namespace: Mangrove.MetricSetTransformers.Normalization
Assembly: MetricSetTransformers.dll
Syntax
public class NormalizeColumnReferenceDependencies : LoggingTransformerBase, IMetricsPlanTransformer
Remarks
Suppose we have expressions e1, e2, wrapped in column references cr1, cr2, via: cr2 -> e2 -> cr1 -> e1 (arrows represent pointers), all in the same table. This transformer would make e2 depend directly on e1, removing the dependency on cr1.
In other words, the SELECT statement
SELECT x+1 AS a, 2*a AS b
would be transformed into
SELECT x+1 AS a, 2*(x+1) AS b
NOTE: when doing the substitutions, the expressions get wrapped in parentheses.
NOTE: such inlining might add performace issues, especially when parsing large JSON blobs. We will need to optimize this transformer for such scenarios.
NOTE: this would not create any new top column references (i.e. column references within no children in the same table). In the above example with cr2 -> e2 -> cr1 -> e1, if nothing else in the plan depends on cr1, that column reference would be omitted and the final structure would be cr2 -> e2 -> e1. If another expression did depend on cr1, then there would be two separate chains: cr2 -> e2 -> e1 and cr1 -> e1.
Constructors
View SourceNormalizeColumnReferenceDependencies(ILogger)
Declaration
public NormalizeColumnReferenceDependencies(ILogger logger)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger |
Methods
View SourceColumnReferencesWithChildrenOnSameTable(IEnumerable<Expression>)
Declaration
public static ISet<string> ColumnReferencesWithChildrenOnSameTable(IEnumerable<Expression> expressions)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Expression> | expressions |
Returns
Type | Description |
---|---|
ISet<String> |
TransformWithTracing(MetricsPlan, IMetricsPlanValidator)
Declaration
public override MetricsPlan TransformWithTracing(MetricsPlan plan, IMetricsPlanValidator validator)
Parameters
Type | Name | Description |
---|---|---|
MetricsPlan | plan | |
IMetricsPlanValidator | validator |
Returns
Type | Description |
---|---|
MetricsPlan |