You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/21 15:35:09 UTC

[GitHub] [arrow-rs] crepererum opened a new pull request, #3149: feat: `{Field,DataType}::size`

crepererum opened a new pull request, #3149:
URL: https://github.com/apache/arrow-rs/pull/3149

   **:warning: Includes #3148, so marking this as WIP.**
   
   # Which issue does this PR close?
   
   Closes #3147.
   
   # Rationale for this change
   In DataFusion, it would be nice to know how much data is allocated so we can bail out early instead of OOMing (a slight over-allocation is OK, so this can be measured after the fact). For that purpose, it would be nice to know how much memory a specific instance of `Field`/`DataType` requires.
   
   # What changes are included in this PR?
   `DataType::size` and `Schema::size`.
   
   # Are there any user-facing changes?
   New methods, not breaking.


-- 
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


[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3149: feat: `{Field,DataType}::size`

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #3149:
URL: https://github.com/apache/arrow-rs/pull/3149#discussion_r1029202444


##########
arrow-schema/src/field.rs:
##########
@@ -459,6 +459,21 @@ impl Field {
             }
         }
     }
+
+    /// Return size of this instance in bytes.
+    ///
+    /// Includes the size of `Self`.
+    pub fn size(&self) -> usize {
+        std::mem::size_of_val(self) - std::mem::size_of_val(&self.data_type)
+            + self.data_type.size()
+            + self.name.capacity()
+            + (std::mem::size_of::<(String, String)>() * self.metadata.capacity())

Review Comment:
   I'm not sure how accurate this approximation is, but I imagine probably good enough to a first order



-- 
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


[GitHub] [arrow-rs] ursabot commented on pull request #3149: feat: `{Field,DataType}::size`

Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #3149:
URL: https://github.com/apache/arrow-rs/pull/3149#issuecomment-1323902143

   Benchmark runs are scheduled for baseline = f091cbbf0a1f212fbe1bd4d63fa018e7a5c82ccc and contender = a110004b3d9f30358c22ac917fcad3745ea2460c. a110004b3d9f30358c22ac917fcad3745ea2460c is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/e0b9264be15a4ac8905a166bcace7e67...952d774df9eb4267a17bd27acd4ee06a/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/1f91b8996b154ded9791d0437affaaab...96b6bf5e9fc642288777861e53fcdcb1/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/05858b1ad74b4f78a3f803ff1e4d5f60...061fdc694f874ca6bf6be5e10ce5a616/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/bf08cf9e0ca040e8897ee9cf284210b2...72abdf65ddc14c53bdee1ee3b976bb4a/)
   Buildkite builds:
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
   test-mac-arm: Supported benchmark langs: C++, Python, R
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, 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: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-rs] tustvold merged pull request #3149: feat: `{Field,DataType}::size`

Posted by GitBox <gi...@apache.org>.
tustvold merged PR #3149:
URL: https://github.com/apache/arrow-rs/pull/3149


-- 
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