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

Method WriteTo

cpp/src/parquet/metadata.cc:867–893  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected