Interface IAggregationCommand
Commands for specifying predefined column aggregation functions (Average, Count,
CountDistinct, CountRows, First, Last, Max, Min
and Sum) and columns for use with several AggregateTransformFactory members.
Also see the examples in Dataflow Aggregations.
Inherited Members
Namespace: actionETL
Assembly: actionETL.dll
Syntax
public interface IAggregationCommand : IFluentInterface
Remarks
The aggregation functions follow the SQL-92 standard:
- Aggregation without grouping will always produce one output row, including for an empty input set
-
On an empty input set,
Countaggregations return0, whereas the other aggregations returnnull - With grouping, an empty input set will not produce any output rows
-
Countaggregations support nullable input column types. Non-Countaggregations support nullable input column value types if both input and output columns are nullable. -
nullinput column values are not included in aggregations (CountRowshowever doesn't look at input column values at all) -
If the aggregation result type (usually the same as the input column type), can be implicitly cast to the
output column type, then they can have different types, e.g.
longtodouble -
SumandAverageadditions are checked for overflow,Countadditions are not
Methods
Average(String)
Calculates the average of a numerical column. Any nulls are ignored.
Declaration
IAggregationCommand Average(string columnName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | columnName | Name of the input and output columns. |
Returns
| Type | Description |
|---|---|
| IAggregationCommand | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
Average(String, String)
Calculates the average of a numerical column. Any nulls are ignored.
Declaration
IAggregationCommand Average(string inputColumnName, string outputColumnName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | inputColumnName | Name of the input column. |
| String | outputColumnName | Name of the output column. |
Returns
| Type | Description |
|---|---|
| IAggregationCommand | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
Count(String)
Calculates the number of non-null values in a column.
Declaration
IAggregationCommand Count(string columnName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | columnName | Name of the input and output columns. |
Returns
| Type | Description |
|---|---|
| IAggregationCommand | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
Count(String, String)
Calculates the number of non-null values in a column.
Declaration
IAggregationCommand Count(string inputColumnName, string outputColumnName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | inputColumnName | Name of the input column. |
| String | outputColumnName | Name of the output column. |
Returns
| Type | Description |
|---|---|
| IAggregationCommand | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
CountDistinct(String)
Calculates the number of distinct non-null values in a column.
Note that by default on .NET Framework, maximum array size is 2GB, which in turn with a 64-bit application limits the number of unique groupings to a maximum of 47.9 million, and the CountDistinct(String) number of distinct values per column to a maximum of just over 89 million. You can remove these limits by enabling support for larger arrays, as described in <gcAllowVeryLargeObjects> Element.
.NET 6+ on the other hand supports >2GB arrays by default.
Declaration
IAggregationCommand CountDistinct(string columnName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | columnName | Name of the input and output columns. |
Returns
| Type | Description |
|---|---|
| IAggregationCommand | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
CountDistinct(String, String)
Calculates the number of distinct non-null values in a column.
Note that by default on .NET Framework, maximum array size is 2GB, which in turn with a 64-bit application limits the number of unique groupings to a maximum of 47.9 million, and the CountDistinct(String, String) number of distinct values per column to a maximum of just over 89 million. You can remove these limits by enabling support for larger arrays, as described in <gcAllowVeryLargeObjects> Element.
.NET 6+ on the other hand supports >2GB arrays by default.
Declaration
IAggregationCommand CountDistinct(string inputColumnName, string outputColumnName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | inputColumnName | Name of the input column. |
| String | outputColumnName | Name of the output column. |
Returns
| Type | Description |
|---|---|
| IAggregationCommand | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
CountRows(String)
Calculates the number of incoming rows. Note that this can include rows with null column values.
Declaration
IAggregationCommand CountRows(string outputColumnName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | outputColumnName | Name of the output column. |
Returns
| Type | Description |
|---|---|
| IAggregationCommand | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
First(String)
Sets the column value from the first row.
Declaration
IAggregationCommand First(string columnName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | columnName | Name of the input and output columns. |
Returns
| Type | Description |
|---|---|
| IAggregationCommand | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
First(String, String)
Sets the column value from the first row.
Declaration
IAggregationCommand First(string inputColumnName, string outputColumnName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | inputColumnName | Name of the input column. |
| String | outputColumnName | Name of the output column. |
Returns
| Type | Description |
|---|---|
| IAggregationCommand | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
Last(String)
Sets the column value from the last row.
Declaration
IAggregationCommand Last(string columnName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | columnName | Name of the input and output columns. |
Returns
| Type | Description |
|---|---|
| IAggregationCommand | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
Last(String, String)
Sets the column value from the last row.
Declaration
IAggregationCommand Last(string inputColumnName, string outputColumnName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | inputColumnName | Name of the input column. |
| String | outputColumnName | Name of the output column. |
Returns
| Type | Description |
|---|---|
| IAggregationCommand | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
Max(String)
Calculates the maximum value in a numerical column. Any nulls are ignored.
Declaration
IAggregationCommand Max(string columnName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | columnName | Name of the input and output columns. |
Returns
| Type | Description |
|---|---|
| IAggregationCommand | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
Max(String, String)
Calculates the maximum value in a numerical column. Any nulls are ignored.
Declaration
IAggregationCommand Max(string inputColumnName, string outputColumnName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | inputColumnName | Name of the input column. |
| String | outputColumnName | Name of the output column. |
Returns
| Type | Description |
|---|---|
| IAggregationCommand | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
Min(String)
Calculates the minimum value in a numerical column. Any nulls are ignored.
Declaration
IAggregationCommand Min(string columnName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | columnName | Name of the input and output columns. |
Returns
| Type | Description |
|---|---|
| IAggregationCommand | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
Min(String, String)
Calculates the minimum value in a numerical column. Any nulls are ignored.
Declaration
IAggregationCommand Min(string inputColumnName, string outputColumnName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | inputColumnName | Name of the input column. |
| String | outputColumnName | Name of the output column. |
Returns
| Type | Description |
|---|---|
| IAggregationCommand | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
Sum(String)
Calculates the sum of a numerical column. Any nulls are ignored.
Declaration
IAggregationCommand Sum(string columnName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | columnName | Name of the input and output columns. |
Returns
| Type | Description |
|---|---|
| IAggregationCommand | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
Sum(String, String)
Calculates the sum of a numerical column. Any nulls are ignored.
Declaration
IAggregationCommand Sum(string inputColumnName, string outputColumnName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | inputColumnName | Name of the input column. |
| String | outputColumnName | Name of the output column. |
Returns
| Type | Description |
|---|---|
| IAggregationCommand | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|