viirya commented on code in PR #26035:
URL: https://github.com/apache/datafusion/pull/26035#discussion_r4250200397


##########
datafusion/substrait/src/logical_plan/producer/rel/read_rel.rs:
##########
@@ -108,6 +116,32 @@ pub fn from_table_scan(
                 advanced_extension: None,
             })),
         }))),
+    });
+
+    // ReadRel cannot represent pushed-down offsets or limits. Keep them with
+    // the scan, even when there is no parent Limit or a Projection separates 
it.
+    if scan.skip.is_none() && scan.fetch.is_none() {
+        return Ok(read);
+    }
+    let empty_schema = Arc::new(DFSchema::empty());
+    let offset_mode = skip
+        .map(|skip| producer.handle_expr(&lit(skip), &empty_schema))
+        .transpose()?
+        .map(Box::new)
+        .map(fetch_rel::OffsetMode::OffsetExpr);
+    let count_mode = fetch
+        .map(|fetch| producer.handle_expr(&lit(fetch), &empty_schema))
+        .transpose()?
+        .map(Box::new)
+        .map(fetch_rel::CountMode::CountExpr);

Review Comment:
   Thanks. Refactored it.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to