alamb commented on issue #9672:
URL: 
https://github.com/apache/arrow-datafusion/issues/9672#issuecomment-2016581536

   > Do you mean using the with_column method in DF? I think that doesn't make 
sense, and it can only add existing column by adding projection. 🤔
   
   As you point out, DataFusion's dataframe  can already add a new column as a 
derived expression (by using `project`).
   
   What it can't do is append a new column to an existing DataFrame:
   
   ```rust
   // Read 100 rows in
   let df = ctx.read_csv("tests/data/example.csv", 
CsvReadOptions::new()).await?;
   
   // Create a new column with 100 integers
   let new_column = RecordBatch::try_from_iter(vec![
     ("foo", Arc::new(Int32Array::from(0..100)))
   ]).unwrap();
   
   // Append the new column to the dataframe
   // (errors if the row counts don't match)
   let df = df.append_column(new_column).await?
   ```
   
   However, I am not sure how useful this feature would be


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