Skip to main content

CsvInferenceOptions

Struct CsvInferenceOptions 

Source
pub struct CsvInferenceOptions {
    pub delimiter: u8,
    pub has_header: bool,
    pub quote: Option<u8>,
    pub escape: Option<u8>,
    pub null_regex: Option<String>,
    pub max_sample_records: Option<usize>,
    pub column_name_mode: ColumnNameMode,
}
Expand description

Options for CSV schema inference.

Controls how CSV files are parsed and how column types are inferred. Use the builder pattern to customize options from the defaults.

§Example

let options = CsvInferenceOptions::new()
    .with_delimiter(b'\t')
    .with_has_header(false)
    .with_column_name_mode(ColumnNameMode::Sanitize);

Fields§

§delimiter: u8

Field delimiter byte (default: ,).

§has_header: bool

Whether the first row is a header (default: true).

§quote: Option<u8>

Quote character (default: Some(b'"')).

§escape: Option<u8>

Escape character (default: None).

§null_regex: Option<String>

Regex pattern for values treated as NULL (default: "^$" — empty string).

§max_sample_records: Option<usize>

Maximum number of records to sample for type inference (default: None — all rows).

§column_name_mode: ColumnNameMode

How to format column names in DDL output.

Implementations§

Source§

impl CsvInferenceOptions

Source

pub fn new() -> Self

Create a new CsvInferenceOptions with default values.

Source

pub fn with_delimiter(self, delimiter: u8) -> Self

Set the field delimiter.

Source

pub fn with_has_header(self, has_header: bool) -> Self

Set whether the CSV has a header row.

Source

pub fn with_quote(self, quote: Option<u8>) -> Self

Set the quote character.

Source

pub fn with_escape(self, escape: Option<u8>) -> Self

Set the escape character.

Source

pub fn with_null_regex(self, null_regex: Option<String>) -> Self

Set the null regex pattern.

Source

pub fn with_max_sample_records(self, max_sample_records: Option<usize>) -> Self

Set the maximum number of records to sample.

Source

pub fn with_column_name_mode(self, mode: ColumnNameMode) -> Self

Set the column name mode.

Trait Implementations§

Source§

impl Clone for CsvInferenceOptions

Source§

fn clone(&self) -> CsvInferenceOptions

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 CsvInferenceOptions

Source§

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

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

impl Default for CsvInferenceOptions

Source§

fn default() -> Self

Returns the “default value” for a type. 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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,