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: partition.rs
    path of file: ./repos/Daft/src/daft-table/src/ops
    
    the code of the file until where you have to start completion: use std::ops::Rem;

use arrow2::array::{Array, DictionaryKey};
use daft_core::array::ops::IntoGroups;
use daft_dsl::Expr;
use rand::SeedableRng;

use common_error::{DaftError, DaftResult};
use daft_core::{datatypes::UInt64Array, series::IntoSeries};

use daft_core::array::ops::as_arrow::AsArrow;

use crate::Table;

impl Table {
    fn partition_by_index(
        &self,
        targets: &UInt64Array,
        num_partitions: usize,
    ) -> DaftResult<Vec<Self>> {
        if self.len() != targets.len() {
         
    
    pub fn partition_by_value(&self, partition_keys: &[Expr]) -> DaftResult<(Vec<Self>, Self)> {
        let partition_key_table = self.eval_expression_list(partition_keys)?;
        let (key_idx, group_idx) = partition_key_table.make_groups()?;
        let key_idx = UInt64Array::from(("idx", key_idx)).into_series();
        let pkeys_per_output_table = partition_key_table.take(&key_idx)?;
        drop(partition_key_table);
        let output_tables = group_idx
            .into_iter()
            .map(|gidx| {
                let gidx = UInt64Array::from(("idx", gidx)).into_series();
                self.take(&gidx)
            })
            .collect::<DaftResult<Vec<_>>>()?;
        Ok((output_tables, pkeys_per_output_table))
    }