datafusion_common::config

Struct CsvOptions

Source
pub struct CsvOptions {
Show 16 fields pub has_header: Option<bool>, pub delimiter: u8, pub quote: u8, pub terminator: Option<u8>, pub escape: Option<u8>, pub double_quote: Option<bool>, pub newlines_in_values: Option<bool>, pub compression: CompressionTypeVariant, pub schema_infer_max_rec: usize, pub date_format: Option<String>, pub datetime_format: Option<String>, pub timestamp_format: Option<String>, pub timestamp_tz_format: Option<String>, pub time_format: Option<String>, pub null_value: Option<String>, pub comment: Option<u8>,
}
Expand description

Options controlling CSV format

Fields§

§has_header: Option<bool>

Specifies whether there is a CSV header (i.e. the first line consists of is column names). The value None indicates that the configuration should be consulted.

§delimiter: u8§quote: u8§terminator: Option<u8>§escape: Option<u8>§double_quote: Option<bool>§newlines_in_values: Option<bool>

Specifies whether newlines in (quoted) values are supported.

Parsing newlines in quoted values may be affected by execution behaviour such as parallel file scanning. Setting this to true ensures that newlines in values are parsed successfully, which may reduce performance.

The default behaviour depends on the datafusion.catalog.newlines_in_values setting.

§compression: CompressionTypeVariant§schema_infer_max_rec: usize§date_format: Option<String>§datetime_format: Option<String>§timestamp_format: Option<String>§timestamp_tz_format: Option<String>§time_format: Option<String>§null_value: Option<String>§comment: Option<u8>

Implementations§

Source§

impl CsvOptions

Source

pub fn with_compression( self, compression_type_variant: CompressionTypeVariant, ) -> Self

Set a limit in terms of records to scan to infer the schema

  • default to DEFAULT_SCHEMA_INFER_MAX_RECORD
Source

pub fn with_schema_infer_max_rec(self, max_rec: usize) -> Self

Set a limit in terms of records to scan to infer the schema

  • default to DEFAULT_SCHEMA_INFER_MAX_RECORD
Source

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

Set true to indicate that the first line is a header.

  • default to true
Source

pub fn has_header(&self) -> Option<bool>

Returns true if the first line is a header. If format options does not specify whether there is a header, returns None (indicating that the configuration should be consulted).

Source

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

The character separating values within a row.

  • default to ‘,’
Source

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

The quote character in a row.

  • default to ‘“’
Source

pub fn with_terminator(self, terminator: Option<u8>) -> Self

The character that terminates a row.

  • default to None (CRLF)
Source

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

The escape character in a row.

  • default is None
Source

pub fn with_double_quote(self, double_quote: bool) -> Self

Set true to indicate that the CSV quotes should be doubled.

  • default to true
Source

pub fn with_newlines_in_values(self, newlines_in_values: bool) -> Self

Specifies whether newlines in (quoted) values are supported.

Parsing newlines in quoted values may be affected by execution behaviour such as parallel file scanning. Setting this to true ensures that newlines in values are parsed successfully, which may reduce performance.

The default behaviour depends on the datafusion.catalog.newlines_in_values setting.

Source

pub fn with_file_compression_type( self, compression: CompressionTypeVariant, ) -> Self

Set a CompressionTypeVariant of CSV

  • defaults to CompressionTypeVariant::UNCOMPRESSED
Source

pub fn delimiter(&self) -> u8

The delimiter character.

Source

pub fn quote(&self) -> u8

The quote character.

Source

pub fn terminator(&self) -> Option<u8>

The terminator character.

Source

pub fn escape(&self) -> Option<u8>

The escape character.

Trait Implementations§

Source§

impl Clone for CsvOptions

Source§

fn clone(&self) -> CsvOptions

Returns a copy 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 ConfigField for CsvOptions

Source§

fn set(&mut self, key: &str, value: &str) -> Result<()>

Source§

fn visit<V: Visit>( &self, v: &mut V, key_prefix: &str, _description: &'static str, )

Source§

impl Debug for CsvOptions

Source§

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

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

impl Default for CsvOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for CsvOptions

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<&CsvOptions> for CsvWriterOptions

Source§

type Error = DataFusionError

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

fn try_from(value: &CsvOptions) -> Result<Self>

Performs the conversion.
Source§

impl StructuralPartialEq for CsvOptions

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> 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> Allocation for T
where T: RefUnwindSafe + Send + Sync,