You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "ParthChonkar (via GitHub)" <gi...@apache.org> on 2023/04/21 19:15:33 UTC

[GitHub] [arrow] ParthChonkar opened a new issue, #35275: [Java] Why does VectorSchemaRoot::slice return reference to same root when slice index is [0, rowCount] ?

ParthChonkar opened a new issue, #35275:
URL: https://github.com/apache/arrow/issues/35275

   ### Describe the usage question you have. Please include as many useful details as  possible.
   
   
   Hi Arrow community, 
   
   In the VectorSchemaRoot::slice implementation it checks if the slice covers the entirety of the root and returns the reference to the same root if so.
   
   ```
       if (index == 0 && length == rowCount) {
         return this;
       }
   ```
   
   Looks like this is done as an optimization to prevent creating another root + transferring to it.
   
   
   Doesn't this optimization make `slice` inconsistent? Sometimes you get back a _new_ resource that has to be separately closed and sometimes you get back the same root. 
   
   So if you want to calculate something based on a set of different slices of your root then you have to manually check whether the current slice you are requesting isn't the whole root to avoid closing the original root. 
   
   Since `splitAndTransfer` do no copying of the actual data, is this optimization worth this tradeoff? 
   
   
   
   ### Component(s)
   
   Java


-- 
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: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] lidavidm closed issue #35275: [Java] Why does VectorSchemaRoot::slice return reference to same root when slice index is [0, rowCount] ?

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm closed issue #35275: [Java] Why does VectorSchemaRoot::slice return reference to same root when slice index is [0, rowCount] ? 
URL: https://github.com/apache/arrow/issues/35275


-- 
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: issues-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] ParthChonkar commented on issue #35275: [Java] Why does VectorSchemaRoot::slice return reference to same root when slice index is [0, rowCount] ?

Posted by "ParthChonkar (via GitHub)" <gi...@apache.org>.
ParthChonkar commented on issue #35275:
URL: https://github.com/apache/arrow/issues/35275#issuecomment-1538294233

   Also in this documentation https://arrow.apache.org/docs/java/vector_schema_root.html#vectorschemaroot
   it says that `A **new** VectorSchemaRoot can be sliced from an existing root without copying data:`


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org