There may also be no first row, I guess that would kind of suck but maybe return 0 then. You can use rows.take(1) to get an empty list if no row exists.