| 150 | } |
| 151 | |
| 152 | void CSVConverter::convertCSVFiles() { |
| 153 | // Load CSV Files to temp database |
| 154 | TestHelper::executeScript( |
| 155 | LocalFileSystem::joinPath(csvDatasetPath, std::string(TestHelper::SCHEMA_FILE_NAME)), |
| 156 | *tempConn); |
| 157 | TestHelper::executeScript( |
| 158 | LocalFileSystem::joinPath(csvDatasetPath, std::string(TestHelper::COPY_FILE_NAME)), |
| 159 | *tempConn); |
| 160 | |
| 161 | spdlog::set_level(spdlog::level::info); |
| 162 | if (fileExtension == ".json") { |
| 163 | auto result = tempConn->query( |
| 164 | "load extension \"" + |
| 165 | TestHelper::appendLbugRootPath("extension/json/build/libjson.lbug_extension\"")); |
| 166 | if (!result->isSuccess()) { |
| 167 | spdlog::error(result->getErrorMessage()); |
| 168 | } |
| 169 | } |
| 170 | for (auto table : tables) { |
| 171 | spdlog::info("Converting: {} to {}", table->csvFilePath, table->outputFilePath); |
| 172 | auto cmd = table->getConverterQuery(tempConn->getClientContext()); |
| 173 | auto result = tempConn->query(cmd); |
| 174 | if (!result->isSuccess()) { |
| 175 | spdlog::error(result->getErrorMessage()); |
| 176 | } else { |
| 177 | spdlog::info("Executed query: {}", cmd); |
| 178 | } |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | void CSVConverter::convertCSVDataset() { |
| 183 | LocalFileSystem localFileSystem(""); |
nothing calls this directly
no test coverage detected