@ReadOnly @Override public Row get(byte[] row, byte[] startColumn, byte[] stopColumn, int limit) { ensureTransactionIsStarted(); reportRead(1); // checking if the row was deleted inside this tx NavigableMap<byte[], Update> buffCols = buff.get(row); // NOTE: since we cannot tell the exact column set, we always have to go to persisted store. // potential improvement: do not fetch columns available in in-mem buffer (we know them at this point) try { Map<byte[], byte[]> persistedCols = getPersisted(row, startColumn, stopColumn, limit); // adding server cols, and then overriding with buffered values NavigableMap<byte[], byte[]> result = Maps.newTreeMap(Bytes.BYTES_COMPARATOR); if (persistedCols != null) { result.putAll(persistedCols); } if (buffCols != null) { buffCols = getRange(buffCols, startColumn, stopColumn, limit); // null valued columns in in-memory buffer are deletes, so we need to delete them from the result list mergeToPersisted(result, buffCols, null); } // applying limit return new Result(row, head(result, limit)); } catch (Exception e) { LOG.debug("get failed for table: " + getTransactionAwareName() + ", row: " + Bytes.toStringBinary(row), e); throw new DataSetException("get failed", e); } }
@ReadOnly @Override public Row get(byte[] row, byte[] startColumn, byte[] stopColumn, int limit) { ensureTransactionIsStarted(); reportRead(1); // checking if the row was deleted inside this tx NavigableMap<byte[], Update> buffCols = buff.get(row); // NOTE: since we cannot tell the exact column set, we always have to go to persisted store. // potential improvement: do not fetch columns available in in-mem buffer (we know them at this point) try { Map<byte[], byte[]> persistedCols = getPersisted(row, startColumn, stopColumn, limit); // adding server cols, and then overriding with buffered values NavigableMap<byte[], byte[]> result = Maps.newTreeMap(Bytes.BYTES_COMPARATOR); if (persistedCols != null) { result.putAll(persistedCols); } if (buffCols != null) { buffCols = getRange(buffCols, startColumn, stopColumn, limit); // null valued columns in in-memory buffer are deletes, so we need to delete them from the result list mergeToPersisted(result, buffCols, null); } // applying limit return new Result(row, head(result, limit)); } catch (Exception e) { LOG.debug("get failed for table: " + getTransactionAwareName() + ", row: " + Bytes.toStringBinary(row), e); throw new DataSetException("get failed", e); } }