nikolaobradovic-db commented on code in PR #12483:
URL: https://github.com/apache/arrow-rs/pull/12483#discussion_r4722145694
##########
parquet/src/util/interner.rs:
##########
@@ -40,11 +40,23 @@ impl<S: Storage> Interner<S> {
pub fn new(storage: S) -> Self {
Self {
state: Default::default(),
- dedup: HashTable::with_capacity(DEFAULT_DEDUP_CAPACITY),
+ // Start empty: a column that gets no value never needs the table.
The
+ // dictionary encoder reserves the full table before its first
value
+ // (`reserve_if_empty`), as growing from empty is slower.
+ dedup: HashTable::new(),
storage,
}
}
+ /// Reserves `DEFAULT_DEDUP_CAPACITY` entries if the table has none yet.
+ pub(crate) fn reserve_if_empty(&mut self) {
Review Comment:
Gave this a go in the top commit. Let's compare which one is a better
approach and decide.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]