alamb commented on a change in pull request #747:
URL: https://github.com/apache/arrow-datafusion/pull/747#discussion_r672448317



##########
File path: datafusion/src/optimizer/projection_push_down.rs
##########
@@ -496,6 +506,60 @@ mod tests {
         Ok(())
     }
 
+    #[test]
+    fn redundunt_project() -> Result<()> {

Review comment:
       ```suggestion
       fn redundant_project() -> Result<()> {
   ```

##########
File path: datafusion/src/optimizer/projection_push_down.rs
##########
@@ -496,6 +506,60 @@ mod tests {
         Ok(())
     }
 
+    #[test]
+    fn redundunt_project() -> Result<()> {
+        let table_scan = test_table_scan()?;
+
+        let plan = LogicalPlanBuilder::from(table_scan)
+            .project(vec![col("a"), col("b"), col("c")])?
+            .project(vec![col("a"), col("c"), col("b")])?
+            .build()?;
+        let expected = "Projection: #test.a, #test.c, #test.b\
+        \n  TableScan: test projection=Some([0, 1, 2])";
+
+        assert_optimized_plan_eq(&plan, expected);
+
+        Ok(())
+    }
+
+    #[test]
+    fn reorder_projection() -> Result<()> {
+        let table_scan = test_table_scan()?;
+
+        let plan = LogicalPlanBuilder::from(table_scan)
+            .project(vec![col("c"), col("b"), col("a")])?
+            .build()?;
+        let expected = "Projection: #test.c, #test.b, #test.a\
+        \n  TableScan: test projection=Some([0, 1, 2])";
+
+        assert_optimized_plan_eq(&plan, expected);
+
+        Ok(())
+    }
+
+    #[test]
+    fn noncontiguous_redundunt_projection() -> Result<()> {

Review comment:
       ```suggestion
       fn noncontiguous_redundant_projection() -> Result<()> {
   ```




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