Skip to content

Commit d15007a

Browse files
committed
Remove overload
1 parent f46f189 commit d15007a

3 files changed

Lines changed: 9 additions & 23 deletions

File tree

‎cpp/src/parquet/encryption/key_material.cc‎

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,44 +73,37 @@ KeyMaterial KeyMaterial::Parse(const std::string& key_material_string) {
7373
throw ParquetException("Wrong key material type: " + key_material_type + " vs " +
7474
kKeyMaterialType1);
7575
}
76-
// Parse other fields (common to internal and external key material)
77-
return Parse(&json_parser);
78-
}
7976

80-
KeyMaterial KeyMaterial::Parse(const JsonObjectParser* key_material_json) {
8177
// 2. Check if "key material" belongs to file footer key
8278
bool is_footer_key;
83-
PARQUET_ASSIGN_OR_THROW(is_footer_key, key_material_json->GetBool(kIsFooterKeyField));
79+
PARQUET_ASSIGN_OR_THROW(is_footer_key, json_parser.GetBool(kIsFooterKeyField));
8480
std::string kms_instance_id;
8581
std::string kms_instance_url;
8682
if (is_footer_key) {
8783
// 3. For footer key, extract KMS Instance ID
88-
PARQUET_ASSIGN_OR_THROW(kms_instance_id,
89-
key_material_json->GetString(kKmsInstanceIdField));
84+
PARQUET_ASSIGN_OR_THROW(kms_instance_id, json_parser.GetString(kKmsInstanceIdField));
9085
// 4. For footer key, extract KMS Instance URL
9186
PARQUET_ASSIGN_OR_THROW(kms_instance_url,
92-
key_material_json->GetString(kKmsInstanceUrlField));
87+
json_parser.GetString(kKmsInstanceUrlField));
9388
}
9489
// 5. Extract master key ID
9590
std::string master_key_id;
96-
PARQUET_ASSIGN_OR_THROW(master_key_id, key_material_json->GetString(kMasterKeyIdField));
91+
PARQUET_ASSIGN_OR_THROW(master_key_id, json_parser.GetString(kMasterKeyIdField));
9792
// 6. Extract wrapped DEK
9893
std::string encoded_wrapped_dek;
9994
PARQUET_ASSIGN_OR_THROW(encoded_wrapped_dek,
100-
key_material_json->GetString(kWrappedDataEncryptionKeyField));
95+
json_parser.GetString(kWrappedDataEncryptionKeyField));
10196
std::string kek_id;
10297
std::string encoded_wrapped_kek;
10398
// 7. Check if "key material" was generated in double wrapping mode
10499
bool is_double_wrapped;
105-
PARQUET_ASSIGN_OR_THROW(is_double_wrapped,
106-
key_material_json->GetBool(kDoubleWrappingField));
100+
PARQUET_ASSIGN_OR_THROW(is_double_wrapped, json_parser.GetBool(kDoubleWrappingField));
107101
if (is_double_wrapped) {
108102
// 8. In double wrapping mode, extract KEK ID
109-
PARQUET_ASSIGN_OR_THROW(kek_id,
110-
key_material_json->GetString(kKeyEncryptionKeyIdField));
103+
PARQUET_ASSIGN_OR_THROW(kek_id, json_parser.GetString(kKeyEncryptionKeyIdField));
111104
// 9. In double wrapping mode, extract wrapped KEK
112105
PARQUET_ASSIGN_OR_THROW(encoded_wrapped_kek,
113-
key_material_json->GetString(kWrappedKeyEncryptionKeyField));
106+
json_parser.GetString(kWrappedKeyEncryptionKeyField));
114107
}
115108

116109
return KeyMaterial(is_footer_key, kms_instance_id, kms_instance_url, master_key_id,

‎cpp/src/parquet/encryption/key_material.h‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121

2222
#include "parquet/platform.h"
2323

24-
namespace arrow::internal {
25-
class JsonObjectParser;
26-
} // namespace arrow::internal
27-
2824
namespace parquet::encryption {
2925

3026
// KeyMaterial class represents the "key material", keeping the information that allows
@@ -82,8 +78,6 @@ class PARQUET_EXPORT KeyMaterial {
8278

8379
static KeyMaterial Parse(const std::string& key_material_string);
8480

85-
static KeyMaterial Parse(const ::arrow::internal::JsonObjectParser* key_material_json);
86-
8781
/// This method returns a json string that will be stored either inside a parquet file
8882
/// or in a key material store outside the parquet file.
8983
static std::string SerializeToJson(bool is_footer_key,

‎cpp/src/parquet/encryption/key_metadata.cc‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ KeyMetadata KeyMetadata::Parse(const std::string& key_metadata) {
6060

6161
if (is_internal_storage) {
6262
// 3.1 "key material" is stored internally, inside "key metadata" - parse it
63-
KeyMaterial key_material = KeyMaterial::Parse(&json_parser);
64-
return KeyMetadata(key_material);
63+
return KeyMetadata(KeyMaterial::Parse(key_metadata));
6564
} else {
6665
// 3.2 "key material" is stored externally. "key metadata" keeps a reference to it
6766
std::string key_reference;

0 commit comments

Comments
 (0)