### Question:
VirtualColumnStore extends AbstractColumnStore { public ColumnIterator getRows(SimpleColumnCombination activeColumns) { this.initHashCaches(); try { return new VirtualColumnStore.ColumnIterator(this.inputGenerator.generateNewCopy(), activeColumns); } catch (Exception e) { throw new RuntimeException(e); } } VirtualColumnStore(int numColumns, int sampleGoal, RelationalInputGenerator inputGenerator, boolean isCloseConnectionsRigorously); ColumnIterator getRows(SimpleColumnCombination activeColumns); static VirtualColumnStore[] create(RelationalInputGenerator[] fileInputGenerators, int sampleGoal, boolean isCloseConnectionsRigorously);  }### Answer:
@Test public void testGetRows() throws Exception { rb.setHeader("col1", "col2", "col3") .addRow("a", "a", "b") .addRow("1", "2", "2"); VirtualColumnStore cs = createColumnStore(rb.build()); ColumnIterator rows = cs.getRows(); long[] row = rows.next(); assertThat(row[0], equalTo(row[1])); assertThat(row[0], not(equalTo(row[2]))); row = rows.next(); assertThat(row[0], not(equalTo(row[1]))); assertThat(row[1], equalTo(row[2])); assertThat(rows.hasNext(), is(false)); }
@Test public void testHasNextTwice() throws Exception { rb.setHeader("col1", "col2").addRow("a", "a"); VirtualColumnStore cs = createColumnStore(rb.build()); ColumnIterator rows = cs.getRows(); assertThat(rows.hasNext(), is(true)); assertThat(rows.hasNext(), is(true)); long[] row = rows.next(); assertThat(row[0], equalTo(row[1])); assertThat(rows.hasNext(), is(false)); assertThat(rows.hasNext(), is(false)); assertThat(rows.hasNext(), is(false)); }
@Test public void testHashCache() throws Exception { rb.setHeader("col1").addRow("a").addRow("a"); VirtualColumnStore cs = createColumnStore(rb.build()); ColumnIterator rows = cs.getRows(); assertThat(rows.hasNext(), is(true)); long[] row1 = rows.next().clone(); assertThat(rows.hasNext(), is(true)); long[] row2 = rows.next().clone(); assertThat(row1[0], equalTo(row2[0])); assertThat(rows.hasNext(), is(false)); }
@Test public void testGetLongRows() throws Exception { int count = 500_000; rb.setHeader("long_col"); for (int i = 0; i < count; i++) { rb.addRow(Integer.toString(i)); } VirtualColumnStore cs = createColumnStore(rb.build()); ColumnIterator rows = cs.getRows(); HashFunction hashFunction = Hashing.murmur3_128(); int i = 0; while (rows.hasNext()) { long[] row = rows.next(); long hash = hashFunction.hashString(Integer.toString(i), Charsets.UTF_8).asLong(); assertThat("rowindex: " + i, row[0], equalTo(hash)); i++; } assertThat(i, equalTo(count)); }