nealrichardson commented on a change in pull request #11373:
URL: https://github.com/apache/arrow/pull/11373#discussion_r726452292
##########
File path: r/R/query-engine.R
##########
@@ -175,11 +180,33 @@ ExecPlan <- R6Class("ExecPlan",
temp_columns = names(.data$temp_columns)
)
}
+
+ # This is only safe because we are going to evaluate queries that end
+ # with head/tail first, then evaluate any subsequent query as a new query
+ if (!is.null(.data$head)) {
+ node$head <- .data$head
+ }
+ if (!is.null(.data$tail)) {
+ node$tail <- .data$tail
+ }
+
node
},
Run = function(node) {
assert_is(node, "ExecNode")
- ExecPlan_run(self, node, node$sort %||% list())
+ # TODO (ARROW-12763): pass head/tail to ExecPlan_run so we can maybe TopK
+ out <- ExecPlan_run(self, node, node$sort %||% list())
+
+ if (!is.null(node$head)) {
+ # These methods are on RecordBatchReader (but return Table)
+ # TODO: make the head/tail methods return RBR not Table
+ out <- head(out, node$head)
+ # TODO: can we now tell `self` to StopProducing? We already have
Review comment:
I've tried that, LMK if that's wrong to do
--
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]