Skip to main content

MergeSpec

Struct MergeSpec 

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

A merge operation: several tables into one, with no user job.

What a sort does for order, a merge does for chunk layout — and in MergeMode::Sorted it is the cheap way to combine tables that are already sorted, because nothing has to be sorted again.

use ytsaurus_client::{MergeMode, MergeSpec};

let spec = MergeSpec::new(["//tmp/monday", "//tmp/tuesday"], "//tmp/week")
    .with_mode(MergeMode::Sorted)
    .with_merge_by(["host"]);

Implementations§

Source§

impl MergeSpec

Source

pub fn new<I>(inputs: I, output: impl Into<String>) -> Self
where I: IntoIterator, I::Item: Into<String>,

Merges inputs into output, unordered.

Source

pub fn with_mode(self, mode: MergeMode) -> Self

Chooses how the inputs are combined.

Source

pub fn with_merge_by<K>(self, columns: K) -> Self
where K: IntoIterator, K::Item: Into<String>,

The columns a MergeMode::Sorted merge merges by.

The output table comes back sorted by these. Optional: a sorted merge sent without it is accepted, and the cluster uses the sort columns the inputs already have. Naming them is how to merge by a prefix of that, and how to make the assumption visible where it is being made.

Source

pub fn with_combine_chunks(self, combine: bool) -> Self

Asks the cluster to combine small chunks while it merges.

This is most of why a merge is worth running on one table: a table written in many small pieces reads faster afterwards.

Source

pub fn with_force_transform(self, force: bool) -> Self

Runs the jobs even when the merge could be done by moving chunks.

A merge that has nothing to do normally just relinks chunks. Set this when the point is the rewrite — a change of compression codec or erasure coding, which only happens where rows are actually copied.

Source

pub fn with_job_count(self, count: i64) -> Self

Asks for a particular number of jobs.

Takes precedence over data_size_per_job, which the cluster otherwise uses to decide.

Source

pub fn with_raw(self, key: impl Into<String>, value: YsonValue) -> Self

Sets any spec field this builder does not model — data_size_per_job, schema_inference_mode and the rest.

Source

pub fn to_yson(&self) -> YsonValue

Renders the spec.

Trait Implementations§

Source§

impl Clone for MergeSpec

Source§

fn clone(&self) -> MergeSpec

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 MergeSpec

Source§

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

Formats the value using the given formatter. Read more

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more