MCPcopy Create free account
hub / github.com/apache/arrow / WriteTo

Method WriteTo

cpp/src/parquet/metadata.cc:861–888  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

859 const ApplicationVersion& writer_version() const { return writer_version_; }
860
861 void WriteTo(::arrow::io::OutputStream* dst,
862 const std::shared_ptr<Encryptor>& encryptor) const {
863 ThriftSerializer serializer;
864 // Only in encrypted files with plaintext footers the
865 // encryption_algorithm is set in footer
866 if (is_encryption_algorithm_set()) {
867 uint8_t* serialized_data;
868 uint32_t serialized_len;
869 serializer.SerializeToBuffer(metadata_.get(), &serialized_len, &serialized_data);
870 std::span<const uint8_t> serialized_data_span(serialized_data, serialized_len);
871
872 // encrypt the footer key
873 std::vector<uint8_t> encrypted_data(encryptor->CiphertextLength(serialized_len));
874 int32_t encrypted_len = encryptor->Encrypt(serialized_data_span, encrypted_data);
875
876 // write unencrypted footer
877 PARQUET_THROW_NOT_OK(dst->Write(serialized_data, serialized_len));
878 // Write signature (nonce and tag)
879 PARQUET_THROW_NOT_OK(
880 dst->Write(encrypted_data.data() + 4, encryption::kNonceLength));
881 PARQUET_THROW_NOT_OK(
882 dst->Write(encrypted_data.data() + encrypted_len - encryption::kGcmTagLength,
883 encryption::kGcmTagLength));
884 } else { // either plaintext file (when encryptor is null)
885 // or encrypted file with encrypted footer
886 serializer.Serialize(metadata_.get(), dst, encryptor.get());
887 }
888 }
889
890 std::unique_ptr<RowGroupMetaData> RowGroup(int i) {
891 if (!(i >= 0 && i < num_row_groups())) {

Callers

nothing calls this directly

Calls 7

SerializeToBufferMethod · 0.45
getMethod · 0.45
CiphertextLengthMethod · 0.45
EncryptMethod · 0.45
WriteMethod · 0.45
dataMethod · 0.45
SerializeMethod · 0.45

Tested by

no test coverage detected