Alokh P
04/19/2023, 8:47 AMCaused by: org.apache.parquet.io.ParquetEncodingException: empty fields are illegal, the field should be ommited completely instead
at org.apache.parquet.io.MessageColumnIO$MessageColumnIORecordConsumer.endField(MessageColumnIO.java:329)
at org.apache.flink.formats.parquet.row.ParquetRowDataWriter$ArrayWriter.write(ParquetRowDataWriter.java:420)
at org.apache.flink.formats.parquet.row.ParquetRowDataWriter$RowWriter.write(ParquetRowDataWriter.java:456)
As far as I have checked we can avoid this by using AvroParquetWriter and providing the config parquet.avro.write-old-list-structure as false.
Can anybody here help on how this can be achieved ?Raghunadh Nittala
05/18/2023, 8:50 AMRaghunadh Nittala
05/18/2023, 8:50 AMJames Watkins
05/18/2023, 9:28 AMRaghunadh Nittala
05/18/2023, 9:59 AMAlokh P
05/24/2023, 8:00 AMprivate static FileSink<GenericRecord> getFileSink(Schema schema) {
return FileSink
.forBulkFormat(
new Path(ns.getString(SINK_S3_PATH)),
AvroParquetWriters.forGenericRecord(schema))
.disableCompact()
.build();
}
In the current API, I was not able to figure out how to pass the required configurations to the ParquetWriter.
I got this running in a hacky way by modifying the build method to hardcode my required config as below in org.apache.parquet.hadoop.ParquetWriter class.
public ParquetWriter<T> build() throws IOException {
conf.set(WRITE_OLD_LIST_STRUCTURE, "false");
codecName = CompressionCodecName.SNAPPY;
if (file != null) {
return new ParquetWriter<>(file,
mode, getWriteSupport(conf), codecName, rowGroupSize, enableValidation, conf,
maxPaddingSize, encodingPropsBuilder.build(), encryptionProperties);
} else {
return new ParquetWriter<>(HadoopOutputFile.fromPath(path, conf),
mode, getWriteSupport(conf), codecName,
rowGroupSize, enableValidation, conf, maxPaddingSize,
encodingPropsBuilder.build(), encryptionProperties);
}
}
The proper way would be to modify the API to accept configurations and pass it on to the parquet writer accordingly. As mentioned earlier I could not find an existing way to do so hence chose to do this.
Do let me know incase anybody is aware of a cleaner way to do this.Raghunadh Nittala
07/16/2023, 1:51 PM