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

Method initialize

bolt/exec/tests/utils/TpchQueryBuilder.cpp:121–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121void TpchQueryBuilder::initialize(const std::string& dataPath) {
122 for (const auto& [tableName, columns] : kTables_) {
123 const fs::path tablePath{dataPath + "/" + tableName};
124 std::error_code error;
125 bool anyFound = false;
126 for (auto const& dirEntry : fs::directory_iterator{
127 tablePath, std::filesystem::directory_options(), error}) {
128 if (!dirEntry.is_regular_file()) {
129 continue;
130 }
131 // Ignore hidden files.
132 if (dirEntry.path().filename().c_str()[0] == '.') {
133 continue;
134 }
135 if (tableMetadata_[tableName].dataFiles.empty()) {
136 anyFound = true;
137 readFileSchema(tableName, dirEntry.path().string(), columns);
138 }
139 tableMetadata_[tableName].dataFiles.push_back(dirEntry.path());
140 }
141 if (!anyFound && error) {
142 std::ifstream file(tablePath);
143 std::string line;
144 while (std::getline(file, line)) {
145 if (tableMetadata_[tableName].dataFiles.empty()) {
146 readFileSchema(tableName, line, columns);
147 }
148 tableMetadata_[tableName].dataFiles.push_back(line);
149 }
150 }
151 }
152}
153
154const std::vector<std::string>& TpchQueryBuilder::getTableNames() {
155 return kTableNames_;

Callers 2

SetUpMethod · 0.45
SetUpMethod · 0.45

Calls 4

stringMethod · 0.80
pathMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected