package metric
Type Members
-
case class
IncrementMetric(child: Expression, metric: SQLMetric) extends UnaryExpression with Nondeterministic with Product with Serializable
IncrementMetric is used to count the number of rows passing through it.
IncrementMetric is used to count the number of rows passing through it. It can be used to wrap a child expression to count the number of rows. Its currently only accessible via the Scala DSL.
For example, consider the following expression returning a string literal: If(SomeCondition, IncrementMetric(Literal("ValueIfTrue"), countTrueMetric), IncrementMetric(Literal("ValueIfFalse"), countFalseMetric))
The SQLMetric
countTrueMetricwould be incremented whenever the conditionSomeConditionis true, and converselycountFalseMetricwould be incremented whenever the condition is false.The expression does not really compute anything, and merely forwards the value computed by the child expression.
It is marked as non deterministic to ensure that it retains strong affinity with the
childexpression, so as to accurately update themetric.It takes the following parameters:
- child
is the actual expression to call.
- metric
is the SQLMetric to increment.
- Annotations
- @ExpressionDescription()