pitrou commented on code in PR #50691:
URL: https://github.com/apache/arrow/pull/50691#discussion_r3667197286
##########
cpp/src/parquet/encryption/key_material.cc:
##########
@@ -122,36 +122,57 @@ std::string KeyMaterial::SerializeToJson(
bool is_double_wrapped, const std::string& kek_id,
const std::string& encoded_wrapped_kek, const std::string&
encoded_wrapped_dek,
bool is_internal_storage) {
- ObjectWriter json_writer;
- json_writer.SetString(kKeyMaterialTypeField, kKeyMaterialType1);
+ JsonWriter json_writer;
+
+ json_writer.StartObject();
+
+ json_writer.Key(kKeyMaterialTypeField);
+ json_writer.String(kKeyMaterialType1);
if (is_internal_storage) {
- // 1. for internal storage, key material and key metadata are the same.
- // adding the "internalStorage" field that belongs to KeyMetadata.
Review Comment:
Why not keep this comment?
##########
cpp/src/parquet/encryption/key_metadata.cc:
##########
@@ -73,15 +73,22 @@ KeyMetadata KeyMetadata::Parse(const std::string&
key_metadata) {
// directly
std::string KeyMetadata::CreateSerializedForExternalMaterial(
const std::string& key_reference) {
- ObjectWriter json_writer;
+ JsonWriter json_writer;
- json_writer.SetString(KeyMaterial::kKeyMaterialTypeField,
- KeyMaterial::kKeyMaterialType1);
- json_writer.SetBool(kKeyMaterialInternalStorageField, false);
+ json_writer.StartObject();
- json_writer.SetString(kKeyReferenceField, key_reference);
+ json_writer.Key(KeyMaterial::kKeyMaterialTypeField);
+ json_writer.String(KeyMaterial::kKeyMaterialType1);
- return json_writer.Serialize();
+ json_writer.Key(kKeyMaterialInternalStorageField);
+ json_writer.Bool(false);
+
+ json_writer.Key(kKeyReferenceField);
+ json_writer.String(key_reference);
Review Comment:
Just a thought, but perhaps we can add helper methods to make such code less
verbose?
```suggestion
json_writer.BoolField(kKeyMaterialInternalStorageField, false);
json_writer.StringField(kKeyReferenceField, key_reference);
```
##########
cpp/src/arrow/CMakeLists.txt:
##########
@@ -1042,7 +1042,7 @@ if(ARROW_JSON)
json/from_string.cc
json/json_writer_internal.cc
json/object_parser.cc
- json/object_writer.cc
+ json/json_writer.cc
Review Comment:
This is adding `json_writer.cc` but I don't see it in this PR?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]