Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PARQUET-2468: ParquetMetadata must convert to json #1349

Merged
merged 9 commits into from
May 27, 2024

Conversation

RustedBones
Copy link
Contributor

ParquetMetadata json serialization failed on UNENCRYPTED files.

Add required configuration to the metadata ObjectMaper:

Also add custom serializer for Statistics

{
  "fileMetaData" : {
    "schema" : {
      "name" : "test",
      "repetition" : "REPEATED",
      "logicalTypeAnnotation" : null,
      "id" : null,
      "fields" : [ {
        "name" : "some_null_field",
        "repetition" : "OPTIONAL",
        "logicalTypeAnnotation" : null,
        "id" : null,
        "primitive" : true,
        "primitiveTypeName" : "BINARY",
        "typeLength" : 0,
        "decimalMetadata" : null,
        "originalType" : null
      } ],
      "columns" : [ {
        "path" : [ "some_null_field" ],
        "type" : "BINARY",
        "primitiveType" : {
          "name" : "some_null_field",
          "repetition" : "OPTIONAL",
          "logicalTypeAnnotation" : null,
          "id" : null,
          "primitive" : true,
          "primitiveTypeName" : "BINARY",
          "typeLength" : 0,
          "decimalMetadata" : null,
          "originalType" : null
        },
        "maxRepetitionLevel" : 0,
        "maxDefinitionLevel" : 1,
        "typeLength" : 0
      } ],
      "paths" : [ [ "some_null_field" ] ],
      "fieldCount" : 1,
      "primitive" : false,
      "originalType" : null
    },
    "keyValueMetaData" : { },
    "createdBy" : null,
    "fileDecryptor" : null,
    "encryptionType" : "UNENCRYPTED"
  },
  "blocks" : [ {
    "columns" : [ {
      "rowGroupOrdinal" : -1,
      "encodingStats" : null,
      "columnIndexReference" : null,
      "offsetIndexReference" : null,
      "bloomFilterOffset" : -1,
      "bloomFilterLength" : -1,
      "dictionaryPageOffset" : 0,
      "valueCount" : 0,
      "totalSize" : 0,
      "totalUncompressedSize" : 0,
      "statistics" : {
        "min" : "\u0000",
        "max" : "\u0000\u0000",
        "null_count" : 0
      },
      "sizeStatistics" : null,
      "firstDataPageOffset" : 0,
      "primitiveType" : {
        "name" : "fake_type",
        "repetition" : "OPTIONAL",
        "logicalTypeAnnotation" : null,
        "id" : null,
        "primitive" : true,
        "primitiveTypeName" : "BINARY",
        "typeLength" : 0,
        "decimalMetadata" : null,
        "originalType" : null
      },
      "startingPos" : 0,
      "codec" : "GZIP",
      "encodings" : [ ],
      "encrypted" : false,
      "type" : "BINARY",
      "path" : [ "foo" ]
    } ],
    "rowCount" : 0,
    "totalByteSize" : 0,
    "path" : null,
    "ordinal" : 0,
    "rowIndexOffset" : -1,
    "compressedSize" : 0,
    "startingPos" : 0
  } ]
}

Copy link
Member

@wgtmac wgtmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late review. I have left some minor comments. Mostly LGTM.

Comment on lines +113 to 116
@JsonIgnore
public InternalFileDecryptor getFileDecryptor() {
return fileDecryptor;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When logging the file metadata, we probably want to skip this

  "fileDecryptor" : {
    "fileAAD" : null,
    "decryptionProperties" : {
      "footerKey" : "AQIDBAUGBwgJCgsMDQ4PEA==",
      "keyRetriever" : null,
      "aadprefix" : null
    }
  },

@wgtmac wgtmac changed the title [PARQUET-2468] ParquetMetadata must convert to json PARQUET-2468: ParquetMetadata must convert to json May 17, 2024
Copy link
Contributor

@Fokko Fokko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this @RustedBones, this makes sense to me 👍

@wgtmac
Copy link
Member

wgtmac commented May 21, 2024

Thanks for the reply! @Fokko

It seems that we need a minor release for this. +1 on my side.

@wgtmac wgtmac merged commit dd9014f into apache:master May 27, 2024
9 checks passed
wgtmac pushed a commit to wgtmac/parquet-mr that referenced this pull request May 27, 2024
wgtmac added a commit that referenced this pull request May 31, 2024
Co-authored-by: Michel Davit <michel@davit.fr>
@wgtmac wgtmac added this to the 1.15.0 milestone Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants