pub struct DataTable { /* private fields */ }Expand description
Type-preserving columnar data backed by Arrow RecordBatch.
Provides row-oriented accessors for renderer compatibility while maintaining full Arrow type fidelity (timestamps, dates, decimals, etc.) for the transform pipeline.
Implementations§
Source§impl DataTable
impl DataTable
Sourcepub fn from_record_batch(batch: RecordBatch) -> Self
pub fn from_record_batch(batch: RecordBatch) -> Self
Wrap an existing Arrow RecordBatch.
Sourcepub fn from_rows(rows: &[Row]) -> Result<Self, ChartError>
pub fn from_rows(rows: &[Row]) -> Result<Self, ChartError>
Convert JSON rows (from inline YAML data) into a DataTable. Type inference: Numbers → Float64, Booleans → Boolean, Strings → Utf8.
Sourcepub fn from_ipc_bytes(bytes: &[u8]) -> Result<Self, ChartError>
pub fn from_ipc_bytes(bytes: &[u8]) -> Result<Self, ChartError>
Deserialize from Arrow IPC bytes.
Sourcepub fn to_ipc_bytes(&self) -> Result<Vec<u8>, ChartError>
pub fn to_ipc_bytes(&self) -> Result<Vec<u8>, ChartError>
Serialize to Arrow IPC bytes.
Sourcepub fn num_columns(&self) -> usize
pub fn num_columns(&self) -> usize
Number of columns.
Sourcepub fn record_batch(&self) -> &RecordBatch
pub fn record_batch(&self) -> &RecordBatch
Get the underlying RecordBatch.
Sourcepub fn get_f64(&self, row: usize, field: &str) -> Option<f64>
pub fn get_f64(&self, row: usize, field: &str) -> Option<f64>
Extract an f64 value from a specific row and field. Handles all numeric Arrow types, Date32 (days since epoch), and Timestamps (epoch millis).
Sourcepub fn get_string(&self, row: usize, field: &str) -> Option<String>
pub fn get_string(&self, row: usize, field: &str) -> Option<String>
Extract a string value from a specific row and field. Formats temporal types as ISO strings, numbers as decimal strings.
Sourcepub fn unique_values(&self, field: &str) -> Vec<String>
pub fn unique_values(&self, field: &str) -> Vec<String>
Get unique string values for a field, preserving first-appearance order.
Sourcepub fn all_values(&self, field: &str) -> Vec<String>
pub fn all_values(&self, field: &str) -> Vec<String>
Get all string values for a field, preserving row order (including duplicates).
Sourcepub fn extent(&self, field: &str) -> Option<(f64, f64)>
pub fn extent(&self, field: &str) -> Option<(f64, f64)>
Compute the extent (min, max) of a numeric field.
Sourcepub fn group_by(&self, field: &str) -> HashMap<String, DataTable>
pub fn group_by(&self, field: &str) -> HashMap<String, DataTable>
Group rows by a field value, returning a map of group key → DataTable.
Sourcepub fn field_names(&self) -> Vec<String>
pub fn field_names(&self) -> Vec<String>
Get all field names.