NPE in ParquetInputFormat.getSplits when no .parquet files exist
- Vorherrschende Sprache
- Java
- Sterne
- 3.1k
- Forks
- 1.6k
- Ø Merge
- 3 T. 12 Std.
- Gemergte PRs (30 T.)
- 33
Beschreibung
```Java
JavaSparkContext context = ...
JavaRDD rdd1 = context.parallelize(ImmutableList. of());
SQLContext sqlContext = new SQLContext(context);
StructType schema = DataTypes.createStructType(ImmutableList.of(DataTypes.createStructField("col1", DataTypes.StringType, true)));
DataFrame df = sqlContext.createDataFrame(rdd1, schema);
String url = "file:///tmp/emptyRDD";
df.saveAsParquetFile(url);
Configuration configuration = SparkHadoopUtil.get().newConfiguration(context.getConf());
JobConf jobConf = new JobConf(configuration);
ParquetInputFormat.setReadSupportClass(jobConf, RowReadSupport.class);
FileInputFormat.setInputPaths(jobConf, url);
JavaRDD rdd2 = context.newAPIHadoopRDD(
jobConf, ParquetInputFormat.class, Void.class, Row.class).values();
rdd2.count();
df = sqlContext.createDataFrame(rdd2, schema);
url = "file:///tmp/emptyRDD2";
df.saveAsParquetFile(url);
FileInputFormat.setInputPaths(jobConf, url);
JavaRDD rdd3 = context.newAPIHadoopRDD(
jobConf, ParquetInputFormat.class, Void.class, Row.class).values();
rdd3.count();
```
The NPE happens here:
```Java
java.lang.NullPointerException
at parquet.hadoop.ParquetInputFormat.getSplits(ParquetInputFormat.java:263)
at parquet.hadoop.ParquetInputFormat.getSplits(ParquetInputFormat.java:245)
at org.apache.spark.rdd.NewHadoopRDD.getPartitions(NewHadoopRDD.scala:95)
```
This stems from ParquetFileWriter.getGlobalMetaData returning null when there are no footers to read.
**Reporter**: [Paul Nepywoda](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=pnepywoda)
**Note**: *This issue was originally created as [PARQUET-294](https://issues.apache.org/jira/browse/PARQUET-294). 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 mit ParquetInputFormat.getSplits und verfolge, wie ParquetFileWriter.getGlobalMetaData behandelt wird, wenn keine Footer gefunden werden. Reproduziere die bereitgestellte empty-RDD-Sequenz und überprüfe, dass sowohl rdd2.count() als auch rdd3.count() ohne eine NullPointerException abgeschlossen werden.
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
- Klar beschrieben
- Anfängerfreundlichkeit
- 35/100