MCPcopy Create free account
hub / github.com/bytedance/bolt / persistReproInfo

Method persistReproInfo

bolt/expression/tests/ExpressionVerifier.cpp:288–376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286}
287
288void ExpressionVerifier::persistReproInfo(
289 const VectorPtr& inputVector,
290 std::vector<int> columnsToWrapInLazy,
291 const VectorPtr& resultVector,
292 const std::string& sql,
293 const std::vector<VectorPtr>& complexConstants) {
294 std::string inputPath;
295 std::string lazyListPath;
296 std::string resultPath;
297 std::string sqlPath;
298 std::string complexConstantsPath;
299
300 const auto basePath = options_.reproPersistPath.c_str();
301 if (!common::generateFileDirectory(basePath)) {
302 return;
303 }
304
305 // Create a new directory
306 auto dirPath = common::generateTempFolderPath(basePath, "expressionVerifier");
307 if (!dirPath.has_value()) {
308 LOG(INFO) << "Failed to create directory for persisting repro info.";
309 return;
310 }
311 // Saving input vector
312 inputPath = fmt::format("{}/{}", dirPath->c_str(), kInputVectorFileName);
313 try {
314 saveVectorToFile(inputVector.get(), inputPath.c_str());
315 } catch (std::exception& e) {
316 inputPath = e.what();
317 }
318
319 // Saving the list of column indices that are to be wrapped in lazy.
320 if (!columnsToWrapInLazy.empty()) {
321 lazyListPath =
322 fmt::format("{}/{}", dirPath->c_str(), kIndicesOfLazyColumnsFileName);
323 try {
324 saveStdVectorToFile<int>(columnsToWrapInLazy, lazyListPath.c_str());
325 } catch (std::exception& e) {
326 lazyListPath = e.what();
327 }
328 }
329
330 // Saving result vector
331 if (resultVector) {
332 resultPath = fmt::format("{}/{}", dirPath->c_str(), kResultVectorFileName);
333 try {
334 saveVectorToFile(resultVector.get(), resultPath.c_str());
335 } catch (std::exception& e) {
336 resultPath = e.what();
337 }
338 }
339
340 // Saving sql
341 sqlPath = fmt::format("{}/{}", dirPath->c_str(), kExpressionSqlFileName);
342 try {
343 saveStringToFile(sql, sqlPath.c_str());
344 } catch (std::exception& e) {
345 sqlPath = e.what();

Callers

nothing calls this directly

Calls 13

generateFileDirectoryFunction · 0.85
generateTempFolderPathFunction · 0.85
saveVectorToFileFunction · 0.85
saveStringToFileFunction · 0.85
VectorMakerClass · 0.85
has_valueMethod · 0.80
rowVectorMethod · 0.80
strMethod · 0.80
getMethod · 0.45
whatMethod · 0.45
emptyMethod · 0.45
poolMethod · 0.45

Tested by

no test coverage detected