ProtoMessageConverter fails for unknown proto fields
- Vorherrschende Sprache
- Java
- Sterne
- 3.1k
- Forks
- 1.6k
- Ø Merge
- 3 T. 12 Std.
- Gemergte PRs (30 T.)
- 33
Beschreibung
Hi
We have Spark application that reads parquet files and turns them into a Protobuf RDD like the code below [1]. However, if the parquet schema contain fields that doesn't exist in protobuf class an IncompatibleSchemaModificationException [2] is thrown.
For compatibility reasons it would be nice to make it possible to ignore fields instead of throwing an exception. Maybe as an configuration? The fix for ignoring fields is quite easy, just instantiate an empty PrimitiveConverter instead.
Cheers,
-Kristoffer
[1]
JobConf conf = new JobConf(ctx.hadoopConfiguration());
FileInputFormat.setInputPaths(conf, rawPath);
ProtoReadSupport.setProtobufClass(conf, Msg.class.getName());
NewHadoopRDD rdd =
new NewHadoopRDD(ctx.sc(), ProtoParquetInputFormat.class, void.class, Msg.class, conf);
rdd.toJavaRDD().foreach(log -> {
System.out.println(log._2);
});
[2] https://github.com/apache/parquet-mr/blob/master/parquet-protobuf/src/main/java/org/apache/parquet/proto/ProtoMessageConverter.java#L84
[3] converters[parquetFieldIndex - 1] = new PrimitiveConverter() {};
**Reporter**: [Kristoffer Sjögren](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=deephacks) / @krisskross
**Note**: *This issue was originally created as [PARQUET-697](https://issues.apache.org/jira/browse/PARQUET-697). 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 in parquet-protobuf/src/main/java/org/apache/parquet/proto/ProtoMessageConverter.java bei der referenzierten Behandlung um Zeile 84 und reproduziere die IncompatibleSchemaModificationException mit einem Parquet-Feld, das in der protobuf-Klasse fehlt. Die Arbeit ist abgeschlossen, wenn unbekannte Felder ohne die Exception ignoriert werden können, während das bestehende Konvertierungsverhalten unverändert bleibt; im Issue wird keine Testdatei genannt.
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