alamb commented on code in PR #5735:
URL: https://github.com/apache/arrow-rs/pull/5735#discussion_r1594010781


##########
arrow-data/src/byte_view.rs:
##########
@@ -32,6 +32,18 @@ pub struct ByteView {
 }
 
 impl ByteView {
+    /// Try to create a [`ByteView`] from the provided `v`
+    ///
+    /// If `v` instead contains the binary data inline, returns an `Err` 
containing it
+    #[inline]
+    pub fn try_new(v: &u128) -> Result<Self, &[u8]> {

Review Comment:
   > Correct, it represents the non-inlined case where you have a view, and not 
just a short inlined byte array.
   
   I see -- in my mind the combination of `(length, inlined data)` is also a 
"view" but I can see how you have a different interpretation (perhaps if you 
view the types as `(length, inline)` or `(length, view)` 🤔 )
   
   The diference I am thinking about is two layouts shown here:
   
   ![Screenshot 2024-05-08 at 9 09 08 
AM](https://github.com/apache/arrow-rs/assets/490673/56c43b0a-797d-44ad-85ed-75f76cc78e2f)
   
   However, there is a single `ByteView` rust struct (that corresponds to "Long 
strings")
   
   > What cases does it not encapsulate?
   
   One case is creating the `u128`  initially (e.g. if we should copy 4 bytes 
or up to 12)



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