You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: sink.rs
    path of file: ./repos/polars/crates/polars-parquet/src/arrow/write
    
    the code of the file until where you have to start completion: use std::pin::Pin;
use std::task::Poll;

use ahash::AHashMap;
use arrow::array::Array;
use arrow::chunk::Chunk;
use arrow::datatypes::ArrowSchema;
use futures::future::BoxFuture;
use futures::{AsyncWrite, AsyncWriteExt, FutureExt, Sink, TryFutureExt};
use polars_error::{polars_bail, to_compute_err, PolarsError, PolarsResult};

use super::file::add_arrow_schema;
use super::{Encoding, SchemaDescriptor, WriteOptions};
use crate::parquet::metadata::KeyValue;
use crate::parquet::write::{FileStreamer, WriteOptions as ParquetWriteOptions};

/// Sink that writes array [`chunks`](Chunk) as a Parquet file.
///
/// Any values in the sink's `metadata` field will be written to the file's foo
    
    fn start_send(self: Pin<&mut Self>, item: Chunk<Box<dyn Array>>) -> Result<(), Self::Error> {
        if self.schema.fields.len() != item.arrays().len() {
            polars_bail!(InvalidOperation:
                "The number of arrays in the chunk must equal the number of fields in the schema"
            )
        }
        let this = self.get_mut();
        if let Some(mut writer) = this.writer.take() {
            let rows = crate::arrow::write::row_group_iter(
                item,
                this.encodings.clone(),
                this.parquet_schema.fields().to_vec(),
                this.options,
            );
            this.task = Some(Box::pin(async move {
                writer.write(rows).await?;
                Ok(Some(writer))
            }));
            Ok(())
        } else {
            let io_err = std::io::Error::new(
                std::io::ErrorKind::UnexpectedEof,
                "writer closed".to_string(),
            );
            Err(PolarsError::from(io_err))
        }
    }