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/11/20 11:52:10 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #4292: minor: avoid a clone into string when checking ambiguous

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


##########
datafusion/sql/src/planner.rs:
##########
@@ -6058,15 +6058,19 @@ mod tests {
 
     #[test]
     fn test_ambiguous_coulmn_referece_in_join() {
-        // The error message will be:
-        // reference 'id' is ambiguous, could be p1.id,p2.id;
         let sql = "select p1.id, p1.age, p2.id 
             from person as p1 
             INNER JOIN person as p2 
             ON id = 1";
 
+        let expected =
+            "Error during planning: reference 'id' is ambiguous, could be p1.id,p2.id;";
+
         // It should return error.
-        assert!(logical_plan(sql).is_err());
+        let result = logical_plan(sql);
+        assert!(result.is_err());
+        let err = result.err().unwrap();
+        assert_eq!(format!("{}", err), expected);

Review Comment:
   👍 
   You can also do the same thing like
   
   ```suggestion
           assert_eq!(err.to_string(), expected);
   ```



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