@Override protected final void setUp() throws IOException { data = new TreeMap<>(new ByteComparator().toBytesComparator()); for (int i = 0; i < 100; i++) { data.put(wrapInt(i), wrapInt(i)); } reader = createReader(data); }
@Override public int compare(byte[] r, int rOff, int rLen, byte[] l, int lOff, int lLen) { return compareBytes(r, rOff, rLen, l, lOff, lLen); }
@Override public int compare(byte[] rhs, byte[] lhs) { return compare(rhs, 0, rhs.length, lhs, 0, lhs.length); }
public SortedOplogConfiguration(String name, BlockCache blockCache, SortedOplogStatistics stats, HFileStoreStatistics storeStats) { this.name = name; this.stats = stats; // defaults bloom = true; blockSize = 1 << 16; bytesPerChecksum = 1 << 14; checksum = Checksum.NONE; compression = Compression.NONE; keyEncoding = KeyEncoding.NONE; comparator = new ByteComparator(); this.cacheDataBlocksOnRead = true; this.storeStats = storeStats; this.blockCache = blockCache; }
public IndexSerializedComparator() { primary = new LexicographicalComparator(); secondary = new ByteComparator(); }
@Override public int compare(byte[] r, int rOff, int rLen, byte[] l, int lOff, int lLen) { return compareBytes(r, rOff, rLen, l, lOff, lLen); }
public HFileSortedOplogWriter(int keys) throws IOException { try { int hfileBlockSize = Integer.getInteger( HoplogConfig.HFILE_BLOCK_SIZE_CONF, (1 << 16)); Algorithm compress = Algorithm.valueOf(System.getProperty(HoplogConfig.COMPRESSION, HoplogConfig.COMPRESSION_DEFAULT)); ByteComparator bc = new ByteComparator(); HFileContext hcontext = new HFileContextBuilder() .withBlockSize(hfileBlockSize) .withCompression(compress) .build(); writer = HFile.getWriterFactory(conf, cacheConf) .withPath(fsProvider.getFS(), path) .withFileContext(hcontext) .withComparator(bc) .create(); bfw = BloomFilterFactory.createGeneralBloomAtWrite(conf, cacheConf, BloomType.ROW, keys, writer); logger.fine("Created hoplog writer with compression " + compress); } catch (IOException e) { logger.fine("IO Error while creating writer"); throw e; } }
private ByteBuffer seekHigherKeyInIter(ByteBuffer key, HFileSortedIterator iter) throws IOException { ByteBuffer newK = iter.getKeyBB(); // remove all duplicates by incrementing iterator when a key is less than // equal to current key while (ByteComparator.compareBytes(newK.array(), newK.arrayOffset(), newK.remaining(), key.array(), key.arrayOffset(), key.remaining()) <= 0) { entriesRemaining--; if (iter.hasNext()) { newK = iter.nextBB(); } else { newK = null; break; } } return newK; }
private ByteBuffer seekHigherKeyInIter(ByteBuffer key, HFileSortedIterator iter) throws IOException { ByteBuffer newK = iter.getKeyBB(); // remove all duplicates by incrementing iterator when a key is less than // equal to current key while (ByteComparator.compareBytes(newK.array(), newK.arrayOffset(), newK.remaining(), key.array(), key.arrayOffset(), key.remaining()) <= 0) { entriesRemaining--; if (iter.hasNext()) { newK = iter.nextBB(); } else { newK = null; break; } } return newK; }
if (minKey == null || ByteComparator.compareBytes(tmpK.array(), tmpK.arrayOffset(), tmpK.remaining(), minKey.array(), minKey.arrayOffset(), minKey.remaining()) < 0) { minKey = tmpK; currentKey = tmpK;
if (minKey == null || ByteComparator.compareBytes(tmpK.array(), tmpK.arrayOffset(), tmpK.remaining(), minKey.array(), minKey.arrayOffset(), minKey.remaining()) < 0) { minKey = tmpK; currentKey = tmpK;
int compareOutput = ByteComparator.compareBytes( this.getRegionkey(), 0, this.getRegionkey().length, o.getRegionkey(), 0, o.getRegionkey().length); if (compareOutput != 0 )
int compareOutput = ByteComparator.compareBytes( this.getRegionkey(), 0, this.getRegionkey().length, o.getRegionkey(), 0, o.getRegionkey().length); if (compareOutput != 0 )