You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "grtlr (via GitHub)" <gi...@apache.org> on 2026/02/24 07:38:50 UTC
Re: [PR] Add `quoted_strings` to `FormatOptions` [arrow-rs]
grtlr commented on code in PR #9221:
URL: https://github.com/apache/arrow-rs/pull/9221#discussion_r2845078061
##########
arrow-cast/src/pretty.rs:
##########
@@ -1776,4 +1776,128 @@ mod tests {
"Invalid argument error: Expected the same number of columns in a record batch (1) as the number of fields (2) in the schema"
);
}
+
+ #[test]
+ fn test_quoted_strings() {
+ let schema = Arc::new(Schema::new(vec![Field::new(
+ "strings",
+ DataType::Utf8,
+ true,
+ )]));
+
+ let string_array = StringArray::from(vec![
+ Some("hello"),
+ Some("world"),
+ Some(""),
+ Some("tab\there"),
+ Some("newline\ntest"),
+ Some("quote\"test"),
+ Some("backslash\\test"),
+ None,
+ ]);
+
+ let batch = RecordBatch::try_new(schema.clone(), vec![Arc::new(string_array)]).unwrap();
+
+ let options_none = FormatOptions::new().with_null("NULL");
+ let table = pretty_format_batches_with_options(std::slice::from_ref(&batch), &options_none)
+ .unwrap()
+ .to_string();
+
+ assert!(table.contains("| hello"));
Review Comment:
Here is a translation of the current tests in `pretty.rs` to `insta` inline snapshots:
* https://github.com/apache/arrow-rs/pull/9472
--
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