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

Function printBoltFunctions

bolt/functions/CoverageUtil.cpp:427–481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

425}
426
427void printBoltFunctions(
428 const std::unordered_set<std::string>& linkBlockList,
429 const std::string& domain) {
430 auto scalarNames = getSortedScalarNames();
431 auto aggNames = getSortedAggregateNames();
432 auto windowNames = getSortedWindowNames();
433
434 const int columnSize = std::max(
435 {maxLength(scalarNames),
436 maxLength(aggNames),
437 maxLength(windowNames)}) +
438 toFuncLink("", domain).size();
439
440 const std::string indent(4, ' ');
441
442 auto scalarCnt = scalarNames.size();
443 auto aggCnt = aggNames.size();
444 auto windowCnt = windowNames.size();
445 auto numRows =
446 std::max({(size_t)std::ceil(scalarCnt / 3.0), aggCnt, windowCnt});
447
448 auto printName = [&](const std::string& name) {
449 return linkBlockList.count(name) == 0 ? toFuncLink(name, domain) : name;
450 };
451
452 TablePrinter printer(3, columnSize, indent, std::cout);
453 printer.header();
454 for (int i = 0; i < numRows; i++) {
455 printer.startRow();
456
457 // 3 columns of scalar functions.
458 for (int j = 0; j < 3; j++) {
459 auto n = i + numRows * j;
460 n < scalarCnt ? printer.addColumn(printName(scalarNames[n]))
461 : printer.addEmptyColumn();
462 }
463
464 // 1 empty column.
465 printer.addEmptyColumn();
466
467 // 1 column of aggregate functions.
468 i < aggCnt ? printer.addColumn(printName(aggNames[i]))
469 : printer.addEmptyColumn();
470
471 // 1 empty column.
472 printer.addEmptyColumn();
473
474 // 1 column of window functions.
475 i < windowCnt ? printer.addColumn(printName(windowNames[i]))
476 : printer.addEmptyColumn();
477
478 printer.endRow();
479 }
480 printer.footer();
481}
482
483void printCoverageMapForMostUsed(const std::string& domain) {
484 auto scalarNameList = readFunctionNamesFromFile("all_scalar_functions.txt");

Callers 2

mainFunction · 0.85
mainFunction · 0.85

Calls 15

getSortedScalarNamesFunction · 0.85
getSortedAggregateNamesFunction · 0.85
getSortedWindowNamesFunction · 0.85
maxLengthFunction · 0.85
toFuncLinkFunction · 0.85
ceilFunction · 0.85
headerMethod · 0.80
startRowMethod · 0.80
addColumnMethod · 0.80
addEmptyColumnMethod · 0.80
endRowMethod · 0.80
footerMethod · 0.80

Tested by

no test coverage detected