MCPcopy Create free account
hub / github.com/apache/arrow / MismatchingNumColumns

Function MismatchingNumColumns

cpp/src/arrow/csv/parser_test.cc:658–678  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

656}
657
658std::vector<std::string> MismatchingNumColumns(int32_t num_cols, int32_t mismatch,
659 int64_t extra_lines = 0) {
660 auto write_line = [](int32_t num_cols, std::string_view prefix, std::ostream* out) {
661 for (int32_t i = 0; i < num_cols; ++i) {
662 *out << prefix << i << ",";
663 }
664 out->seekp(-1, std::ios_base::cur);
665 *out << "\n";
666 };
667
668 std::stringstream csv_data;
669 // Output first line with `num_cols` columns
670 write_line(num_cols, "a", &csv_data);
671 // Output second line with mismatching number of columns
672 write_line(num_cols + mismatch, "b", &csv_data);
673 // Output extra lines with `num_cols` columns each
674 for (int64_t i = 0; i < extra_lines; ++i) {
675 write_line(num_cols, "c", &csv_data);
676 }
677 return {csv_data.str()};
678}
679
680TEST(BlockParser, MismatchingNumColumns) {
681 uint32_t out_size;

Callers 1

TESTFunction · 0.85

Calls 1

strMethod · 0.80

Tested by

no test coverage detected