You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Jonathan Keane (Jira)" <ji...@apache.org> on 2021/09/24 19:45:00 UTC

[jira] [Commented] (ARROW-13893) [R] Improve head/tail/[ methods on Dataset and queries

    [ https://issues.apache.org/jira/browse/ARROW-13893?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17419951#comment-17419951 ] 

Jonathan Keane commented on ARROW-13893:
----------------------------------------

The current behavior is a bit surprising even when it "should" be defined:

{code:r}
> library(arrow)
> library(dplyr)
> 
> tab <- Table$create(mtcars)
> 
> tab %>% 
+   arrange(mpg) %>% 
+   head(4) %>% 
+   collect()
   mpg cyl disp  hp drat    wt  qsec vs am gear carb
1 21.0   6  160 110 3.90 2.620 16.46  0  1    4    4
2 21.0   6  160 110 3.90 2.875 17.02  0  1    4    4
3 22.8   4  108  93 3.85 2.320 18.61  1  1    4    1
4 21.4   6  258 110 3.08 3.215 19.44  1  0    3    1
> 
> mtcars %>% 
+   arrange(mpg) %>% 
+   head(4) %>% 
+   collect()
                     mpg cyl disp  hp drat    wt  qsec vs am gear carb
Cadillac Fleetwood  10.4   8  472 205 2.93 5.250 17.98  0  0    3    4
Lincoln Continental 10.4   8  460 215 3.00 5.424 17.82  0  0    3    4
Camaro Z28          13.3   8  350 245 3.73 3.840 15.41  0  0    3    4
Duster 360          14.3   8  360 245 3.21 3.570 15.84  0  0    3    4
{code}

I know there's some work to determine if `head()` could/should be defined int he absence of an explicit order, but after an `arrange()` it should work.

> [R] Improve head/tail/[ methods on Dataset and queries
> ------------------------------------------------------
>
>                 Key: ARROW-13893
>                 URL: https://issues.apache.org/jira/browse/ARROW-13893
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: R
>            Reporter: Neal Richardson
>            Assignee: Neal Richardson
>            Priority: Major
>             Fix For: 6.0.0
>
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)