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

Method insert_into

datafusion/catalog/src/memory/table.rs:278–297  ·  view source on GitHub ↗

Returns an ExecutionPlan that inserts the execution results of a given [`ExecutionPlan`] into this [`MemTable`]. The [`ExecutionPlan`] must have the same schema as this [`MemTable`]. # Arguments `state` - The [`SessionState`] containing the context for executing the plan. `input` - The [`ExecutionPlan`] to execute and insert. # Returns A plan that returns the number of rows written. [`Sessio

(
        &self,
        _state: &dyn Session,
        input: Arc<dyn ExecutionPlan>,
        insert_op: InsertOp,
    )

Source from the content-addressed store, hash-verified

276 ///
277 /// [`SessionState`]: https://docs.rs/datafusion/latest/datafusion/execution/session_state/struct.SessionState.html
278 async fn insert_into(
279 &self,
280 _state: &dyn Session,
281 input: Arc<dyn ExecutionPlan>,
282 insert_op: InsertOp,
283 ) -> Result<Arc<dyn ExecutionPlan>> {
284 // If we are inserting into the table, any sort order may be messed up so reset it here
285 *self.sort_order.lock() = vec![];
286
287 // Create a physical plan from the logical plan.
288 // Check that the schema of the plan matches the schema of this table.
289 self.schema()
290 .logically_equivalent_names_and_types(&input.schema())?;
291
292 if insert_op != InsertOp::Append {
293 return not_impl_err!("{insert_op} not implemented for MemoryTable yet");
294 }
295 let sink = MemSink::try_new(self.batches.clone(), Arc::clone(&self.schema))?;
296 Ok(Arc::new(DataSinkExec::new(input, Arc::new(sink), None)))
297 }
298
299 fn get_column_default(&self, column: &str) -> Option<&Expr> {
300 self.column_defaults.get(column)

Callers

nothing calls this directly

Calls 4

newFunction · 0.85
schemaMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected