Skip to content

Commit

Permalink
Extends the append_key_value to parquet::arrow
Browse files Browse the repository at this point in the history
  • Loading branch information
mapleFU committed May 13, 2024
1 parent 2552c26 commit 7c699fb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cpp/src/parquet/arrow/writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,14 @@ class FileWriterImpl : public FileWriter {
return writer_->metadata();
}

/// \brief Append the key-value metadata to the file metadata
::arrow::Status AddKeyValueMetadata(
const std::shared_ptr<const ::arrow::KeyValueMetadata>& key_value_metadata)
override {
PARQUET_CATCH_NOT_OK(writer_->AddKeyValueMetadata(key_value_metadata));
return Status::OK();
}

private:
friend class FileWriter;

Expand Down
10 changes: 10 additions & 0 deletions cpp/src/parquet/arrow/writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@ class PARQUET_EXPORT FileWriter {
virtual ~FileWriter();

virtual MemoryPool* memory_pool() const = 0;
/// \brief Add key-value metadata to the file.
/// \param[in] key_value_metadata the metadata to add.
/// \note This will overwrite any existing metadata with the same key.
/// \return Error if Close() has been called.
///
/// WARNING: If `store_schema` is enabled, `ARROW:schema` would be stored
/// in the key-value metadata. Overwriting this key would result in
/// `store_schema` unusable during read.
virtual ::arrow::Status AddKeyValueMetadata(
const std::shared_ptr<const ::arrow::KeyValueMetadata>& key_value_metadata) = 0;
/// \brief Return the file metadata, only available after calling Close().
virtual const std::shared_ptr<FileMetaData> metadata() const = 0;
};
Expand Down

0 comments on commit 7c699fb

Please sign in to comment.