Merge pull request #756 from metamx/dimdim-comments

add some comments about string interning
This commit is contained in:
fjy 2014-09-23 11:24:11 -06:00
commit 01bb7de3aa
2 changed files with 9 additions and 1 deletions

View File

@ -673,6 +673,10 @@ public class IncrementalIndex implements Iterable<Row>
falseIdsReverse = biMap.inverse();
}
/**
* Returns the interned String value to allow fast comparisons using `==` instead of `.equals()`
* @see io.druid.segment.incremental.IncrementalIndexStorageAdapter.EntryHolderValueMatcherFactory#makeValueMatcher(String, String)
*/
public String get(String value)
{
return value == null ? null : poorMansInterning.get(value);

View File

@ -528,6 +528,10 @@ public class IncrementalIndexStorageAdapter implements StorageAdapter
}
for (String dimVal : dims[dimIndex]) {
/**
* using == here instead of .equals() to speed up lookups made possible by
* {@link io.druid.segment.incremental.IncrementalIndex.DimDim#poorMansInterning}
*/
if (id == dimVal) {
return true;
}
@ -600,4 +604,4 @@ public class IncrementalIndexStorageAdapter implements StorageAdapter
};
}
}
}
}