apache / apache/parquet-java

Parquet-Avro does not support field removal

Open
#1,932 3 comments 0 reactions 0 assignees View on GitHub
Component: Avro Component: Parquet Priority: Major Type: bug
Dominant language
Java
Stars
3.1k
Forks
1.6k
Avg merge
3d 12h
Merged PRs (30d)
33

Description

Parquet avro does not support removal of fields, when used with the new compatibility layer:

Given a parquet file written with parquet avro at v1 and the following schema:

```Java
record FooBar {
long foo;
string bar;
}
```

And the following configuration settings:

```Java
job.getConfiguration.setBoolean(AvroReadSupport.AVRO_COMPATIBILITY, false)
AvroParquetInputFormat.setAvroReadSchema(job, avroReaderSchema)
```

A job fails when trying to read it using schema version v2:

```Java
record FooBar {
string bar;
}
```

With the error:

```Java
org.apache.parquet.io.InvalidRecordException: Parquet/Avro schema mismatch: Avro field 'foo' not found
at org.apache.parquet.avro.AvroRecordConverter.getAvroField(AvroRecordConverter.java:159)
```

It looks like because it sees the field in the original version it assumes the new version must expect it, but this case just means that the field was removed. Avro schema resolution dictates that you just ignore this field, since it is not relevant in the new version.

**Reporter**: [Thomas Omans](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=eggsby)

**Note**: *This issue was originally created as [PARQUET-465](https://issues.apache.org/jira/browse/PARQUET-465). Please see the [migration documentation](https://issues.apache.org/jira/browse/PARQUET-2502) for further details.*

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.