code: public void serializeToDisk(final File file) throws IOException {
      final DatumWriter datumWriter = new GenericDatumWriter<GenericRecord>();
      final DataFileWriter fileWriter = new DataFileWriter<GenericRecord>(datumWriter);
      final AvroParquetReader<GenericRecord> reader = createAvroReader();
      fileWriter.create(createAvroSchema(), file);
  
      GenericRecord record = reader.read();
      while (record != null) {
        fileWriter.append(record);
        record = reader.read();
      }
  
      try {
        reader.close();
      } catch (IOException ex){
        LOG.log(Level.SEVERE, ex.getMessage());
        throw ex;
      }
  
      try {
        fileWriter.close();
      } catch (IOException ex){
        LOG.log(Level.SEVERE, ex.getMessage());
        throw ex;
      }
    }
docs: Serialize Avro data to a local file.
  @param file Local destination file for serialization.
  @throws IOException if the parquet file couldn't be parsed correctly.