Parquet-Avro does not support field removal
- Vorherrschende Sprache
- Java
- Sterne
- 3.1k
- Forks
- 1.6k
- Ø Merge
- 3 T. 12 Std.
- Gemergte PRs (30 T.)
- 33
Beschreibung
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.*
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginne bei AvroRecordConverter.java:159 und verfolge, wie das konfigurierte Avro-Leserschema mit den im Parquet-File vorhandenen Feldern verglichen wird. Reproduziere das Lesen von v1 nach v2 mit den Kompatibilitätseinstellungen aus dem Issue; abgeschlossen ist die Aufgabe, wenn das entfernte foo-Feld ignoriert wird, während bar erfolgreich gelesen wird, ohne dass eine InvalidRecordException auftritt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- data-engineering
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100