comphead commented on code in PR #7115:
URL: https://github.com/apache/arrow-datafusion/pull/7115#discussion_r1281178198


##########
datafusion/common/src/error.rs:
##########
@@ -411,6 +399,56 @@ impl DataFusionError {
     }
 }
 
+/// Unwrap an `Option` if possible. Otherwise return an 
`DataFusionError::Internal`.
+/// In normal usage of DataFusion the unwrap should always succeed.
+///
+/// Example: `let values = unwrap_or_internal_err!(values)`
+#[macro_export]
+macro_rules! unwrap_or_internal_err {
+    ($Value: ident) => {
+        $Value.ok_or_else(|| {
+            DataFusionError::Internal(format!(
+                "{} should not be None",
+                stringify!($Value)
+            ))
+        })?
+    };
+}
+
+#[macro_export]
+macro_rules! with_dollar_sign {
+    ($($body:tt)*) => {
+        macro_rules! __with_dollar_sign { $($body)* }
+        __with_dollar_sign!($);
+    }
+}

Review Comment:
   it doesn't conflict, but if you expand macros in 
   
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=e5aad70ec87a420a6d4c9a7ba023c56d
   
   you can see `__with_dollar_sign` created twice, but since the macro is not 
exported it is okay



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