Skip to content

Bug fix for gmin and blank strings#4847

Merged
mattdowle merged 10 commits intoRdatatable:masterfrom
khotilov:fix_blank_gmin
May 15, 2021
Merged

Bug fix for gmin and blank strings#4847
mattdowle merged 10 commits intoRdatatable:masterfrom
khotilov:fix_blank_gmin

Conversation

@khotilov
Copy link
Copy Markdown
Contributor

@khotilov khotilov commented Dec 15, 2020

Closes #4848

Before the fix:

> library(data.table)
> d = data.table(id=c(1,1), a=c("","a"))
> d[, min(a), id]
      id     V1
   <num> <char>
1:     1      a
> data.table:::gmin(c("a", ""))
[1] ""
> data.table:::gmin(c("", "a"))
[1] "a"

After the fix:

> d = data.table(id=c(1,1), a=c("","a"))
> d[, min(a), id]
      id     V1
   <num> <char>
1:     1
> data.table:::gmin(c("a", ""))
[1] ""
> data.table:::gmin(c("", "a"))
[1] ""

@MichaelChirico
Copy link
Copy Markdown
Member

MichaelChirico commented Dec 15, 2020 via email

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 15, 2020

Codecov Report

Merging #4847 (ad08153) into master (03dff91) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4847   +/-   ##
=======================================
  Coverage   99.47%   99.47%           
=======================================
  Files          75       75           
  Lines       14775    14776    +1     
=======================================
+ Hits        14697    14698    +1     
  Misses         78       78           
Impacted Files Coverage Δ
src/gsumm.c 99.90% <100.00%> (ø)
src/init.c 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 03dff91...ad08153. Read the comment docs.

@khotilov
Copy link
Copy Markdown
Contributor Author

@MichaelChirico here's an issue #4848

@jangorecki jangorecki linked an issue Dec 15, 2020 that may be closed by this pull request
Comment thread src/gsumm.c Outdated
if (!LOGICAL(narm)[0]) {
for (i=0; i<ngrp; i++) SET_STRING_ELT(ans, i, R_BlankString);
Rboolean *upd = calloc(ngrp, sizeof(Rboolean));
if (!upd) error(_("Unable to allocate %d * %d bytes for the update mask in gmin na.rm=FALSE"), ngrp, sizeof(Rboolean));
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.

is upd for update?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep, changed to updated.

Comment thread src/gsumm.c Outdated
@jangorecki jangorecki added the GForce issues relating to optimized grouping calculations (GForce) label Dec 15, 2020
@mattdowle mattdowle added this to the 1.14.1 milestone May 10, 2021
@mattdowle
Copy link
Copy Markdown
Member

Thanks @khotilov. I've invited you to be project member so that, among other things, you can create branches directly in the main project in future. The invite is a button that appears in your GitHub profile or projects page which you need to click to accept. Also added you to DESCRIPTION in this PR. Thanks again, and welcome!

@mattdowle mattdowle merged commit 45b8277 into Rdatatable:master May 15, 2021
@jangorecki jangorecki modified the milestones: 1.14.9, 1.15.0 Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GForce issues relating to optimized grouping calculations (GForce)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in gmin and blank strings

4 participants