public Reader.Location getLocationByRecordNum(long recNum) { int idx = Utils.upperBound(recordNumIndex, recNum); long lastRecNum = (idx == 0)? 0: recordNumIndex.get(idx-1); return new Reader.Location(idx, recNum-lastRecNum); }
/** * if greater is true then returns the beginning location of the block * containing the key strictly greater than input key. if greater is false * then returns the beginning location of the block greater than equal to * the input key * * @param key * the input key * @param greater * boolean flag * @return * @throws IOException */ Location getBlockContainsKey(RawComparable key, boolean greater) throws IOException { if (!isSorted()) { throw new RuntimeException("Seeking in unsorted TFile"); } checkTFileDataIndex(); int blkIndex = (greater) ? tfileIndex.upperBound(key) : tfileIndex.lowerBound(key); if (blkIndex < 0) return end; return new Location(blkIndex, 0); }
/** * Get the location pointing to the beginning of the first key-value pair in * a compressed block whose byte offset in the TFile is greater than or * equal to the specified offset. * * @param offset * the user supplied offset. * @return the location to the corresponding entry; or end() if no such * entry exists. */ Location getLocationNear(long offset) { int blockIndex = readerBCF.getBlockIndexNear(offset); if (blockIndex == -1) return end; return new Location(blockIndex, 0); }
/** * Get the location pointing to the beginning of the first key-value pair in * a compressed block whose byte offset in the TFile is greater than or * equal to the specified offset. * * @param offset * the user supplied offset. * @return the location to the corresponding entry; or end() if no such * entry exists. */ Location getLocationNear(long offset) { int blockIndex = readerBCF.getBlockIndexNear(offset); if (blockIndex == -1) return end; return new Location(blockIndex, 0); }
/** * Get the location pointing to the beginning of the first key-value pair in * a compressed block whose byte offset in the TFile is greater than or * equal to the specified offset. * * @param offset * the user supplied offset. * @return the location to the corresponding entry; or end() if no such * entry exists. */ Location getLocationNear(long offset) { int blockIndex = readerBCF.getBlockIndexNear(offset); if (blockIndex == -1) return end; return new Location(blockIndex, 0); }
/** * Get the location pointing to the beginning of the first key-value pair in * a compressed block whose byte offset in the TFile is greater than or * equal to the specified offset. * * @param offset * the user supplied offset. * @return the location to the corresponding entry; or end() if no such * entry exists. */ Location getLocationNear(long offset) { int blockIndex = readerBCF.getBlockIndexNear(offset); if (blockIndex == -1) return end; return new Location(blockIndex, 0); }
/** * @see java.lang.Object#clone() */ @Override protected Location clone() { return new Location(blockIndex, recordIndex); }
public Reader.Location getLocationByRecordNum(long recNum) { int idx = Utils.upperBound(recordNumIndex, recNum); long lastRecNum = (idx == 0)? 0: recordNumIndex.get(idx-1); return new Reader.Location(idx, recNum-lastRecNum); }
/** * @see java.lang.Object#clone() */ @Override protected Location clone() { return new Location(blockIndex, recordIndex); }
public Reader.Location getLocationByRecordNum(long recNum) { int idx = Utils.upperBound(recordNumIndex, recNum); long lastRecNum = (idx == 0)? 0: recordNumIndex.get(idx-1); return new Reader.Location(idx, recNum-lastRecNum); }
public Reader.Location getLocationByRecordNum(long recNum) { int idx = Utils.upperBound(recordNumIndex, recNum); long lastRecNum = (idx == 0)? 0: recordNumIndex.get(idx-1); return new Reader.Location(idx, recNum-lastRecNum); }
/** * @see java.lang.Object#clone() */ @Override protected Location clone() { return new Location(blockIndex, recordIndex); }
public Reader.Location getLocationByRecordNum(long recNum) { int idx = Utils.upperBound(recordNumIndex, recNum); long lastRecNum = (idx == 0)? 0: recordNumIndex.get(idx-1); return new Reader.Location(idx, recNum-lastRecNum); }
/** * @see java.lang.Object#clone() */ @Override protected Location clone() { return new Location(blockIndex, recordIndex); }
public Reader.Location getLocationByRecordNum(long recNum) { int idx = Utils.upperBound(recordNumIndex, recNum); long lastRecNum = (idx == 0)? 0: recordNumIndex.get(idx-1); return new Reader.Location(idx, recNum-lastRecNum); }
/** * @see java.lang.Object#clone() */ @Override protected Location clone() { return new Location(blockIndex, recordIndex); }
/** * Constructor * * @param fsdis * FS input stream of the TFile. * @param fileLength * The length of TFile. This is required because we have no easy * way of knowing the actual size of the input file through the * File input stream. * @param conf * @throws IOException */ public Reader(FSDataInputStream fsdis, long fileLength, Configuration conf) throws IOException { readerBCF = new BCFile.Reader(fsdis, fileLength, conf); // first, read TFile meta BlockReader brMeta = readerBCF.getMetaBlock(TFileMeta.BLOCK_NAME); try { tfileMeta = new TFileMeta(brMeta); } finally { brMeta.close(); } comparator = tfileMeta.getComparator(); // Set begin and end locations. begin = new Location(0, 0); end = new Location(readerBCF.getBlockCount(), 0); }
/** * Get the location pointing to the beginning of the first key-value pair in * a compressed block whose byte offset in the TFile is greater than or * equal to the specified offset. * * @param offset * the user supplied offset. * @return the location to the corresponding entry; or end() if no such * entry exists. */ Location getLocationNear(long offset) { int blockIndex = readerBCF.getBlockIndexNear(offset); if (blockIndex == -1) return end; return new Location(blockIndex, 0); }
/** * @see java.lang.Object#clone() */ @Override protected Location clone() { return new Location(blockIndex, recordIndex); }