quilt-rs 0.4.2

Rust library for accessing Quilt data packages.
Documentation
//!
//! Table4 is a wrapper for arrow-rs's Table, the native Manifest format for quilt4.
//! It uses UPath to transparently read and write to/from local and remote filesystems,
//! and provides methods to read/write (decode/encode) quilt3's JSONL format
//! 

use arrow::error::ArrowError;
use arrow::record_batch::RecordBatch;

use super::{
    upath::UPath,
    row4::Row4,
};
use serde::{Deserialize, Serialize};
use aptos_openapi_link::impl_poem_type;
impl_poem_type!(Table, "object", ());

const HEADER_ROW: &str = ".";

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Table {
    #[serde(skip)]
    records: Option<RecordBatch>, // Vec<RecordBatch>? DataFusion?
    path3: Option<UPath>,
    path4: Option<UPath>,
}

impl Table {
    pub async fn new(path: Option<UPath>) -> Self {
        Table {
            records: None,
            path3: None,
            path4: path.clone(),
        }
    }
    pub fn to_string(&self) -> String {
        format!("Table({})", self.path4.as_ref().unwrap().to_string()) +
        &format!("({:?})\n", self.path3) +
        &format!("[\n{:?}\n]", self.records)
    }
    // Read quilt3's JSONL format
    pub fn read3(&self) -> Result<Self, ArrowError> {
        // Implementation goes here
        unimplemented!()
    }

    // Write quilt3's JSONL format
    pub fn write3(&self) -> Result<(), ArrowError> {
        // Implementation goes here
        unimplemented!()
    }

    // Read quilt4's Parquet format
    pub fn read4(&self) -> Result<Self, ArrowError> {
        // Implementation goes here
        unimplemented!()
    }

    // Write quilt4's Parquet format
    pub fn write4(&self) -> Result<(), ArrowError> {
        // Implementation goes here
        unimplemented!()
    }

    // Get a row from the table
    pub fn get_row(&self, _name: &String) -> Option<Row4> {
        // Implementation goes here
        unimplemented!()
    }

    pub fn get_header(&self) -> Option<Row4> {
        self.get_row(&HEADER_ROW.to_string())
    }
    // TBD: Store header metadata as PARQUET Metadata?

    pub fn list_names(&self) -> Vec<Row4> {
        // Implementation goes here
        unimplemented!()
    }
}