alamb commented on code in PR #7527:
URL: https://github.com/apache/arrow-datafusion/pull/7527#discussion_r1325092101


##########
datafusion/common/Cargo.toml:
##########
@@ -34,6 +34,7 @@ path = "src/lib.rs"
 
 [features]
 avro = ["apache-avro"]

Review Comment:
   As written, to be enabled, a user would have to use `datafusion_common` 
directly (they couldn't activate it through `datafusion`)
   
   To enable it via datafusion we also need to add it to core/Cargo.toml, like 
this:
   
   
https://github.com/apache/arrow-datafusion/blob/cde74016e930ffd9c55eed403b84bcd026f38d0f/datafusion/core/Cargo.toml#L44



##########
datafusion/common/src/error.rs:
##########
@@ -412,20 +415,34 @@ impl DataFusionError {
 
     pub fn strip_backtrace(&self) -> String {
         self.to_string()
-            .split("\n\nbacktrace: ")
+            .split(Self::BACK_TRACE_SEP)
             .collect::<Vec<&str>>()
             .first()
             .unwrap_or(&"")
             .to_string()
     }
 
+    /// To enable optional rust backtrace in DataFusion:
+    /// - [`Setup Env 
Variables`]<https://doc.rust-lang.org/std/backtrace/index.html#environment-variables>

Review Comment:
   👍 



##########
datafusion/common/src/error.rs:
##########
@@ -522,6 +539,41 @@ mod test {
         assert_eq!(res.strip_backtrace(), "Arrow error: Schema error: bar");
     }
 
+    // RUST_BACKTRACE=1 cargo test --features backtrace --package 
datafusion-common --lib -- error::test::test_backtrace
+    #[cfg(feature = "backtrace")]
+    #[test]
+    #[allow(clippy::unnecessary_literal_unwrap)]
+    fn test_enabled_backtrace() {

Review Comment:
   I wonder if we should also add a CI test, perhaps like 
https://github.com/apache/arrow-datafusion/blob/cde74016e930ffd9c55eed403b84bcd026f38d0f/.github/workflows/rust.yml#L99



##########
datafusion/common/src/error.rs:
##########
@@ -412,20 +415,34 @@ impl DataFusionError {
 
     pub fn strip_backtrace(&self) -> String {
         self.to_string()
-            .split("\n\nbacktrace: ")
+            .split(Self::BACK_TRACE_SEP)
             .collect::<Vec<&str>>()
             .first()
             .unwrap_or(&"")
             .to_string()
     }
 
+    /// To enable optional rust backtrace in DataFusion:
+    /// - [`Setup Env 
Variables`]<https://doc.rust-lang.org/std/backtrace/index.html#environment-variables>

Review Comment:
   👍 



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