MCPcopy Create free account
hub / github.com/duckdb/duckdb / ReadQueryFromReader

Method ReadQueryFromReader

benchmark/interpreted_benchmark.cpp:133–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133BenchmarkQuery InterpretedBenchmark::ReadQueryFromReader(BenchmarkFileReader &reader, const string &sql,
134 const string &header) {
135 BenchmarkQuery query;
136 query.query = sql;
137 query.column_count = header.size();
138 // keep reading results until eof
139 string line;
140 while (reader.ReadLine(line)) {
141 if (line.empty()) {
142 break;
143 }
144 auto result_splits = StringUtil::Split(line, "\t");
145 if (result_splits.size() != query.column_count) {
146 throw std::runtime_error(reader.FormatException("expected " + std::to_string(result_splits.size()) +
147 " values but got " + std::to_string(query.column_count)));
148 }
149 query.expected_result.push_back(std::move(result_splits));
150 }
151 return query;
152}
153
154static void ThrowResultModeError(BenchmarkFileReader &reader) {
155 vector<string> valid_options = {"streaming", "arrow", "materialized"};

Callers

nothing calls this directly

Calls 5

sizeMethod · 0.45
ReadLineMethod · 0.45
emptyMethod · 0.45
FormatExceptionMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected