Skip to content

Conversation

@aitap
Copy link
Member

@aitap aitap commented Jan 19, 2026

In particular, do not reallocate when changing existing columns without resizing the table. Reallocating and reassigning the table in the caller misses the cases when the table is shared outside the caller's frame (e.g. the caller's caller).

Fixes: #7604

@aitap aitap requested a review from MichaelChirico as a code owner January 19, 2026 16:18
@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.02%. Comparing base (35dbf06) to head (599f1cb).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7606      +/-   ##
==========================================
+ Coverage   99.01%   99.02%   +0.01%     
==========================================
  Files          87       87              
  Lines       16896    16903       +7     
==========================================
+ Hits        16730    16739       +9     
+ Misses        166      164       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link

github-actions bot commented Jan 19, 2026

No obvious timing issues in HEAD=fix-7604
Comparison Plot

Generated via commit 599f1cb

Download link for the artifact containing the test results: ↓ atime-results.zip

Task Duration
R setup and installing dependencies 3 minutes and 11 seconds
Installing different package versions 47 seconds
Running and plotting the test cases 4 minutes and 27 seconds

@TysonStanley
Copy link
Member

Did we want to include this in 1.18.2 as well?

aitap and others added 2 commits January 20, 2026 07:28
Co-authored-by: Michael Chirico <chiricom@google.com>
Co-Authored-By: Michael Chirico <michaelchirico4@gmail.com>
@aitap aitap added this to the 1.18.2 milestone Jan 20, 2026
R/data.table.R Outdated
# when removing a column, value can be NULL or list with NULLs inside
removing = is.null(value) || (is.list(value) && length(value) == length(j) && any(vapply_1b(value, is.null)))
# columns can be created by name
adding = is.character(j) && !all(j %chin% names(x))
Copy link
Member

Choose a reason for hiding this comment

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

should we caching the result of j %chin% names(x) here?

Copy link
Member

@ben-schwen ben-schwen left a comment

Choose a reason for hiding this comment

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

LGTM, TY!

Co-Authored-By: Benjamin Schwendinger <52290390+ben-schwen@users.noreply.github.com
@aitap
Copy link
Member Author

aitap commented Jan 20, 2026

Shouldn't need a NEWS item as a follow-up to #7538.

@aitap aitap merged commit e13ea60 into master Jan 20, 2026
12 checks passed
@aitap aitap deleted the fix-7604 branch January 20, 2026 09:21
aitap added a commit that referenced this pull request Jan 20, 2026
…7606)

* Regression tests

* set(): only reallocate if resizing would fail

* Update R/data.table.R

Co-authored-by: Michael Chirico <chiricom@google.com>

* Rename test variables

Co-Authored-By: Michael Chirico <michaelchirico4@gmail.com>

* Cache j %chin% names(x)

Co-Authored-By: Benjamin Schwendinger <52290390+ben-schwen@users.noreply.github.com

---------

Co-authored-by: Michael Chirico <chiricom@google.com>
Co-authored-by: Michael Chirico <michaelchirico4@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reverse dependency tidytable fails due to type mismatch in a merge operation

4 participants