@Override public DimensionEncoding createDimensionEncoding(String encodingName, String[] args) { return new FixedLenDimEnc(Integer.parseInt(args[0])); } };
@Override public Object deserialize(ByteBuffer in) { byte[] buf = currentBuf(); in.get(buf); return decode(buf, 0, buf.length); }
@Override public void serialize(Object value, ByteBuffer out) { byte[] buf = currentBuf(); String str = value == null ? null : value.toString(); encode(str, buf, 0); out.put(buf); }
@Override public String decode(byte[] bytes, int offset, int len) { if (isNull(bytes, offset, len)) { return null; } while (len > 0 && bytes[offset + len - 1] == ROWKEY_PLACE_HOLDER_BYTE) len--; return Bytes.toString(bytes, offset, len); }
@Override public String decode(byte[] bytes, int offset, int len) { if (isNull(bytes, offset, len)) { return null; } while (len > 0 && bytes[offset + len - 1] == ROWKEY_PLACE_HOLDER_BYTE) len--; return Bytes.toString(bytes, offset, len); }
@Override public DimensionEncoding get(TblColRef col) { DimensionEncoding result = encMap.get(col); if (result == null) { RowKeyColDesc colDesc = cubeDesc.getRowkey().getColDesc(col); if (colDesc.isUsingDictionary()) { // special dictionary encoding Dictionary<String> dict = getDictionary(col); if (dict == null) { logger.warn("No dictionary found for dict-encoding column " + col + ", segment " + seg); result = new FixedLenDimEnc(0); } else { result = new DictionaryDimEnc(dict); } } else { // normal case result = DimensionEncodingFactory.create(colDesc.getEncodingName(), colDesc.getEncodingArgs(), colDesc.getEncodingVersion()); } encMap.put(col, result); } return result; }
@Override public void serialize(Object value, ByteBuffer out) { byte[] buf = currentBuf(); String str = value == null ? null : value.toString(); encode(str, buf, 0); out.put(buf); }
@Override public Object deserialize(ByteBuffer in) { byte[] buf = currentBuf(); in.get(buf); return decode(buf, 0, buf.length); }
@Override public DimensionEncoding createDimensionEncoding(String encodingName, String[] args) { return new FixedLenDimEnc(Integer.parseInt(args[0])); } };
@Override public DimensionEncoding get(TblColRef col) { DimensionEncoding result = encMap.get(col); if (result == null) { RowKeyColDesc colDesc = cubeDesc.getRowkey().getColDesc(col); if (colDesc.isUsingDictionary()) { // special dictionary encoding Dictionary<String> dict = getDictionary(col); if (dict == null) { logger.warn("No dictionary found for dict-encoding column " + col + ", segment " + seg); result = new FixedLenDimEnc(0); } else { result = new DictionaryDimEnc(dict); } } else { // normal case result = DimensionEncodingFactory.create(colDesc.getEncodingName(), colDesc.getEncodingArgs(), colDesc.getEncodingVersion()); } encMap.put(col, result); } return result; }