metesynnada commented on code in PR #5520:
URL: https://github.com/apache/arrow-datafusion/pull/5520#discussion_r1133821157


##########
datafusion/core/src/execution/context.rs:
##########
@@ -318,6 +319,19 @@ impl SessionContext {
         let plan = self.state().create_logical_plan(sql).await?;
 
         match plan {
+            LogicalPlan::Dml(DmlStatement {
+                table_name,
+                op: WriteOp::Insert,
+                input,
+                ..
+            }) => {
+                if self.table_exist(&table_name)? {

Review Comment:
   Addressed 👍🏻



##########
datafusion/core/src/datasource/memory.rs:
##########
@@ -388,4 +465,115 @@ mod tests {
 
         Ok(())
     }
+
+    #[tokio::test]
+    async fn test_insert_into_single_partition() -> Result<()> {
+        // Create a new session context
+        let session_ctx = SessionContext::new();
+        // Create a new schema with one field called "a" of type Int32
+        let schema = Arc::new(Schema::new(vec![Field::new("a", 
DataType::Int32, false)]));
+
+        // Create a new batch of data to insert into the table
+        let batch = RecordBatch::try_new(
+            schema.clone(),
+            vec![Arc::new(Int32Array::from_slice([1, 2, 3]))],
+        )?;
+        // Create a new table with one partition that contains the batch of 
data
+        let initial_table = Arc::new(MemTable::try_new(

Review Comment:
   Addressed 👍🏻



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to