Skip to content

ParquetMetadata JSON serialization is failing #3086

Description

@Fokko

Describe the bug, including details regarding any error messages, version, and platform.

Discovered by plugging in RC1 into Spark: apache/spark#48970

Failing test: https://github.com/Fokko/spark/actions/runs/12027509812/job/33528737000

...
Cause: java.lang.RuntimeException: shaded.parquet.com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.apache.parquet.schema.LogicalTypeAnnotation$StringLogicalTypeAnnotation and no properties discovered to create BeanSerializer 
    (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) 
    (through reference chain: org.apache.parquet.hadoop.metadata.ParquetMetadata["fileMetaData"]->org.apache.parquet.hadoop.metadata.FileMetaData["schema"]->org.apache.parquet.schema.MessageType["fields"]->java.util.ArrayList[1]->org.apache.parquet.schema.PrimitiveType["logicalTypeAnnotation"])
  at org.apache.parquet.hadoop.metadata.ParquetMetadata.toJSON(ParquetMetadata.java:73)
  at org.apache.parquet.hadoop.metadata.ParquetMetadata.toPrettyJSON(ParquetMetadata.java:49)
  at org.apache.parquet.format.converter.ParquetMetadataConverter.readParquetMetadata(ParquetMetadataConverter.java:1594)
...

I checked the affected classes, and they haven't changed for a long time, so I believe it is the upgrade to the later version of Jackson. Spark uses the same version of Jackson, so I fixed it by allowing to serialize to null.

Converting to JSON is used for debugging purposes:

if (LOG.isDebugEnabled()) LOG.debug(ParquetMetadata.toPrettyJSON(parquetMetadata));

Component(s)

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions