public Map<byte[], byte[]> loadFileInfo() throws IOException { Map<byte [], byte []> fi = reader.loadFileInfo(); byte[] b = fi.get(BLOOM_FILTER_TYPE_KEY); if (b != null) { bloomFilterType = BloomType.valueOf(Bytes.toString(b)); } lastBloomKey = fi.get(LAST_BLOOM_KEY); byte[] cnt = fi.get(DELETE_FAMILY_COUNT); if (cnt != null) { deleteFamilyCnt = Bytes.toLong(cnt); } return fi; }
/** * @return bloom filter type used for new StoreFiles in ColumnFamily */ public StoreFile.BloomType getBloomFilterType() { String n = getValue(BLOOMFILTER); if (n == null) { n = DEFAULT_BLOOMFILTER; } return StoreFile.BloomType.valueOf(n.toUpperCase()); }
columnDescriptor.setBlocksize(Integer.parseInt(blockSize)); if(bloomFilter != null) columnDescriptor.setBloomFilterType(BloomType.valueOf(bloomFilter)); if(maxVersions != null) columnDescriptor.setMaxVersions(Integer.parseInt(maxVersions));
/** * This utility method creates a new Hbase HColumnDescriptor object based on a * Thrift ColumnDescriptor "struct". * * @param in * Thrift ColumnDescriptor object * @return HColumnDescriptor * @throws IllegalArgument */ static public HColumnDescriptor colDescFromThrift(ColumnDescriptor in) throws IllegalArgument { Compression.Algorithm comp = Compression.getCompressionAlgorithmByName(in.compression.toLowerCase()); StoreFile.BloomType bt = BloomType.valueOf(in.bloomFilterType); if (in.name == null || !in.name.hasRemaining()) { throw new IllegalArgument("column name is empty"); } byte [] parsedName = KeyValue.parseColumn(Bytes.getBytes(in.name))[0]; HColumnDescriptor col = new HColumnDescriptor(parsedName) .setMaxVersions(in.maxVersions) .setCompressionType(comp) .setInMemory(in.inMemory) .setBlockCacheEnabled(in.blockCacheEnabled) .setTimeToLive(in.timeToLive) .setBloomFilterType(bt); return col; }
private WriterLength getNewWriter(byte[] family, Configuration conf) throws IOException { WriterLength wl = new WriterLength(); Path familydir = new Path(outputdir, Bytes.toString(family)); String compression = compressionMap.get(family); compression = compression == null ? defaultCompression : compression; String bloomTypeStr = bloomTypeMap.get(family); BloomType bloomType = BloomType.NONE; if (bloomTypeStr != null) { bloomType = BloomType.valueOf(bloomTypeStr); } Configuration tempConf = new Configuration(conf); tempConf.setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0.0f); wl.writer = new StoreFile.WriterBuilder(conf, new CacheConfig(tempConf), fs, blocksize) .withOutputDir(familydir) .withCompression(AbstractHFileWriter.compressionByName(compression)) .withBloomType(bloomType) .withComparator(KeyValue.COMPARATOR) .withDataBlockEncoder(encoder) .withChecksumType(Store.getChecksumType(conf)) .withBytesPerChecksum(Store.getBytesPerChecksum(conf)) .build(); this.writers.put(family, wl); return wl; }
public static ColumnFamilyConfig buildCfConfig(Conf conf) { ColumnFamilyConfig family = new ColumnFamilyConfig(); String compression = conf.getChild("compression").getValue(null); if (compression != null) { family.setCompression(Compression.Algorithm.valueOf(compression.toUpperCase())); } String bloomFilter = conf.getChild("bloomFilter").getValue(null); if (bloomFilter != null) { family.setBoomFilter(StoreFile.BloomType.valueOf(bloomFilter.toUpperCase())); } Integer blockSize = conf.getChild("blockSize").getValueAsInteger(null); if (blockSize != null) { family.setBlockSize(blockSize); } return family; } }