diff --git a/cpp/include/cudf/io/types.hpp b/cpp/include/cudf/io/types.hpp index 76899092b30..9d6a83e8730 100644 --- a/cpp/include/cudf/io/types.hpp +++ b/cpp/include/cudf/io/types.hpp @@ -126,7 +126,7 @@ struct table_metadata { schema_info; //!< Detailed name information for the entire output hierarchy std::map user_data; //!< Format-dependent metadata of the first input //!< file as key-values pairs (deprecated) - std::vector> + std::vector> per_file_user_data; //!< Per file format-dependent metadata as key-values pairs }; diff --git a/cpp/src/io/avro/reader_impl.cu b/cpp/src/io/avro/reader_impl.cu index fbc32217e59..f39fba0d33b 100644 --- a/cpp/src/io/avro/reader_impl.cu +++ b/cpp/src/io/avro/reader_impl.cu @@ -575,7 +575,7 @@ table_with_metadata read_avro(std::unique_ptr&& source, } // Return user metadata metadata_out.user_data = meta.user_data; - metadata_out.per_file_user_data = {meta.user_data}; + metadata_out.per_file_user_data = {{meta.user_data.begin(), meta.user_data.end()}}; return {std::make_unique(std::move(out_columns)), std::move(metadata_out)}; } diff --git a/cpp/src/io/orc/reader_impl.cu b/cpp/src/io/orc/reader_impl.cu index 7b25204db1c..f64ba6f0566 100644 --- a/cpp/src/io/orc/reader_impl.cu +++ b/cpp/src/io/orc/reader_impl.cu @@ -1266,13 +1266,17 @@ table_with_metadata reader::impl::read(size_type skip_rows, _metadata.per_file_metadata.cend(), std::back_inserter(out_metadata.per_file_user_data), [](auto& meta) { - std::map kv_map; - for (auto& kv : meta.ff.metadata) { - kv_map[kv.name] = kv.value; - } + std::unordered_map kv_map; + std::transform(meta.ff.metadata.cbegin(), + meta.ff.metadata.cend(), + std::inserter(kv_map, kv_map.end()), + [](auto const& kv) { + return std::pair{kv.name, kv.value}; + }); return kv_map; }); - out_metadata.user_data = out_metadata.per_file_user_data[0]; + out_metadata.user_data = {out_metadata.per_file_user_data[0].begin(), + out_metadata.per_file_user_data[0].end()}; return {std::make_unique
(std::move(out_columns)), std::move(out_metadata)}; } diff --git a/cpp/src/io/parquet/reader_impl.cu b/cpp/src/io/parquet/reader_impl.cu index 06e87b8e0c4..c3537833908 100644 --- a/cpp/src/io/parquet/reader_impl.cu +++ b/cpp/src/io/parquet/reader_impl.cu @@ -318,7 +318,7 @@ struct metadata : public FileMetaData { class aggregate_reader_metadata { std::vector per_file_metadata; - std::vector> keyval_maps; + std::vector> keyval_maps; size_type num_rows; size_type num_row_groups; /** @@ -339,12 +339,12 @@ class aggregate_reader_metadata { */ [[nodiscard]] auto collect_keyval_metadata() { - std::vector> kv_maps; + std::vector> kv_maps; std::transform(per_file_metadata.cbegin(), per_file_metadata.cend(), std::back_inserter(kv_maps), [](auto const& pfm) { - std::map kv_map; + std::unordered_map kv_map; std::transform(pfm.key_value_metadata.cbegin(), pfm.key_value_metadata.cend(), std::inserter(kv_map, kv_map.end()), @@ -1770,7 +1770,8 @@ table_with_metadata reader::impl::read(size_type skip_rows, // Return user metadata out_metadata.per_file_user_data = _metadata->get_key_value_metadata(); - out_metadata.user_data = out_metadata.per_file_user_data[0]; + out_metadata.user_data = {out_metadata.per_file_user_data[0].begin(), + out_metadata.per_file_user_data[0].end()}; return {std::make_unique
(std::move(out_columns)), std::move(out_metadata)}; }