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

Function MakeSampleCsvBuffer

cpp/src/arrow/csv/test_common.cc:102–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100} // namespace
101
102Result<std::shared_ptr<Buffer>> MakeSampleCsvBuffer(
103 size_t num_rows, std::function<bool(size_t)> is_valid) {
104 std::stringstream writer;
105
106 WriteHeader(writer);
107 for (size_t i = 0; i < num_rows; ++i) {
108 if (!is_valid || is_valid(i)) {
109 WriteRow(writer, i);
110 } else {
111 WriteInvalidRow(writer, i);
112 }
113 }
114
115 auto table_str = writer.str();
116 auto table_buffer = std::make_shared<Buffer>(table_str);
117 return MemoryManager::CopyBuffer(table_buffer, default_cpu_memory_manager());
118}
119
120} // namespace csv
121} // namespace arrow

Callers

nothing calls this directly

Calls 6

WriteHeaderFunction · 0.85
WriteRowFunction · 0.85
WriteInvalidRowFunction · 0.85
strMethod · 0.80
is_validFunction · 0.50

Tested by

no test coverage detected