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

Method try_new

datafusion/datasource/src/memory.rs:264–279  ·  view source on GitHub ↗

Create a new `MemorySourceConfig` for reading in-memory record batches The provided `schema` should not have the projection applied.

(
        partitions: &[Vec<RecordBatch>],
        schema: SchemaRef,
        projection: Option<Vec<usize>>,
    )

Source from the content-addressed store, hash-verified

262 /// Create a new `MemorySourceConfig` for reading in-memory record batches
263 /// The provided `schema` should not have the projection applied.
264 pub fn try_new(
265 partitions: &[Vec<RecordBatch>],
266 schema: SchemaRef,
267 projection: Option<Vec<usize>>,
268 ) -> Result<Self> {
269 let projected_schema = project_schema(&schema, projection.as_ref())?;
270 Ok(Self {
271 partitions: partitions.to_vec(),
272 schema,
273 projected_schema,
274 projection,
275 sort_information: vec![],
276 show_sizes: true,
277 fetch: None,
278 })
279 }
280
281 /// Create a new `DataSourceExec` plan for reading in-memory record batches
282 /// The provided `schema` should not have the projection applied.

Callers

nothing calls this directly

Calls 4

project_schemaFunction · 0.85
to_vecMethod · 0.80
as_refMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected