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/11/18 20:34:40 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #4276: Reimplement `limit_push_down`

alamb commented on code in PR #4276:
URL: https://github.com/apache/arrow-datafusion/pull/4276#discussion_r1026854991


##########
datafusion/optimizer/src/limit_push_down.rs:
##########
@@ -635,13 +481,8 @@ mod test {
             .limit(0, Some(10))?
             .build()?;
 
-        // Should push down the smallest limit
-        // Towards table scan
-        // This rule doesn't replace multiple limits
-        let expected = "Limit: skip=0, fetch=10\
-        \n  Limit: skip=0, fetch=10\
-        \n    Limit: skip=10, fetch=10\
-        \n      TableScan: test, fetch=20";
+        let expected = "Limit: skip=10, fetch=10\

Review Comment:
   Those plans look much nicer



##########
datafusion/optimizer/src/limit_push_down.rs:
##########
@@ -576,8 +424,8 @@ mod test {
 
         // Should push the limit down to table provider
         // When it has a select
-        let expected = "Limit: skip=10, fetch=1000\
-        \n  Projection: test.a\
+        let expected = "Projection: test.a\
+        \n  Limit: skip=10, fetch=1000\
         \n    TableScan: test, fetch=1010";

Review Comment:
   https://github.com/apache/arrow-datafusion/blob/8c02485cfc3d2c48bc48a557db58e3e5a0f75777/datafusion/core/src/datasource/datasource.rs#L66-L70
   
   Implies that in fact we still need the `Limit` node even when it has been pushed to the scan as well



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