mzabaluev commented on code in PR #9720:
URL: https://github.com/apache/arrow-rs/pull/9720#discussion_r3135126462


##########
parquet/src/encodings/encoding/dict_encoder.rs:
##########
@@ -183,6 +188,214 @@ impl<T: DataType> Encoder<T> for DictEncoder<T> {
     ///
     /// For this encoder, the indices are unencoded bytes (refer to 
[`Self::write_indices`]).
     fn estimated_memory_size(&self) -> usize {
-        self.interner.storage().size_in_bytes + self.indices.len() * 
std::mem::size_of::<usize>()
+        self.interner.estimated_memory_size()
+            + self.indices.capacity() * std::mem::size_of::<usize>()
+    }
+}
+
+#[cfg(test)]
+mod tests {

Review Comment:
   There was another change. This makes `ByteArray` and `FixedLenByteArray` 
tests fail:
   
   ```diff
   @@ -188,8 +183,7 @@ impl<T: DataType> Encoder<T> for DictEncoder<T> {
        ///
        /// For this encoder, the indices are unencoded bytes (refer to 
[`Self::write_indices`]).
        fn estimated_memory_size(&self) -> usize {
   -        self.interner.estimated_memory_size()
   -            + self.indices.capacity() * std::mem::size_of::<usize>()
   +        self.interner.storage().size_in_bytes + self.indices.len() * 
std::mem::size_of::<usize>()
        }
    }
   ```
   
   I have added more tests that fail with the baseline code.



-- 
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]

Reply via email to