/** * Gets whether to skip resetting the sequence id for cells. * @param skipResetSeqId The byte array of boolean. * @return Whether to skip resetting the sequence id. */ private boolean isSkipResetSeqId(byte[] skipResetSeqId) { if (skipResetSeqId != null && skipResetSeqId.length == 1) { return Bytes.toBoolean(skipResetSeqId); } return false; }
/** * @return True if this Scan is in "raw" mode. */ public boolean isRaw() { byte[] attr = getAttribute(RAW_ATTR); return attr == null ? false : Bytes.toBoolean(attr); }
/** * @return True if collection of scan metrics is enabled. For advanced users. */ public boolean isScanMetricsEnabled() { byte[] attr = getAttribute(Scan.SCAN_ATTRIBUTES_METRICS_ENABLE); return attr == null ? false : Bytes.toBoolean(attr); }
public boolean isRpcThrottleEnabled() throws IOException { try { byte[] upData = ZKUtil.getData(zookeeper, rpcThrottleZNode); return upData == null || Bytes.toBoolean(upData); } catch (KeeperException | InterruptedException e) { throw new IOException("Failed to get rpc throttle", e); } }
/** * Indicates whether the scan contains the information of caching blocks. * The information is set in the attribute "hbase.mob.cache.blocks" of scan. * @param scan The current scan. * @return True when the Scan attribute specifies to cache the MOB blocks. */ public static boolean isCacheMobBlocks(Scan scan) { byte[] cache = scan.getAttribute(MobConstants.MOB_CACHE_BLOCKS); try { return cache != null && Bytes.toBoolean(cache); } catch (IllegalArgumentException e) { return false; } }
/** * Indicates whether return null value when the mob file is missing or corrupt. * The information is set in the attribute "empty.value.on.mobcell.miss" of scan. * @param scan The current scan. * @return True if the readEmptyValueOnMobCellMiss is enabled. */ public static boolean isReadEmptyValueOnMobCellMiss(Scan scan) { byte[] readEmptyValueOnMobCellMiss = scan.getAttribute(MobConstants.EMPTY_VALUE_ON_MOBCELL_MISS); try { return readEmptyValueOnMobCellMiss != null && Bytes.toBoolean(readEmptyValueOnMobCellMiss); } catch (IllegalArgumentException e) { return false; } }
/** * Indicates whether it's a reference only scan. * The information is set in the attribute "hbase.mob.scan.ref.only" of scan. * If it's a ref only scan, only the cells with ref tag are returned. * @param scan The current scan. * @return True if it's a ref only scan. */ public static boolean isRefOnlyScan(Scan scan) { byte[] refOnly = scan.getAttribute(MobConstants.MOB_SCAN_REF_ONLY); try { return refOnly != null && Bytes.toBoolean(refOnly); } catch (IllegalArgumentException e) { return false; } }
/** * Indicates whether it's a raw scan. * The information is set in the attribute "hbase.mob.scan.raw" of scan. * For a mob cell, in a normal scan the scanners retrieves the mob cell from the mob file. * In a raw scan, the scanner directly returns cell in HBase without retrieve the one in * the mob file. * @param scan The current scan. * @return True if it's a raw scan. */ public static boolean isRawMobScan(Scan scan) { byte[] raw = scan.getAttribute(MobConstants.MOB_SCAN_RAW); try { return raw != null && Bytes.toBoolean(raw); } catch (IllegalArgumentException e) { return false; } }
/** * @return current value for returnResults */ // Used by Increment and Append only. @InterfaceAudience.Private protected boolean isReturnResults() { byte[] v = getAttribute(RETURN_RESULTS); return v == null ? true : Bytes.toBoolean(v); }
public static String format(final String value, final Unit unit) { StringBuilder human = new StringBuilder(); switch (unit) { case TIME_INTERVAL: human.append(humanReadableTTL(Long.parseLong(value))); break; case LONG: byte[] longBytes = Bytes.toBytesBinary(value); human.append(String.valueOf(Bytes.toLong(longBytes))); break; case BOOLEAN: byte[] booleanBytes = Bytes.toBytesBinary(value); human.append(String.valueOf(Bytes.toBoolean(booleanBytes))); break; default: human.append(value); } return human.toString(); }
return Bytes.toDouble(value); case 8: return Bytes.toBoolean(value); case 9: // sql.Timestamp encoded as long return new Timestamp(Bytes.toLong(value));
@Override public long getOldestHfileTs(boolean majorCompactionOnly) throws IOException { long result = Long.MAX_VALUE; for (HStore store : stores.values()) { Collection<HStoreFile> storeFiles = store.getStorefiles(); if (storeFiles == null) { continue; } for (HStoreFile file : storeFiles) { StoreFileReader sfReader = file.getReader(); if (sfReader == null) { continue; } HFile.Reader reader = sfReader.getHFileReader(); if (reader == null) { continue; } if (majorCompactionOnly) { byte[] val = reader.loadFileInfo().get(MAJOR_COMPACTION_KEY); if (val == null || !Bytes.toBoolean(val)) { continue; } } result = Math.min(result, reader.getFileContext().getFileCreateTime()); } } return result == Long.MAX_VALUE ? 0 : result; }
|| Bytes.equals(e.getKey(), FileInfo.TAGS_COMPRESSED) || Bytes.equals(e.getKey(), HStoreFile.EXCLUDE_FROM_MINOR_COMPACTION_KEY)) { out.println(Bytes.toBoolean(e.getValue())); } else if (Bytes.equals(e.getKey(), FileInfo.LASTKEY)) { out.println(new KeyValue.KeyOnlyKeyValue(e.getValue()).toString());
res = Bytes.toBoolean(bytes);
res = Bytes.toShort(bytes); } else if (Boolean.class == clazz || boolean.class == clazz) { res = Bytes.toBoolean(bytes); } else if (Float.class == clazz || float.class == clazz) { res = Bytes.toFloat(bytes);
private void verify(final Table table) throws IOException { Scan scan = new Scan(); scan.addColumn(FAMILY_NAME, COLUMN_NAME); scan.setMaxVersions(1); ResultScanner scanner = table.getScanner(scan); for (Result r: scanner) { for (Cell kv : r.listCells()) { log.debug(Bytes.toString(r.getRow()) + "\t" + Bytes.toString(CellUtil.cloneFamily(kv)) + "\t" + Bytes.toString(CellUtil.cloneQualifier(kv)) + "\t" + kv.getTimestamp() + "\t" + Bytes.toBoolean(CellUtil.cloneValue(kv))); org.junit.Assert.assertEquals(TIMESTAMP.get(kv.getTimestamp()), Bytes.toBoolean(CellUtil.cloneValue(kv))); } } scanner.close(); }
/** * @return True if this Scan is in "raw" mode. */ public boolean isRaw() { byte[] attr = getAttribute(RAW_ATTR); return attr == null ? false : Bytes.toBoolean(attr); }
/** * @return current value for returnResults */ // Used by Increment and Append only. @InterfaceAudience.Private protected boolean isReturnResults() { byte[] v = getAttribute(RETURN_RESULTS); return v == null ? true : Bytes.toBoolean(v); }
hfileContext.setIncludesTags(true); tmp = fileInfo.get(FileInfo.TAGS_COMPRESSED); if (tmp != null && Bytes.toBoolean(tmp)) { hfileContext.setCompressTags(true);