I found the same problem. I tried a diferent and simple solution:
I first load all my rows in a Queue, once i have them all in the queue i can know the number of rows from the Queue. Now i can use that data to construct whatever i need and then i proceed to dequeue all items and use them properly.