/** * get value of columns which belongs to the original table columns. * i.e. columns like min_xx, max_yy will never appear */ public String getValueString(int col) { if (rawRecord.isMetric(col)) return getValueMetric(col); else return info.dict(col).getValueFromId(rawRecord.getValueID(col)); }
public String readColumnString(TblColRef col, byte[] bytes, int bytesLen) { Dictionary<String> dict = getDictionary(col); if (dict == null) { bytes = Bytes.head(bytes, bytesLen); if (isNull(bytes)) { return null; } bytes = removeFixLenPad(bytes, 0); return Bytes.toString(bytes); } else { int id = BytesUtil.readUnsigned(bytes, 0, bytesLen); try { String value = dict.getValueFromId(id); return value; } catch (IllegalArgumentException e) { logger.error("Can't get dictionary value for column " + col.getName() + " (id = " + id + ")"); return ""; } } }
@SuppressWarnings("unchecked") private void touchDictValues(DictionaryInfo info1) { Dictionary<String> dict = (Dictionary<String>) info1.getDictionaryObject(); HashSet<String> set = new HashSet<String>(); for (int i = 0, n = info1.getCardinality(); i < n; i++) { set.add(dict.getValueFromId(i)); } assertEquals(info1.getCardinality(), set.size()); } }