还是以Quickstart为例,说一下forward index的创建过程。
收集各个column的统计数据
代码同dictionary index。
再次遍历,按行处理每列的索引
iterator复位
// Build the index recordReader.rewind();重新遍历,对每行索引
LOGGER.info("Start building IndexCreator!"); while (recordReader.hasNext()) { long start = System.currentTimeMillis(); GenericRow row = recordReader.next(); long stop = System.currentTimeMillis(); indexCreator.indexRow(row); long stop1 = System.currentTimeMillis(); totalRecordReadTime += (stop - start); totalIndexTime += (stop1 - stop); }indexRow的实现:
@Override public void indexRow(GenericRow row) { for (final String column : dictionaryCreatorMap.keySet()) { Object columnValueToIndex = row.getValue(column); Object dictionaryIndex; if (dictionaryCache.get(column).containsKey(columnValueToIndex)) { dictionaryIndex = dictionaryCache.get(column).get(columnValueToIndex

本文通过Quickstart分析Pinot中Forward Index的创建过程,包括收集列统计数据、按行处理索引,以及对每行索引的详细步骤。对于single value field,使用二分查找在dictionary index中定位,存储为int类型,与column类型无关。Forward Index实质上是一个一维数组,存储每个值在dictionary index中的位置,配合dictionary index实现快速查找。

728

被折叠的 条评论
为什么被折叠?



