[WIP][SPARK-2554][SQL] CountDistinct and SumDistinct should do partial aggregation

Should be `left.references ++ right.references` or `children.flatMap(_.references).toSet` ?