Skip to main content

Frame

Struct Frame 

Source
pub struct Frame(/* private fields */);
Expand description

Rows and columns, together with what each column is called and holds.

A type of ours rather than a RecordBatch in an Opaque for two reasons that are not style: a codec is an impl of somebody else’s trait and the orphan rule wants one of the two types to be ours, and this is the word the design is written in — the difference between training and deploying is how many rows the frame brings.

It is not a tensor and does not want to be. Numbers and fixed-size lists of them are contiguous Arrow buffers, so converting is a reshape and not a copy; text is not a tensor until something tokenizes it. The conversion is a node, and the same node whether the frame came from a file or a topic.

Implementations§

Source§

impl Frame

Source

pub const KIND: &'static str = "arrow.RecordBatch"

What gets written beside the bytes. Named after the format and not the language: what is on disk is an Arrow IPC stream, and whoever reads it back may be a polars on the other side of the wall.

Source

pub fn new(batch: RecordBatch) -> Self

This batch, as a frame.

Source

pub fn rows(&self) -> usize

How many rows it brings. The only number a caller usually wants: it is what says whether a span was short because the dataset ended.

Source

pub fn schema(&self) -> &SchemaRef

What the columns are called and what they hold — without reading a value, which is the half of a virtual table worth having.

Source

pub fn batch(&self) -> &RecordBatch

The batch itself, for whoever brought their own engine.

Source

pub fn value(self) -> Value

As a value, which is how it crosses an edge. Opaque and not a variant of its own: the core has no dependencies and is not going to learn what a column is.

Source

pub fn of(value: &Value) -> Option<&Self>

The frame this value carries, if it carries one.

Source

pub fn written(&self) -> Result<Vec<u8>, FrameError>

What it weighs in bytes: Arrow IPC, buffers and all. No encoding pass and no per-value work, which is the reason Arrow is the type that crosses an edge rather than something converted to at the edges.

Source

pub fn read(bytes: &[u8]) -> Result<Self, FrameError>

And back.

One frame, however many batches the stream holds: what was written down was a frame, and a frame is what comes back.

Trait Implementations§

Source§

impl Clone for Frame

Source§

fn clone(&self) -> Frame

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Frame

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Frame

§

impl !RefUnwindSafe for Frame

§

impl Send for Frame

§

impl Sync for Frame

§

impl Unpin for Frame

§

impl UnsafeUnpin for Frame

§

impl !UnwindSafe for Frame

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,