Fix 1D distinct aggregation when aggregation attr is a ref + add logging