The QueryResultSet interface used from PlanRootSink operates on a row at a time and is inefficient and inelegant. We can improve code readability by moving some logic from PlanRootSink to QueryResultSet and improve perf if we switch to an interface that allows appending a batch.
This will make
IMPALA-4268 incrementally easier.
There are some TODOs in the code related to this.