diff --git a/cpp/src/arrow/dataset/file_parquet.cc b/cpp/src/arrow/dataset/file_parquet.cc index 140917a2e6341..c17ba89be7907 100644 --- a/cpp/src/arrow/dataset/file_parquet.cc +++ b/cpp/src/arrow/dataset/file_parquet.cc @@ -779,6 +779,11 @@ ParquetFileFragment::ParquetFileFragment(FileSource source, parquet_format_(checked_cast(*format_)), row_groups_(std::move(row_groups)) {} +std::shared_ptr ParquetFileFragment::metadata() { + auto lock = physical_schema_mutex_.Lock(); + return metadata_; +} + Status ParquetFileFragment::EnsureCompleteMetadata(parquet::arrow::FileReader* reader) { auto lock = physical_schema_mutex_.Lock(); if (metadata_ != nullptr) { diff --git a/cpp/src/arrow/dataset/file_parquet.h b/cpp/src/arrow/dataset/file_parquet.h index 5141f36385e3f..63d8fd729223c 100644 --- a/cpp/src/arrow/dataset/file_parquet.h +++ b/cpp/src/arrow/dataset/file_parquet.h @@ -165,7 +165,7 @@ class ARROW_DS_EXPORT ParquetFileFragment : public FileFragment { } /// \brief Return the FileMetaData associated with this fragment. - const std::shared_ptr& metadata() const { return metadata_; } + std::shared_ptr metadata(); /// \brief Ensure this fragment's FileMetaData is in memory. Status EnsureCompleteMetadata(parquet::arrow::FileReader* reader = NULLPTR);