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


##########
arrow/src/row/mod.rs:
##########
@@ -229,14 +229,70 @@ impl SortField {
     }
 }
 
+/// Helper that is used for [`downcast_primitive`] and just returns `true`.
+macro_rules! always_true {
+    ($t:ty) => {
+        true
+    };
+}
+
 impl RowConverter {
     /// Create a new [`RowConverter`] with the provided schema
-    pub fn new(fields: Vec<SortField>) -> Self {
+    pub fn new(fields: Vec<SortField>) -> Result<Self> {
+        if !Self::supports_fields(&fields) {
+            return Err(ArrowError::NotYetImplemented(format!(
+                "not yet implemented: {:?}",
+                fields
+            )));
+        }
+
         let interners = (0..fields.len()).map(|_| None).collect();
-        Self {
+        Ok(Self {
             fields: fields.into(),
             interners,
+        })
+    }
+
+    /// Check if the given fields are supported by the row format.
+    pub fn supports_fields(fields: &[SortField]) -> bool {
+        for f in fields {
+            let data_type = &f.data_type;

Review Comment:
   https://github.com/apache/arrow-rs/pull/3083 will make this even simpler



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