Skip to main content

RangePartitioning

Struct RangePartitioning 

Source
pub struct RangePartitioning { /* private fields */ }
Expand description

Physical range partitioning.

RangePartitioning describes an ordered key space with split points.

  • ordering defines the partitioning key and ordering.
  • split_points define the boundaries between adjacent partitions.

Comparisons use the lexicographic order defined by ordering, including ASC/DESC and null ordering. Split points must be strictly ordered according to that ordering, and each split point must have one value per ordering expression. See SplitPoint for the shared boundary convention.

Like other user-specified data properties such as sortedness, if a source declares range partitioning, it is responsible for placing each row in the partition described by the split points. DataFusion will not validate this is upheld.

For a single range key:

ordering = [date ASC NULLS LAST]
split_points = [
  (2022-01-01),
  (2023-01-01),
]

partition 0: date before 2022-01-01
partition 1: date between 2022-01-01 (inclusive) and 2023-01-01 (exclusive)
partition 2: date at/after 2023-01-01

The same model extends to compound keys. For ordering = [time ASC, city ASC], split points are ordered lexicographically by (time, city):

ordering = [time ASC NULLS LAST, city ASC NULLS LAST]
split_points = [
  (2022, Allston),
  (2023, Allston),
]

partition 0: keys before  (2022, Allston)
partition 1: keys between (2022, Allston) and (2023, Allston)
partition 2: keys at/after (2023, Allston)

NOTE: Optimizer and execution behavior for this partitioning is intentionally not implemented and will be introduced incrementally. See https://github.com/apache/datafusion/issues/22395.

Implementations§

Source§

impl RangePartitioning

Source

pub fn new(ordering: LexOrdering, split_points: Vec<SplitPoint>) -> Self

Creates range partitioning metadata without validating split points.

Use Self::try_new to validate the contract documented on RangePartitioning.

Source

pub fn try_new( ordering: LexOrdering, split_points: Vec<SplitPoint>, ) -> Result<Self>

Creates range partitioning metadata and validates split point shape and ordering.

Source

pub fn ordering(&self) -> &LexOrdering

Returns the ordering that defines the range key.

Source

pub fn split_points(&self) -> &[SplitPoint]

Returns the ordered split points between partitions.

Source

pub fn partition_count(&self) -> usize

Returns the number of partitions.

Trait Implementations§

Source§

impl Clone for RangePartitioning

Source§

fn clone(&self) -> RangePartitioning

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for RangePartitioning

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for RangePartitioning

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for RangePartitioning

Source§

fn eq(&self, other: &RangePartitioning) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RangePartitioning

Auto Trait Implementations§

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.