New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DT[TRUE] can lead to invalid key #3215
Labels
Comments
Yes, setkey, changing existing columns should not be used on the shallow copy since columns themselves are not copied. |
If we won't allow to make shallow copy with |
Eventually. But in the meantime, we can't break @renkun-ken's workflow. |
the following code could be added to tests to ensure copy behaviour DT = data.table(a=c(1,2), b=c("b","a"))
address(DT)
address(DT[])
address(DT[, .SD])
address(DT[TRUE])
sapply(DT, address)
sapply(DT[], address)
sapply(DT[, .SD], address)
sapply(DT[TRUE], address) |
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I didn't realize
DT[TRUE]
was a way to achieve a shallow copy. shallow copy was only intended for internal use. Thanks to @renkun-ken for highlighting this in #3214, and related #2254.In v1.11.8 we see this :
It only occurs after
DT[TRUE]
, iiuc, which hopefully folk have not discovered or relied on too much?! I hope the usage out there is like @renkun-ken described to add new columns to the shallow copy, not to change existing columns!New test 1542.08 was added in PR #2313 ready for when this is fixed.
The text was updated successfully, but these errors were encountered: