The execution plan erroneously computes separate
ANYaggregates for the
c3columns, ignoring nulls. Each aggregate independently returns the first non-null value it encounters, giving a result where the values for
c3come from different source rows. This is not what the original SQL query specification requested.
The same wrong result can be produced with or without the clustered index by adding an
OPTION (HASH GROUP)hint to produce a plan with an Eager Hash Aggregate instead of a Stream Aggregate.
Click through for the scenarios. Paul has also reported the second scenario as a bug.