just one loop in ntile
correct handling of AN in row_number. additional test for grouped case. closes #774