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: rank_processor.rs
    path of file: ./repos/blaze/native-engine/datafusion-ext-plans/src/window/processors
    
    the code of the file until where you have to start completion: // Copyright 2022 The Blaze Authors
//
// Licensed under the Apache License, Version 2.0 (the "Licen
    
    fn process_batch(&mut self, context: &WindowContext, batch: &RecordBatch) -> Result<ArrayRef> {
        let partition_rows = context.get_partition_rows(batch)?;
        let order_rows = context.get_order_rows(batch)?;
        let mut builder = Int32Builder::with_capacity(batch.num_rows());

        for row_idx in 0..batch.num_rows() {
            let same_partition = !context.has_partition() || {
                let partition_row = partition_rows.row(row_idx);
                if partition_row.as_ref() != self.cur_partition.as_ref() {
                    self.cur_partition = partition_row.as_ref().into();
                    false
                } else {
                    true
                }
            };
            let order_row = order_rows.row(row_idx);

            if same_partition {
                if order_row.as_ref() == self.cur_order.as_ref() {
                    self.cur_equals += 1;
                } else {
                    self.cur_rank += if !self.is_dense { self.cur_equals } else { 1 };
                    self.cur_equals = 1;
                    self.cur_order = order_row.as_ref().into();
                }
            } else {
                self.cur_rank = 1;
                self.cur_equals = 1;
                self.cur_order = order_row.as_ref().into();
            }
            builder.append_value(self.cur_rank);
        }
        Ok(Arc::new(builder.finish()))
    }