viirya commented on code in PR #1636:
URL: https://github.com/apache/arrow-rs/pull/1636#discussion_r862511593


##########
arrow/src/ipc/reader.rs:
##########
@@ -563,16 +566,10 @@ pub fn read_dictionary(
         ArrowError::InvalidArgumentError("dictionary id not found in 
schema".to_string())
     })?;
 
-    // for all fields with this dictionary id, update the dictionaries vector
-    // in the reader. Note that a dictionary batch may be shared between many 
fields.
     // We don't currently record the isOrdered field. This could be general
     // attributes of arrays.
-    for (i, field) in schema.all_fields().iter().enumerate() {
-        if field.dict_id() == Some(id) {
-            // Add (possibly multiple) array refs to the dictionaries array.
-            dictionaries_by_field[i] = Some(dictionary_values.clone());
-        }
-    }
+    // Add (possibly multiple) array refs to the dictionaries array.
+    dictionaries_by_field.insert(id, dictionary_values.clone());

Review Comment:
   Main difference here. In `create_array`, we use `dictionaries[node_index]` 
to access dictionary array by `node_index`. But dictionary arrays are indexed 
by dict id, not node index. 



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