ProtoMessageConverter fails for unknown proto fields
- Langage dominant
- Java
- Étoiles
- 3.1k
- Forks
- 1.6k
- Merge moyen
- 3 j 12 h
- PR mergées (30 j)
- 33
Description
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.*
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez dans parquet-protobuf/src/main/java/org/apache/parquet/proto/ProtoMessageConverter.java, au niveau du traitement indiqué autour de la ligne 84, et reproduisez la IncompatibleSchemaModificationException avec un champ Parquet absent de la classe protobuf. Le travail est terminé lorsque les champs inconnus peuvent être ignorés sans l’exception, tandis que le comportement de conversion existant reste inchangé ; l’issue ne nomme aucun fichier de test.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- data-engineering
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100