You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/07/07 13:45:14 UTC

[GitHub] [arrow-datafusion] andygrove commented on a diff in pull request #2846: Adding dataframe with_column function

andygrove commented on code in PR #2846:
URL: https://github.com/apache/arrow-datafusion/pull/2846#discussion_r915892869


##########
datafusion/core/src/dataframe.rs:
##########
@@ -1007,4 +1047,37 @@ mod tests {
         .await?;
         Ok(())
     }
+
+    #[tokio::test]
+    async fn with_column() -> Result<()> {
+        let df = test_table().await?.select_columns(&["c1", "c2", "c3"])?;
+        let ctx = SessionContext::new();
+        let df_impl = Arc::new(DataFrame::new(ctx.state.clone(), &df.plan.clone()));
+
+        // check that we correctly read from the table
+        let df_results = &df_impl
+            .filter(col("c2").eq(lit(3)))?
+            .filter(col("c1").eq(lit("a")))?

Review Comment:
   `Expr` has `and` and `or` implemented so you should be able to write it like this?
   
   ```suggestion
               .filter(col("c2").eq(lit(3)).and(col("c1").eq(lit("a"))))?
   ```



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org