XiangpengHao commented on code in PR #6062:
URL: https://github.com/apache/arrow-rs/pull/6062#discussion_r1677983082
##########
arrow-csv/src/reader/mod.rs:
##########
@@ -2587,4 +2605,64 @@ mod tests {
&vec![2, 22]
);
}
+
+ #[test]
+ fn test_parse_string_view_1() {
+ let csv = ["foo", "something_cannot_be_inlined", "foobar"].join("\n");
+ let schema = Arc::new(Schema::new(vec![Field::new(
+ "c1",
+ DataType::Utf8View,
+ true,
+ )]));
+
+ let mut decoder = ReaderBuilder::new(schema).build_decoder();
+
+ let decoded = decoder.decode(csv.as_bytes()).unwrap();
+ assert_eq!(decoded, csv.len());
+ decoder.decode(&[]).unwrap();
+
+ let batch = decoder.flush().unwrap().unwrap();
+ assert_eq!(batch.num_columns(), 1);
+ assert_eq!(batch.num_rows(), 3);
+ let col = batch.column(0).as_string_view();
+ assert_eq!(col.data_type(), &DataType::Utf8View);
+ assert_eq!(col.value(0), "foo");
+ assert_eq!(col.value(1), "something_cannot_be_inlined");
+ assert_eq!(col.value(2), "foobar");
+ }
+
+ #[test]
+ fn test_parse_string_view_2() {
Review Comment:
It's a bit unclear how `test_parse_string_view_1` is different from
`test_parse_string_view_2`, should we rename the test cases to
`test_parse_string_single_column` and `test_parse_string_multi_column`? (if
that is the difference)
--
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]