kiszk commented on a change in pull request #7507: URL: https://github.com/apache/arrow/pull/7507#discussion_r521501051
########## File path: cpp/src/arrow/ipc/reader.cc ########## @@ -699,42 +726,45 @@ Status ReadDictionary(const Buffer& metadata, DictionaryMemo* dictionary_memo, // Look up the dictionary value type, which must have been added to the // DictionaryMemo already prior to invoking this function - ARROW_ASSIGN_OR_RAISE(auto value_type, dictionary_memo->GetDictionaryType(id)); + ARROW_ASSIGN_OR_RAISE(auto value_type, context.dictionary_memo->GetDictionaryType(id)); // Load the dictionary data from the dictionary batch ArrayLoader loader(batch_meta, internal::GetMetadataVersion(message->version()), - options, file); - const auto dict_data = std::make_shared<ArrayData>(); + context.options, file); + auto dict_data = std::make_shared<ArrayData>(); const Field dummy_field("", value_type); RETURN_NOT_OK(loader.Load(&dummy_field, dict_data.get())); if (compression != Compression::UNCOMPRESSED) { ArrayDataVector dict_fields{dict_data}; - RETURN_NOT_OK(DecompressBuffers(compression, options, &dict_fields)); + RETURN_NOT_OK(DecompressBuffers(compression, context.options, &dict_fields)); + } + + // swap endian in dict_data if necessary (swap_endian == true) + if (context.swap_endian) { + SwapEndianArrayData(dict_data); } if (dictionary_batch->isDelta()) { - if (kind != nullptr) { - *kind = DictionaryKind::Delta; + if (context.kind != nullptr) { + *context.kind = DictionaryKind::Delta; } - return dictionary_memo->AddDictionaryDelta(id, dict_data); + return context.dictionary_memo->AddDictionaryDelta(id, dict_data); } ARROW_ASSIGN_OR_RAISE(bool inserted, - dictionary_memo->AddOrReplaceDictionary(id, dict_data)); - if (kind != nullptr) { - *kind = inserted ? DictionaryKind::New : DictionaryKind::Replacement; + context.dictionary_memo->AddOrReplaceDictionary(id, dict_data)); + if (context.kind != nullptr) { + *context.kind = inserted ? DictionaryKind::New : DictionaryKind::Replacement; } Review comment: I see. @kou Is it ok to exclude `param` from `IpcReadContext`? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org