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/10/09 07:43:39 UTC

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #2809: Support Arbitrary Number of Arrays in downcast_primitive_array

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


##########
arrow-array/src/cast.rs:
##########
@@ -50,427 +62,183 @@ macro_rules! downcast_primitive_array {
     ($values:ident => $e:expr, $($p:pat => $fallback:expr $(,)*)*) => {
         downcast_primitive_array!($values => {$e} $($p => $fallback)*)
     };
-
-    ($values:ident => $e:block $($p:pat => $fallback:expr $(,)*)*) => {
-        match $values.data_type() {
-            arrow_schema::DataType::Int8 => {
-                let $values = $crate::cast::as_primitive_array::<
+    (($($values:ident),+) => $e:block $($($p:pat),+ => $fallback:expr $(,)*)*) => {
+        $crate::downcast_primitive_array!($($values),+ => $e $($($p),+ => $fallback)*)
+    };
+    (($($values:ident),+) => $e:block $(($($p:pat),+) => $fallback:expr $(,)*)*) => {
+        $crate::downcast_primitive_array!($($values),+ => $e $($($p),+ => $fallback)*)
+    };

Review Comment:
   Yeah, because typically single arguments are not enclosed in ( ) but multiple are, this allows both patterns



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