Skip to content

Commit 01f0446

Browse files
Write documentation, typos, clippy
1 parent 2d1ad86 commit 01f0446

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

datafusion/datasource/src/file_scan_config.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,11 @@ pub struct FileScanConfig {
177177
pub file_groups: Vec<FileGroup>,
178178
/// Table constraints
179179
pub constraints: Constraints,
180-
/// Columns on which to project the data. Indexes that are higher than the
181-
/// number of columns of `file_schema` refer to `table_partition_cols`.
180+
/// Physical expressions defining the projection to apply when reading data.
181+
///
182+
/// Each expression in the projection can reference columns from both the file
183+
/// schema and table partition columns. If `None`, all columns from the table
184+
/// schema are projected.
182185
pub projection: Option<ProjectionExprs>,
183186
/// The maximum number of records to read from this plan. If `None`,
184187
/// all records after filtering are returned.
@@ -263,7 +266,7 @@ pub struct FileScanConfigBuilder {
263266
table_schema: TableSchema,
264267
file_source: Arc<dyn FileSource>,
265268
limit: Option<usize>,
266-
projection: Option<Vec<usize>>,
269+
projection_indices: Option<Vec<usize>>,
267270
constraints: Option<Constraints>,
268271
file_groups: Vec<FileGroup>,
269272
statistics: Option<Statistics>,
@@ -296,7 +299,7 @@ impl FileScanConfigBuilder {
296299
file_compression_type: None,
297300
new_lines_in_values: None,
298301
limit: None,
299-
projection: None,
302+
projection_indices: None,
300303
constraints: None,
301304
batch_size: None,
302305
expr_adapter_factory: None,
@@ -326,7 +329,7 @@ impl FileScanConfigBuilder {
326329
/// Set the columns on which to project the data. Indexes that are higher than the
327330
/// number of columns of `file_schema` refer to `table_partition_cols`.
328331
pub fn with_projection(mut self, indices: Option<Vec<usize>>) -> Self {
329-
self.projection = indices;
332+
self.projection_indices = indices;
330333
self
331334
}
332335

@@ -439,7 +442,7 @@ impl FileScanConfigBuilder {
439442
table_schema,
440443
file_source,
441444
limit,
442-
projection,
445+
projection_indices: projection,
443446
constraints,
444447
file_groups,
445448
statistics,
@@ -494,7 +497,7 @@ impl From<FileScanConfig> for FileScanConfigBuilder {
494497
file_compression_type: Some(config.file_compression_type),
495498
new_lines_in_values: Some(config.new_lines_in_values),
496499
limit: config.limit,
497-
projection: config.projection.map(|p| p.ordered_column_indices()),
500+
projection_indices: config.projection.map(|p| p.ordered_column_indices()),
498501
constraints: Some(config.constraints),
499502
batch_size: config.batch_size,
500503
expr_adapter_factory: config.expr_adapter_factory,
@@ -827,9 +830,9 @@ impl FileScanConfig {
827830
let fields = self.file_schema().fields();
828831

829832
self.projection.as_ref().map(|p| {
830-
let column_indicies = p.ordered_column_indices();
833+
let column_indices = p.ordered_column_indices();
831834

832-
column_indicies
835+
column_indices
833836
.iter()
834837
.filter_map(|&col_i| {
835838
(col_i < fields.len()).then(|| self.file_schema().field(col_i).name())

datafusion/physical-expr/src/projection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl ProjectionExprs {
150150
}
151151

152152
pub fn from_indices(indices: &[usize], schema: &SchemaRef) -> Self {
153-
let projection_exprs = indices.into_iter().map(|&i| {
153+
let projection_exprs = indices.iter().map(|&i| {
154154
let field = schema.field(i);
155155
ProjectionExpr {
156156
expr: Arc::new(Column::new(field.name(), i)),

0 commit comments

Comments
 (0)