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

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

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

Dictionary.getSizeOfId介绍

暂无

代码示例

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

public boolean isNullId(int id) {
  int nullId = NULL_ID[getSizeOfId()];
  return (nullId & id) == nullId;
}

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

@Override
public int maxLength() {
  return dict.getSizeOfId();
}

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

public DictionaryDimEnc(Dictionary<String> dict, int roundingFlag, byte defaultByte) {
  this.dict = dict;
  this.fixedLen = dict.getSizeOfId();
  this.roundingFlag = roundingFlag;
  this.defaultByte = defaultByte;
}

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

@Override
  public int getStorageBytesEstimate() {
    return dict.getSizeOfId();
  }
}

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

public int nullId() {
  return NULL_ID[getSizeOfId()];
}

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

@Override
public int peekLength(ByteBuffer in) {
  return dict.getSizeOfId();
}

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

@Override
public void serialize(Object value, ByteBuffer buf) {
  int id = dict.getIdFromValue(value == null ? null : value.toString(), roundingFlag);
  BytesUtil.writeUnsigned(id, dict.getSizeOfId(), buf);
}

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

@Override
public Object deserialize(ByteBuffer in) {
  int id = BytesUtil.readUnsigned(in, dict.getSizeOfId());
  return dict.getValueFromId(id);
}

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

@Override
public List<ByteArray> valueOf(String[] values, MeasureDesc measureDesc, Map<TblColRef, Dictionary<String>> dictionaryMap) {
  if (values.length != 1)
    throw new IllegalArgumentException();
  //source input column value
  String literal = values[0];
  // encode literal using dictionary
  TblColRef literalCol = getRawColumn(measureDesc.getFunction());
  Dictionary<String> dictionary = dictionaryMap.get(literalCol);
  int keyEncodedValue = dictionary.getIdFromValue(literal);
  ByteArray key = new ByteArray(dictionary.getSizeOfId());
  BytesUtil.writeUnsigned(keyEncodedValue, key.array(), key.offset(), dictionary.getSizeOfId());
  List<ByteArray> valueList = new ArrayList<ByteArray>(1);
  valueList.add(key);
  return valueList;
}

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

@Override
  public List<ByteArray> reEncodeDictionary(List<ByteArray> value, MeasureDesc measureDesc, Map<TblColRef, Dictionary<String>> oldDicts, Map<TblColRef, Dictionary<String>> newDicts) {
    TblColRef colRef = getRawColumn(measureDesc.getFunction());
    Dictionary<String> sourceDict = oldDicts.get(colRef);
    Dictionary<String> mergedDict = newDicts.get(colRef);
    int valueSize = value.size();
    byte[] newIdBuf = new byte[valueSize * mergedDict.getSizeOfId()];
    int bufOffset = 0;
    for (ByteArray c : value) {
      int oldId = BytesUtil.readUnsigned(c.array(), c.offset(), c.length());
      int newId;
      String v = sourceDict.getValueFromId(oldId);
      if (v == null) {
        newId = mergedDict.nullId();
      } else {
        newId = mergedDict.getIdFromValue(v);
      }
      BytesUtil.writeUnsigned(newId, newIdBuf, bufOffset, mergedDict.getSizeOfId());
      c.reset(newIdBuf, bufOffset, mergedDict.getSizeOfId());
      bufOffset += mergedDict.getSizeOfId();
    }
    return value;
  }
};

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

public ShrunkenDictionary<T> build(ValueSerializer<T> valueSerializer) {
    return new ShrunkenDictionary<>(valueSerializer, fullDict.getMinId(), fullDict.getMaxId(),
        fullDict.getSizeOfId(), fullDict.getSizeOfValue(), valueToIdMap);
  }
}

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

private void saveDictionaryInfo(CubeSegment cubeSeg, TblColRef col, DictionaryInfo dictInfo)
    throws IOException {
  if (dictInfo == null)
    return;
  // work on copy instead of cached objects
  CubeInstance cubeCopy = cubeSeg.getCubeInstance().latestCopyForWrite(); // get a latest copy
  CubeSegment segCopy = cubeCopy.getSegmentById(cubeSeg.getUuid());
  Dictionary<?> dict = dictInfo.getDictionaryObject();
  segCopy.putDictResPath(col, dictInfo.getResourcePath());
  segCopy.getRowkeyStats().add(new Object[] { col.getIdentity(), dict.getSize(), dict.getSizeOfId() });
  CubeUpdate update = new CubeUpdate(cubeCopy);
  update.setToUpdateSegs(segCopy);
  updateCube(update);
}

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

BytesUtil.writeUnsigned(mergedDict.nullId(), newKeyBodyBuf, bufOffset, mergedDict.getSizeOfId());
    bufOffset += mergedDict.getSizeOfId();
    continue;
  } else {
      mergedDict.getSizeOfId() > newKeyBodyBuf.length - bufOffset) {
    byte[] oldBuf = newKeyBodyBuf;
    newKeyBodyBuf = new byte[2 * newKeyBodyBuf.length];
  BytesUtil.writeUnsigned(idInMergedDict, newKeyBodyBuf, bufOffset, mergedDict.getSizeOfId());
  bufOffset += mergedDict.getSizeOfId();
} else {

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

@Override
public int peekLength(ByteBuffer in) {
  return dict.getSizeOfId();
}

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

@Override
public int maxLength() {
  return dict.getSizeOfId();
}

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

public DictionaryDimEnc(Dictionary<String> dict, int roundingFlag, byte defaultByte) {
  this.dict = dict;
  this.fixedLen = dict.getSizeOfId();
  this.roundingFlag = roundingFlag;
  this.defaultByte = defaultByte;
}

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

@Override
  public int getStorageBytesEstimate() {
    return dict.getSizeOfId();
  }
}

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

@Override
public void serialize(Object value, ByteBuffer buf) {
  int id = dict.getIdFromValue(value == null ? null : value.toString(), roundingFlag);
  BytesUtil.writeUnsigned(id, dict.getSizeOfId(), buf);
}

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

@Override
public Object deserialize(ByteBuffer in) {
  int id = BytesUtil.readUnsigned(in, dict.getSizeOfId());
  return dict.getValueFromId(id);
}

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

@Override
public int getColumnLength(TblColRef col) {
  Dictionary<?> dict = getDictionary(col);
  if (dict == null) {
    return this.getCubeDesc().getRowkey().getColumnLength(col);
  } else {
    return dict.getSizeOfId();
  }
}

相关文章