Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Feb 14, 2025
1 parent b566ed1 commit 81ac5c5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion datafusion/core/src/datasource/physical_plan/csv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ impl ExecutionPlan for CsvExec {
/// let file_scan_config = FileScanConfig::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;
/// let exec = file_scan_config.new_exec();
/// let exec = file_scan_config.build();
/// ```
#[derive(Debug, Clone, Default)]
pub struct CsvSource {
Expand Down
15 changes: 10 additions & 5 deletions datafusion/core/src/datasource/physical_plan/file_scan_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,21 @@ pub fn wrap_partition_value_in_dict(val: ScalarValue) -> ScalarValue {
/// # Example
/// ```
/// # use std::sync::Arc;
/// # use arrow::datatypes::Schema;
/// # use arrow::datatypes::{Field, Fields, DataType, Schema};
/// # use datafusion::datasource::listing::PartitionedFile;
/// # use datafusion::datasource::physical_plan::FileScanConfig;
/// # use datafusion_execution::object_store::ObjectStoreUrl;
/// # use datafusion::datasource::physical_plan::ArrowSource;
/// use datafusion_physical_plan::ExecutionPlan;
/// # let file_schema = Arc::new(Schema::empty());
/// // create FileScan config for reading data from file://
/// # use datafusion_physical_plan::ExecutionPlan;
/// # let file_schema = Arc::new(Schema::new(vec![
/// # Field::new("c1", DataType::Int32, false),
/// # Field::new("c2", DataType::Int32, false),
/// # Field::new("c3", DataType::Int32, false),
/// # ]);
/// // create FileScan config for reading arrow files from file://
/// let object_store_url = ObjectStoreUrl::local_filesystem();
/// let config = FileScanConfig::new(object_store_url, file_schema, Arc::new(ArrowSource::default()))
/// let file_source = Arc::new(ArrowSource::default());
/// let config = FileScanConfig::new(object_store_url, file_schema, file_source)
/// .with_limit(Some(1000)) // read only the first 1000 records
/// .with_projection(Some(vec![2, 3])) // project columns 2 and 3
/// // Read /tmp/file1.parquet with known size of 1234 bytes in a single group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ use object_store::ObjectStore;
/// // Create a DataSourceExec for reading `file1.parquet` with a file size of 100MB
/// let file_scan_config = FileScanConfig::new(object_store_url, file_schema, source)
/// .with_file(PartitionedFile::new("file1.parquet", 100*1024*1024));
/// let exec = file_scan_config.new_exec();
/// let exec = file_scan_config.build();
/// ```
///
/// # Features
Expand Down Expand Up @@ -176,7 +176,7 @@ use object_store::ObjectStore;
/// .clone()
/// .with_file_groups(vec![file_group.clone()]);
///
/// new_config.new_exec()
/// new_config.build()
/// })
/// .collect::<Vec<_>>();
/// ```
Expand Down Expand Up @@ -219,7 +219,7 @@ use object_store::ObjectStore;
/// .with_file(partitioned_file);
/// // this parquet DataSourceExec will not even try to read row groups 2 and 4. Additional
/// // pruning based on predicates may also happen
/// let exec = file_scan_config.new_exec();
/// let exec = file_scan_config.build();
/// ```
///
/// For a complete example, see the [`advanced_parquet_index` example]).
Expand Down

0 comments on commit 81ac5c5

Please sign in to comment.