org.apache.hadoop.hbase.util.Bytes.toBoolean()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中org.apache.hadoop.hbase.util.Bytes.toBoolean()方法的一些代码示例,展示了Bytes.toBoolean()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.toBoolean()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.util.Bytes
类名称:Bytes
方法名:toBoolean

Bytes.toBoolean介绍

[英]Reverses #toBytes(boolean)
[中]反转#toBytes(布尔值)

代码示例

代码示例来源:origin: apache/hbase

/**
 * 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;
}

代码示例来源:origin: apache/hbase

/**
 * @return True if this Scan is in "raw" mode.
 */
public boolean isRaw() {
 byte[] attr = getAttribute(RAW_ATTR);
 return attr == null ? false : Bytes.toBoolean(attr);
}

代码示例来源:origin: apache/hbase

/**
 * @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);
}

代码示例来源:origin: apache/hbase

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);
 }
}

代码示例来源:origin: apache/hbase

/**
 * 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;
 }
}

代码示例来源:origin: apache/hbase

/**
 * 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;
 }
}

代码示例来源:origin: apache/hbase

/**
 * 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;
 }
}

代码示例来源:origin: apache/hbase

/**
 * 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;
 }
}

代码示例来源:origin: apache/hbase

/**
 * @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);
}

代码示例来源:origin: apache/hbase

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();
}

代码示例来源:origin: apache/flink

return Bytes.toDouble(value);
case 8:
  return Bytes.toBoolean(value);
case 9: // sql.Timestamp encoded as long
  return new Timestamp(Bytes.toLong(value));

代码示例来源:origin: apache/hbase

@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;
}

代码示例来源:origin: apache/hbase

|| 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());

代码示例来源:origin: alibaba/canal

res = Bytes.toBoolean(bytes);

代码示例来源:origin: alibaba/canal

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);

代码示例来源:origin: apache/hbase

boolean mc = Bytes.toBoolean(b);
 if (this.majorCompaction == null) {
  this.majorCompaction = new AtomicBoolean(mc);
this.excludeFromMinorCompaction = (b != null && Bytes.toBoolean(b));

代码示例来源:origin: apache/hbase

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();
}

代码示例来源:origin: org.apache.hbase/hbase-client

/**
 * @return True if this Scan is in "raw" mode.
 */
public boolean isRaw() {
 byte[] attr = getAttribute(RAW_ATTR);
 return attr == null ? false : Bytes.toBoolean(attr);
}

代码示例来源:origin: org.apache.hbase/hbase-client

/**
 * @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);
}

代码示例来源:origin: apache/hbase

hfileContext.setIncludesTags(true);
tmp = fileInfo.get(FileInfo.TAGS_COMPRESSED);
if (tmp != null && Bytes.toBoolean(tmp)) {
 hfileContext.setCompressTags(true);

相关文章

微信公众号

最新文章

更多