Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up[Request] assigning with := should retain keys better #2372
Comments
|
I am working on a solution. Just need to memCheck for memory leaks before creating a pull request |
|
I have discovered a minor fault in my implementation: I am assuming that secondary indices behave exactly like the key.
If there is a key on columns x and y, it is a fully valid key on x as well. If there is an index on columns x and y, it is also a fully valid index on x, but it may cause spurious reordering in y if used as an index for x. The only secondary index that is fully equivalent to a key is a Therefore, I need to change my implementation as follows:
I will fix asap and create a PR. |
Currently, keys and secondary indices are dropped, if any of the key columns is altered via a
:=assignment.This is not necessary, however, since the key is still valid for all key columns before the assigned one.
Given this, we can better retain keys and secondary indices and improve data.table performance.
An example: