Insanely inefficient and ugly way of advancing the cursors
()
| 1799 | |
| 1800 | /** Insanely inefficient and ugly way of advancing the cursors */ |
| 1801 | private void advance() { |
| 1802 | // first time to get the ceiling |
| 1803 | if (last_row == null) { |
| 1804 | for (final Entry<byte[], |
| 1805 | Iterator<Entry<byte[], ByteMap<TreeMap<Long, byte[]>>>>> iterator : |
| 1806 | cursors.entrySet()) { |
| 1807 | final Entry<byte[], ByteMap<TreeMap<Long, byte[]>>> row = |
| 1808 | iterator.getValue().hasNext() ? iterator.getValue().next() : null; |
| 1809 | cf_rows.put(iterator.getKey(), row); |
| 1810 | if (last_row == null) { |
| 1811 | last_row = row.getKey(); |
| 1812 | } else { |
| 1813 | if (Bytes.memcmp(last_row, row.getKey()) < 0) { |
| 1814 | last_row = row.getKey(); |
| 1815 | } |
| 1816 | } |
| 1817 | } |
| 1818 | return; |
| 1819 | } |
| 1820 | |
| 1821 | for (final Entry<byte[], Entry<byte[], ByteMap<TreeMap<Long, byte[]>>>> cf : |
| 1822 | cf_rows.entrySet()) { |
| 1823 | final Entry<byte[], ByteMap<TreeMap<Long, byte[]>>> row = cf.getValue(); |
| 1824 | if (row == null) { |
| 1825 | continue; |
| 1826 | } |
| 1827 | |
| 1828 | if (Bytes.memcmp(last_row, row.getKey()) == 0) { |
| 1829 | if (!cursors.get(cf.getKey()).hasNext()) { |
| 1830 | cf_rows.put(cf.getKey(), null); // EX? |
| 1831 | } else { |
| 1832 | cf_rows.put(cf.getKey(), cursors.get(cf.getKey()).next()); |
| 1833 | } |
| 1834 | } |
| 1835 | } |
| 1836 | |
| 1837 | last_row = null; |
| 1838 | for (final Entry<byte[], ByteMap<TreeMap<Long, byte[]>>> row : |
| 1839 | cf_rows.values()) { |
| 1840 | if (row == null) { |
| 1841 | continue; |
| 1842 | } |
| 1843 | |
| 1844 | if (last_row == null) { |
| 1845 | last_row = row.getKey(); |
| 1846 | } else { |
| 1847 | if (Bytes.memcmp(last_row, row.getKey()) < 0) { |
| 1848 | last_row = row.getKey(); |
| 1849 | } |
| 1850 | } |
| 1851 | } |
| 1852 | } |
| 1853 | |
| 1854 | /** @return The scanner for this mock */ |
| 1855 | public Scanner getScanner() { |