Rich-T-kid commented on code in PR #11173:
URL: https://github.com/apache/arrow-rs/pull/11173#discussion_r4077848785
##########
parquet/src/arrow/arrow_writer/mod.rs:
##########
@@ -1145,21 +1145,11 @@ impl ArrowColumnWriter {
let non_null = levels.non_null_indices();
match array.as_any_dictionary_opt() {
Some(dict) => {
- // For dictionary arrays, hash the integer keys rather
than the actual values.
- // Key cardinality equals value cardinality, so
distinct-value counting stays
- // correct while avoiding the cost of hashing
arbitrary-length values.
- let keys = dict.keys();
- let key_data = keys.to_data();
- let offset = key_data.offset();
- let width = arrow_key_byte_width(keys.data_type());
- if width > 0 {
- let buffer = key_data.buffers()[0].as_slice();
- // Only visit non-null rows to avoid counting nulls as
a distinct value.
- for &row in non_null {
- let pos = (offset + row) * width;
- seen.insert(hash_bytes(&buffer[pos..pos + width]));
- }
- }
+ // Hash values, not key indices: the same key index can
map to different values across batches, causing undercounting.
Review Comment:
updated this. thanks @etseidl 🫡
--
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]