xudong963 commented on code in PR #4514:
URL: https://github.com/apache/arrow-datafusion/pull/4514#discussion_r1039686327


##########
datafusion/core/tests/sqllogictests/src/insert/mod.rs:
##########
@@ -74,12 +72,20 @@ pub async fn insert(ctx: &SessionContext, insert_stmt: 
&SQLStatement) -> Result<
             .collect::<std::result::Result<Vec<DFExpr>, DataFusionError>>()?;
         // Directly use `select` to get `RecordBatch`
         let dataframe = ctx.read_empty()?;
-        insert_batches.push(dataframe.select(logical_exprs)?.collect().await?)
+        
insert_batches.extend(dataframe.select(logical_exprs)?.collect().await?)
     }
 
-    // Final, append the `RecordBatch` to memtable's batches
-    let mut table_batches = table_batches.write();
-    table_batches.extend(insert_batches);
+    // Replace new batches schema to old schema
+    for batch in insert_batches.iter_mut() {
+        origin_batches.push(RecordBatch::try_new(
+            schema.clone(),
+            batch.columns().to_vec(),
+        )?);

Review Comment:
   The ideal way should be concating columns of `origin_batches` and 
`insert_batches`, then create new `RecordBatch`es with origin schema and 
concated columns.
   
   But seems arrow-rs doesn't provide similar APIs, so I just use the current 
way.



-- 
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