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/09/20 14:24:25 UTC
[GitHub] [arrow] eitsupi opened a new pull request, #14175: ARROW-17737: [R] Continue to retain grouping metadata even if ungroup arrow dplyr query
eitsupi opened a new pull request, #14175:
URL: https://github.com/apache/arrow/pull/14175
(It is based on #14160)
--
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
[GitHub] [arrow] ursabot commented on pull request #14175: ARROW-17737: [R] Groups before conversion to a Table must not be restored after `collect()`
Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #14175:
URL: https://github.com/apache/arrow/pull/14175#issuecomment-1279887306
Benchmark runs are scheduled for baseline = d1a8f4ba19f6dcb2ddbd5fb50a88d37b17c39cea and contender = d008c17e24cea758bb03a6e25563f0fd7b95e008. d008c17e24cea758bb03a6e25563f0fd7b95e008 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished :arrow_down:0.0% :arrow_up:0.0%] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/ca118f2b462146e08fe57fb13eb7a363...84056121d27e4663b9f0a0ff16d7921b/)
[Failed :arrow_down:1.11% :arrow_up:0.0%] [test-mac-arm](https://conbench.ursa.dev/compare/runs/24feaadd869341ee9387e6bead832f6d...e4709716b2f54ad9a91ff659fc5d08c9/)
[Failed :arrow_down:0.0% :arrow_up:0.0%] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/be64611253a549d098e5e1c7f373f092...ac986436cea340f78ba0180c9958a686/)
[Finished :arrow_down:0.18% :arrow_up:0.0%] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/cd8f2b99553c4bea8bbb640a8796450d...874b91be434a414da652a2307be20ccd/)
Buildkite builds:
[Finished] [`d008c17e` ec2-t3-xlarge-us-east-2](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/1704)
[Failed] [`d008c17e` test-mac-arm](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/1723)
[Failed] [`d008c17e` ursa-i9-9960x](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/1706)
[Finished] [`d008c17e` ursa-thinkcentre-m75q](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/1717)
[Finished] [`d1a8f4ba` ec2-t3-xlarge-us-east-2](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/1703)
[Failed] [`d1a8f4ba` test-mac-arm](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/1722)
[Failed] [`d1a8f4ba` ursa-i9-9960x](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/1705)
[Finished] [`d1a8f4ba` ursa-thinkcentre-m75q](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/1716)
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
--
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
[GitHub] [arrow] ursabot commented on pull request #14175: ARROW-17737: [R] Groups before conversion to a Table must not be restored after `collect()`
Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #14175:
URL: https://github.com/apache/arrow/pull/14175#issuecomment-1279887335
['Python', 'R'] benchmarks have high level of regressions.
[test-mac-arm](https://conbench.ursa.dev/compare/runs/24feaadd869341ee9387e6bead832f6d...e4709716b2f54ad9a91ff659fc5d08c9/)
--
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
[GitHub] [arrow] nealrichardson commented on a diff in pull request #14175: ARROW-17737: [R] Groups before conversion to a Table must not be restored after `collect()`
Posted by GitBox <gi...@apache.org>.
nealrichardson commented on code in PR #14175:
URL: https://github.com/apache/arrow/pull/14175#discussion_r991612998
##########
r/R/dplyr-collect.R:
##########
@@ -27,6 +27,10 @@ collect.arrow_dplyr_query <- function(x, as_data_frame = TRUE, ...) {
augment_io_error_msg(e, call, schema = x$.data$schema)
}
)
+ # Ungroup the Table before converting this to a data frame
Review Comment:
I wonder if it would be simpler to move the `ungroup()` logic to `arrow_dplyr_query()` (specifically, around L48 in dplyr.R). That way, we know that there are no lingering groups in metadata anywhere once we're doing a dplyr query, the single source of truth is the `arrow_dplyr_query` object.
--
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
[GitHub] [arrow] github-actions[bot] commented on pull request #14175: ARROW-17737: [R] Continue to retain grouping metadata even if ungroup arrow dplyr query
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #14175:
URL: https://github.com/apache/arrow/pull/14175#issuecomment-1252455800
https://issues.apache.org/jira/browse/ARROW-17737
--
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
[GitHub] [arrow] eitsupi commented on a diff in pull request #14175: ARROW-17737: [R] Continue to retain grouping metadata even if ungroup arrow dplyr query
Posted by GitBox <gi...@apache.org>.
eitsupi commented on code in PR #14175:
URL: https://github.com/apache/arrow/pull/14175#discussion_r975560514
##########
r/R/dplyr-collect.R:
##########
@@ -60,20 +62,23 @@ restore_dplyr_features <- function(df, query) {
# An arrow_dplyr_query holds some attributes that Arrow doesn't know about
# After calling collect(), make sure these features are carried over
- if (length(query$group_by_vars) > 0) {
+ if (is.data.frame(df)) {
# Preserve groupings, if present
- if (is.data.frame(df)) {
+ if (length(query$group_by_vars) > 0) {
df <- dplyr::grouped_df(
df,
dplyr::group_vars(query),
drop = dplyr::group_by_drop_default(query)
)
+ }
+ } else {
+ # This is a Table, via compute() or collect(as_data_frame = FALSE)
+ if (length(query$group_by_vars) > 0) {
+ gv <- query$group_by_vars
} else {
- # This is a Table, via compute() or collect(as_data_frame = FALSE)
- df <- as_adq(df)
- df$group_by_vars <- query$group_by_vars
- df$drop_empty_groups <- query$drop_empty_groups
+ gv <- NULL
Review Comment:
Perhaps `restore_dplyr_features` should make sure that `df` is not grouped.
If it is guaranteed that `df` is not grouped, this case will be unnecessary.
--
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
[GitHub] [arrow] nealrichardson merged pull request #14175: ARROW-17737: [R] Groups before conversion to a Table must not be restored after `collect()`
Posted by GitBox <gi...@apache.org>.
nealrichardson merged PR #14175:
URL: https://github.com/apache/arrow/pull/14175
--
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
[GitHub] [arrow] eitsupi commented on a diff in pull request #14175: ARROW-17737: [R] Groups before conversion to a Table must not be restored after `collect()`
Posted by GitBox <gi...@apache.org>.
eitsupi commented on code in PR #14175:
URL: https://github.com/apache/arrow/pull/14175#discussion_r992227599
##########
r/R/dplyr-collect.R:
##########
@@ -27,6 +27,10 @@ collect.arrow_dplyr_query <- function(x, as_data_frame = TRUE, ...) {
augment_io_error_msg(e, call, schema = x$.data$schema)
}
)
+ # Ungroup the Table before converting this to a data frame
Review Comment:
Thanks for the suggestion.
I assumed that `arrow_dplyr_query$.data` must have the original object stored as is.
I will update it as you suggested, as it seems to pass the test!
--
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
[GitHub] [arrow] nealrichardson commented on a diff in pull request #14175: ARROW-17737: [R] Groups before conversion to a Table must not be restored after `collect()`
Posted by GitBox <gi...@apache.org>.
nealrichardson commented on code in PR #14175:
URL: https://github.com/apache/arrow/pull/14175#discussion_r993767906
##########
r/R/dplyr.R:
##########
@@ -49,6 +49,11 @@ arrow_dplyr_query <- function(.data) {
if (inherits(.data, "data.frame")) {
.data <- Table$create(.data)
}
+ # If .data is a Table, it must be ungrouped (ARROW-17737)
Review Comment:
```suggestion
# ARROW-17737: If .data is a Table, remove groups from metadata
# (we've already grabbed the groups above)
```
##########
r/R/dplyr-collect.R:
##########
@@ -58,17 +58,21 @@ restore_dplyr_features <- function(df, query) {
# An arrow_dplyr_query holds some attributes that Arrow doesn't know about
# After calling collect(), make sure these features are carried over
- if (length(query$group_by_vars) > 0) {
- # Preserve groupings, if present
+ if (length(dplyr::group_vars(df))) {
Review Comment:
Do we need any of these changes? Seems like the change in dplyr.R should be enough.
##########
r/R/dplyr.R:
##########
@@ -49,6 +49,11 @@ arrow_dplyr_query <- function(.data) {
if (inherits(.data, "data.frame")) {
.data <- Table$create(.data)
}
+ # If .data is a Table, it must be ungrouped (ARROW-17737)
+ if (length(group_vars.ArrowTabular(.data))) {
+ .data <- ungroup.ArrowTabular(.data)
+ }
Review Comment:
Should only do this on Table/RecordBatch
```suggestion
if (inherits(.data, "ArrowTabular")) {
.data <- ungroup.ArrowTabular(.data)
}
```
--
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
[GitHub] [arrow] eitsupi commented on a diff in pull request #14175: ARROW-17737: [R] Continue to retain grouping metadata even if ungroup arrow dplyr query
Posted by GitBox <gi...@apache.org>.
eitsupi commented on code in PR #14175:
URL: https://github.com/apache/arrow/pull/14175#discussion_r990536980
##########
r/R/dplyr.R:
##########
@@ -182,7 +182,7 @@ dim.arrow_dplyr_query <- function(x) {
# Query on in-memory Table, so evaluate the filter
# Don't need any columns
x <- select.arrow_dplyr_query(x, NULL)
- rows <- nrow(compute.arrow_dplyr_query(x))
+ rows <- nrow(as_arrow_table(x))
Review Comment:
This is because manipulating metadata for a table with no rows will cause the size to be updated to 0 x 0.
``` r
mtcars |> arrow::arrow_table() |> dplyr::select(NULL) |> arrow::as_arrow_table()
#> Table
#> 32 rows x 0 columns
#>
#>
#> See $metadata for additional Schema metadata
mtcars |> arrow::arrow_table() |> dplyr::select(NULL) |> arrow::as_arrow_table() |> dplyr::ungroup()
#> Table
#> 0 rows x 0 columns
#>
#>
#> See $metadata for additional Schema metadata
```
<sup>Created on 2022-10-07 with [reprex v2.0.2](https://reprex.tidyverse.org)</sup>
I don't know if this (handling of tables with no rows) is a problem.
A table with 0 rows and multiple columns appears to be quite exceptional, since creating a table from a data frame with no rows results in 0 x 0.
``` r
mtcars |> dplyr::select(NULL) |> arrow::arrow_table()
#> Table
#> 0 rows x 0 columns
#>
#>
#> See $metadata for additional Schema metadata
```
<sup>Created on 2022-10-07 with [reprex v2.0.2](https://reprex.tidyverse.org)</sup>
--
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
[GitHub] [arrow] eitsupi commented on a diff in pull request #14175: ARROW-17737: [R] Continue to retain grouping metadata even if ungroup arrow dplyr query
Posted by GitBox <gi...@apache.org>.
eitsupi commented on code in PR #14175:
URL: https://github.com/apache/arrow/pull/14175#discussion_r990536980
##########
r/R/dplyr.R:
##########
@@ -182,7 +182,7 @@ dim.arrow_dplyr_query <- function(x) {
# Query on in-memory Table, so evaluate the filter
# Don't need any columns
x <- select.arrow_dplyr_query(x, NULL)
- rows <- nrow(compute.arrow_dplyr_query(x))
+ rows <- nrow(as_arrow_table(x))
Review Comment:
This is because manipulating metadata for a table with no rows will cause the size to be updated to 0 x 0.
``` r
mtcars |> arrow::arrow_table() |> dplyr::select(NULL) |> arrow::as_arrow_table()
#> Table
#> 32 rows x 0 columns
#>
#>
#> See $metadata for additional Schema metadata
mtcars |> arrow::arrow_table() |> dplyr::select(NULL) |> arrow::as_arrow_table() |> dplyr::ungroup()
#> Table
#> 0 rows x 0 columns
#>
#>
#> See $metadata for additional Schema metadata
```
<sup>Created on 2022-10-07 with [reprex v2.0.2](https://reprex.tidyverse.org)</sup>
I don't know if this (handling of tables with no rows) is the problem.
--
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