dragosmg commented on code in PR #13541:
URL: https://github.com/apache/arrow/pull/13541#discussion_r927523461
##########
r/R/query-engine.R:
##########
@@ -259,9 +260,39 @@ ExecPlan <- R6Class("ExecPlan",
...
)
},
+ # SinkNodes (involved in arrange and/or head/tail operations) are created
in
+ # ExecPlan_run and are not captured by the regular print method. We take a
+ # similar approach to expose them before calling the print method.
+ BuildAndShow = function(node) {
+ assert_is(node, "ExecNode")
+
+ # Sorting and head/tail (if sorted) are handled in the SinkNode,
+ # created in ExecPlan_run
+ sorting <- node$extras$sort %||% list()
+ select_k <- node$extras$head %||% -1L
+ has_sorting <- length(sorting) > 0
+ if (has_sorting) {
+ if (!is.null(node$extras$tail)) {
+ # Reverse the sort order and take the top K, then after we'll reverse
+ # the resulting rows so that it is ordered as expected
+ sorting$orders <- !sorting$orders
+ select_k <- node$extras$tail
+ }
+ sorting$orders <- as.integer(sorting$orders)
+ }
Review Comment:
Done.
--
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]