You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tustvold (via GitHub)" <gi...@apache.org> on 2024/05/16 10:05:40 UTC

Re: [PR] Encode UUID as FixedLenByteArray in parquet_derive [arrow-rs]

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


##########
parquet_derive/src/parquet_field.rs:
##########
@@ -638,11 +636,40 @@ impl Type {
             }
             "f32" => BasicType::FLOAT,
             "f64" => BasicType::DOUBLE,
-            "String" | "str" | "Uuid" => BasicType::BYTE_ARRAY,
+            "String" | "str" => BasicType::BYTE_ARRAY,
+            "Uuid" => BasicType::FIXED_LEN_BYTE_ARRAY,
             f => unimplemented!("{} currently is not supported", f),
         }
     }
 
+    fn length(&self) -> Option<i32> {
+        let last_part = self.last_part();
+        let leaf_type = self.leaf_type_recursive();
+
+        match leaf_type {
+            Type::Array(ref first_type) => {
+                if let Type::TypePath(_) = **first_type {
+                    if last_part == "u8" {
+                        return Some(1);
+                    }
+                }
+            }
+            Type::Vec(ref first_type) | Type::Slice(ref first_type) => {
+                if let Type::TypePath(_) = **first_type {
+                    if last_part == "u8" {
+                        return None;
+                    }
+                }
+            }
+            _ => (),
+        }

Review Comment:
   What is this logic for?



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