CLR User-Defined Aggregate Properties Used by the Query Processor
A user-defined aggregate provides the query processor additional information about the properties of the aggregation algorithm. The query optimizer can use these properties (IsInvariantToDuplicates, IsInvariantToNulls, IsInvariantToOrder, and IsNullIfEmpty) to search for more efficient query execution plans. Specify properties as part of the SqlUserDefinedAggregate attribute definition on the type. By default, all of these properties are set to false.
Incorrectly setting the values of these properties can result in incorrect query results. These properties are not the same as optimizer hints; they affect the plan selected and the results returned by the query.
For a description of the SqlUserDefinedAggregate attribute properties, see Custom Attributes for CLR Routines.