pub struct CsvSource { /* private fields */ }
Expand description
A Config for CsvOpener
§Example: create a DataSourceExec
for CSV
let source = Arc::new(CsvSource::new(
true,
b',',
b'"',
)
.with_terminator(Some(b'#')
));
// Create a DataSourceExec for reading the first 100MB of `file1.csv`
let config = FileScanConfigBuilder::new(object_store_url, file_schema, source)
.with_file(PartitionedFile::new("file1.csv", 100*1024*1024))
.with_newlines_in_values(true) // The file contains newlines in values;
.build();
let exec = (DataSourceExec::from_data_source(config));
Implementations§
Source§impl CsvSource
impl CsvSource
Sourcepub fn has_header(&self) -> bool
pub fn has_header(&self) -> bool
true if the first line of each file is a header
Sourcepub fn terminator(&self) -> Option<u8>
pub fn terminator(&self) -> Option<u8>
The line terminator
Sourcepub fn with_escape(&self, escape: Option<u8>) -> Self
pub fn with_escape(&self, escape: Option<u8>) -> Self
Initialize a CsvSource with escape
Sourcepub fn with_terminator(&self, terminator: Option<u8>) -> Self
pub fn with_terminator(&self, terminator: Option<u8>) -> Self
Initialize a CsvSource with terminator
Sourcepub fn with_comment(&self, comment: Option<u8>) -> Self
pub fn with_comment(&self, comment: Option<u8>) -> Self
Initialize a CsvSource with comment
Trait Implementations§
Source§impl FileSource for CsvSource
impl FileSource for CsvSource
Source§fn create_file_opener(
&self,
object_store: Arc<dyn ObjectStore>,
base_config: &FileScanConfig,
_partition: usize,
) -> Arc<dyn FileOpener>
fn create_file_opener( &self, object_store: Arc<dyn ObjectStore>, base_config: &FileScanConfig, _partition: usize, ) -> Arc<dyn FileOpener>
Creates a
dyn FileOpener
based on given parametersSource§fn with_batch_size(&self, batch_size: usize) -> Arc<dyn FileSource>
fn with_batch_size(&self, batch_size: usize) -> Arc<dyn FileSource>
Initialize new type with batch size configuration
Source§fn with_schema(&self, schema: SchemaRef) -> Arc<dyn FileSource>
fn with_schema(&self, schema: SchemaRef) -> Arc<dyn FileSource>
Initialize new instance with a new schema
Source§fn with_statistics(&self, statistics: Statistics) -> Arc<dyn FileSource>
fn with_statistics(&self, statistics: Statistics) -> Arc<dyn FileSource>
Initialize new instance with projected statistics
Source§fn with_projection(&self, config: &FileScanConfig) -> Arc<dyn FileSource>
fn with_projection(&self, config: &FileScanConfig) -> Arc<dyn FileSource>
Initialize new instance with projection information
Source§fn metrics(&self) -> &ExecutionPlanMetricsSet
fn metrics(&self) -> &ExecutionPlanMetricsSet
Return execution plan metrics
Source§fn statistics(&self) -> Result<Statistics>
fn statistics(&self) -> Result<Statistics>
Return projected statistics
Source§fn file_type(&self) -> &str
fn file_type(&self) -> &str
String representation of file source such as “csv”, “json”, “parquet”
Source§fn fmt_extra(&self, t: DisplayFormatType, f: &mut Formatter<'_>) -> Result
fn fmt_extra(&self, t: DisplayFormatType, f: &mut Formatter<'_>) -> Result
Format FileType specific information
Source§fn repartitioned(
&self,
target_partitions: usize,
repartition_file_min_size: usize,
output_ordering: Option<LexOrdering>,
config: &FileScanConfig,
) -> Result<Option<FileScanConfig>, DataFusionError>
fn repartitioned( &self, target_partitions: usize, repartition_file_min_size: usize, output_ordering: Option<LexOrdering>, config: &FileScanConfig, ) -> Result<Option<FileScanConfig>, DataFusionError>
If supported by the
FileSource
, redistribute files across partitions according to their size.
Allows custom file formats to implement their own repartitioning logic. Read moreAuto Trait Implementations§
impl Freeze for CsvSource
impl !RefUnwindSafe for CsvSource
impl Send for CsvSource
impl Sync for CsvSource
impl Unpin for CsvSource
impl !UnwindSafe for CsvSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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