ben-schwen commented on PR #45346:
URL: https://github.com/apache/arrow/pull/45346#issuecomment-2613640506

   > Yeah, this is even true if you don't attach `data.table` but interestingly 
even with the same `.internal.selfref` modifying `dt_in` does not result in 
changes in `dt_out` so they are seen as different objects with the same 
`.internal.selfref`.
   
   Nothing unexpected. It will even create the same `.internal.selfref` for 
different objects.
   ``` r
   library(data.table)
   
   dt = data.table(x=1:3)
   attributes(dt)
   #> $names
   #> [1] "x"
   #> 
   #> $row.names
   #> [1] 1 2 3
   #> 
   #> $class
   #> [1] "data.table" "data.frame"
   #> 
   #> $.internal.selfref
   #> <pointer: 0x5640ce7bc310>
   
   dt2 = data.table(x=1:3)
   attributes(dt2)
   #> $names
   #> [1] "x"
   #> 
   #> $row.names
   #> [1] 1 2 3
   #> 
   #> $class
   #> [1] "data.table" "data.frame"
   #> 
   #> $.internal.selfref
   #> <pointer: 0x5640ce7bc310>
   ```
   
   But you can always check that they are not the same by checking `address(dt) 
!= address(dt2)`. "Safe option" would be not to drop the `data.table` class but 
only drop the `.internal.selfref` attribute, so `data.table` will detect that 
and allocate the right memory.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to