xudong963 commented on code in PR #24931:
URL: https://github.com/apache/datafusion/pull/24931#discussion_r3942865871


##########
datafusion/common/src/error.rs:
##########
@@ -1195,6 +1210,59 @@ pub fn add_possible_columns_to_diag(
 
 #[cfg(test)]
 mod test {
+    use crate::error::{Column, MAX_LISTED_VALID_FIELDS, SchemaError};
+
+    fn field_not_found_message(num_fields: usize) -> String {
+        let valid_fields = (0..num_fields)
+            .map(|i| Column::new_unqualified(format!("col_{i}")))
+            .collect::<Vec<_>>();
+        SchemaError::FieldNotFound {
+            field: Box::new(Column::new_unqualified("nope")),
+            valid_fields,
+        }
+        .to_string()
+    }
+
+    #[test]

Review Comment:
   The tests mostly use contains, negative checks, and a length ceiling. They 
would still pass if fields 1–18 disappeared, punctuation broke, or unrelated 
text was appended. 
   
   How about using  an insta snapshot for the complete 3-, 20-, 21-, and 
200-field messages? 



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to