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/23 06:38:39 UTC

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3163: Add Row size methods (#3160)

tustvold commented on code in PR #3163:
URL: https://github.com/apache/arrow-rs/pull/3163#discussion_r1030075894


##########
arrow/src/row/mod.rs:
##########
@@ -358,6 +358,14 @@ impl SortField {
     pub fn new_with_options(data_type: DataType, options: SortOptions) -> Self {
         Self { options, data_type }
     }
+
+    /// Return size of this instance in bytes.
+    ///
+    /// Includes the size of `Self`.
+    pub fn size(&self) -> usize {
+        self.data_type.size() + std::mem::size_of::<Self>()
+            - std::mem::size_of::<DataType>()

Review Comment:
   Options is counted by `size_of<Self>` we need to subtract DataType as otherwise it is counted twice



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