org.apache.kylin.common.util.Dictionary.getIdFromValueBytes()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(158)

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

Dictionary.getIdFromValueBytes介绍

[英]Convenient form of getIdFromValueBytes(value, offset, len, 0)
[中]getIdFromValueBytes(value, offset, len, 0)的便捷形式

代码示例

代码示例来源:origin: org.apache.kylin/kylin-common

/**
 * Convenient form of
 * <code>getIdFromValueBytes(value, offset, len, 0)</code>
 */
final public int getIdFromValueBytes(byte[] value, int offset, int len) {
  return getIdFromValueBytes(value, offset, len, 0);
}

代码示例来源:origin: org.apache.kylin/kylin-cube

public void writeColumn(TblColRef column, byte[] value, int valueLen, int roundingFlag, byte dft, byte[] output, int outputOffset) {
  Dictionary<String> dict = getDictionary(column);
  int columnLen = getColumnLength(column);
  // non-dict value
  if (dict == null) {
    byte[] valueBytes = padFixLen(columnLen, value);
    System.arraycopy(valueBytes, 0, output, outputOffset, columnLen);
    return;
  }
  // dict value
  try {
    int id = dict.getIdFromValueBytes(value, 0, valueLen, roundingFlag);
    BytesUtil.writeUnsigned(id, output, outputOffset, dict.getSizeOfId());
  } catch (IllegalArgumentException ex) {
    for (int i = outputOffset; i < outputOffset + columnLen; i++)
      output[i] = dft;
    logger.error("Can't translate value " + Bytes.toString(value, 0, valueLen) + " to dictionary ID, roundingFlag " + roundingFlag + ". Using default value " + String.format("\\x%02X", dft));
  }
}

代码示例来源:origin: org.apache.kylin/kylin-job

idInMergedDict = mergedDict.nullId();
} else {
  idInMergedDict = mergedDict.getIdFromValueBytes(newKeyBuf, bufOffset, size);

相关文章