(VectorizedRowBatch batch)
| 729 | } |
| 730 | |
| 731 | @Override |
| 732 | public void addRowBatch(VectorizedRowBatch batch) throws IOException { |
| 733 | try { |
| 734 | // If this is the first set of rows in this stripe, tell the tree writers |
| 735 | // to prepare the stripe. |
| 736 | if (batch.size != 0 && rowsInStripe == 0) { |
| 737 | treeWriter.prepareStripe(stripes.size() + 1); |
| 738 | } |
| 739 | if (buildIndex) { |
| 740 | // Batch the writes up to the rowIndexStride so that we can get the |
| 741 | // right size indexes. |
| 742 | int posn = 0; |
| 743 | while (posn < batch.size) { |
| 744 | int chunkSize = Math.min(batch.size - posn, |
| 745 | rowIndexStride - rowsInIndex); |
| 746 | if (batch.isSelectedInUse()) { |
| 747 | // find the longest chunk that is continuously selected from posn |
| 748 | for (int len = 1; len < chunkSize; ++len) { |
| 749 | if (batch.selected[posn + len] - batch.selected[posn] != len) { |
| 750 | chunkSize = len; |
| 751 | break; |
| 752 | } |
| 753 | } |
| 754 | treeWriter.writeRootBatch(batch, batch.selected[posn], chunkSize); |
| 755 | } else { |
| 756 | treeWriter.writeRootBatch(batch, posn, chunkSize); |
| 757 | } |
| 758 | posn += chunkSize; |
| 759 | rowsInIndex += chunkSize; |
| 760 | rowsInStripe += chunkSize; |
| 761 | if (rowsInIndex >= rowIndexStride) { |
| 762 | createRowIndexEntry(); |
| 763 | } |
| 764 | } |
| 765 | } else { |
| 766 | if (batch.isSelectedInUse()) { |
| 767 | int posn = 0; |
| 768 | while (posn < batch.size) { |
| 769 | int chunkSize = 1; |
| 770 | while (posn + chunkSize < batch.size) { |
| 771 | // find the longest chunk that is continuously selected from posn |
| 772 | if (batch.selected[posn + chunkSize] - batch.selected[posn] != chunkSize) { |
| 773 | break; |
| 774 | } |
| 775 | ++chunkSize; |
| 776 | } |
| 777 | treeWriter.writeRootBatch(batch, batch.selected[posn], chunkSize); |
| 778 | posn += chunkSize; |
| 779 | } |
| 780 | } else { |
| 781 | treeWriter.writeRootBatch(batch, 0, batch.size); |
| 782 | } |
| 783 | rowsInStripe += batch.size; |
| 784 | } |
| 785 | rowsSinceCheck += batch.size; |
| 786 | previousAllocation = memoryManager.checkMemory(previousAllocation, this); |
| 787 | checkMemory(); |
| 788 | } catch (Throwable t) { |
nothing calls this directly
no test coverage detected