Skip to content

GH-38376 [R]: Add dimnames method to Dataset class #38377

Merged
thisisnic merged 2 commits into
apache:mainfrom
jonkeane:dataset-dimnames
Oct 22, 2023
Merged

GH-38376 [R]: Add dimnames method to Dataset class #38377
thisisnic merged 2 commits into
apache:mainfrom
jonkeane:dataset-dimnames

Conversation

@jonkeane
Copy link
Copy Markdown
Member

@jonkeane jonkeane commented Oct 20, 2023

Rationale for this change

Add dimnames method so that things like colnames(ds) work out of the box on datasets. Inspired by dbplyr's lazy tbl implementation

What changes are included in this PR?

An additional dimnames method for Dataset objects

Are these changes tested?

Yes

Are there any user-facing changes?

Yes

Copy link
Copy Markdown
Member

@paleolimbot paleolimbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@github-actions github-actions Bot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels Oct 20, 2023
Comment thread r/R/dataset.R
dim.Dataset <- function(x) c(x$num_rows, x$num_cols)

#' @export
dimnames.Dataset <- function(x) list(NULL, names(x))
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might consider a message here that tells folks that the NULL doesn't mean there are none. But then again dbplyr doesn't do that!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think copying dbplyr's behaviour is the best route. Is this already handled for Table?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's not immediately obvious, but Tables all inherit ArrowTabular which has dimnames.ArrowTabular defined already

@github-actions github-actions Bot added awaiting changes Awaiting changes and removed awaiting merge Awaiting merge labels Oct 20, 2023
@github-actions github-actions Bot added awaiting change review Awaiting change review awaiting changes Awaiting changes and removed awaiting changes Awaiting changes awaiting change review Awaiting change review labels Oct 20, 2023
Copy link
Copy Markdown
Member

@thisisnic thisisnic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers @jonkeane!

@thisisnic thisisnic merged commit f489996 into apache:main Oct 22, 2023
@thisisnic thisisnic removed the awaiting changes Awaiting changes label Oct 22, 2023
@github-actions github-actions Bot added the awaiting merge Awaiting merge label Oct 22, 2023
@conbench-apache-arrow
Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 6 benchmarking runs that have been run so far on merge-commit f489996.

There was 1 benchmark result indicating a performance regression:

The full Conbench report has more details.

loicalleyne pushed a commit to loicalleyne/arrow that referenced this pull request Nov 13, 2023
…38377)

### Rationale for this change

Add `dimnames` method so that things like `colnames(ds)` work out of the box on datasets. Inspired by dbplyr's lazy tbl implementation

### What changes are included in this PR?

An additional `dimnames` method for Dataset objects

### Are these changes tested?

Yes

### Are there any user-facing changes?

Yes
* Closes: apache#38376

Authored-by: Jonathan Keane <jkeane@gmail.com>
Signed-off-by: Nic Crane <thisisnic@gmail.com>
dgreiss pushed a commit to dgreiss/arrow that referenced this pull request Feb 19, 2024
…38377)

### Rationale for this change

Add `dimnames` method so that things like `colnames(ds)` work out of the box on datasets. Inspired by dbplyr's lazy tbl implementation

### What changes are included in this PR?

An additional `dimnames` method for Dataset objects

### Are these changes tested?

Yes

### Are there any user-facing changes?

Yes
* Closes: apache#38376

Authored-by: Jonathan Keane <jkeane@gmail.com>
Signed-off-by: Nic Crane <thisisnic@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[R] Add dimnames method to Dataset class

3 participants