MCPcopy Create free account
hub / github.com/apache/datafusion / open

Method open

datafusion/datasource/src/projection.rs:70–97  ·  view source on GitHub ↗
(&self, partitioned_file: PartitionedFile)

Source from the content-addressed store, hash-verified

68
69impl FileOpener for ProjectionOpener {
70 fn open(&self, partitioned_file: PartitionedFile) -> Result<FileOpenFuture> {
71 let partition_values = partitioned_file.partition_values.clone();
72 // Modify any references to partition columns in the projection expressions
73 // and substitute them with literal values from PartitionedFile.partition_values
74 let projection = if self.partition_columns.is_empty() {
75 self.projection.clone()
76 } else {
77 inject_partition_columns_into_projection(
78 &self.projection,
79 &self.partition_columns,
80 partition_values,
81 )
82 };
83 let projector = projection.make_projector(&self.input_schema)?;
84
85 let inner = self.inner.open(partitioned_file)?;
86
87 Ok(async move {
88 let stream = inner.await?;
89 let stream = stream.map(move |batch| {
90 let batch = batch?;
91 let batch = projector.project_batch(&batch)?;
92 Ok(batch)
93 });
94 Ok(stream.boxed())
95 }
96 .boxed())
97 }
98}
99
100#[derive(Debug, Clone, Copy)]

Callers

nothing calls this directly

Calls 6

make_projectorMethod · 0.80
cloneMethod · 0.45
is_emptyMethod · 0.45
mapMethod · 0.45
project_batchMethod · 0.45

Tested by

no test coverage detected