| 69 | } |
| 70 | |
| 71 | IStorageCnchFile::IStorageCnchFile( |
| 72 | ContextPtr context_, |
| 73 | const StorageID & table_id_, |
| 74 | const ColumnsDescription & required_columns_, |
| 75 | const ConstraintsDescription & constraints_, |
| 76 | const ASTPtr & setting_changes_, |
| 77 | const CnchFileArguments & arguments_, |
| 78 | const CnchFileSettings & settings_) |
| 79 | : IStorage(table_id_) |
| 80 | , WithMutableContext(context_->getGlobalContext()) |
| 81 | , CnchStorageCommonHelper(table_id_, table_id_.getDatabaseName(), table_id_.getTableName()) |
| 82 | , arguments(std::move(arguments_)) |
| 83 | , settings(std::move(settings_)) |
| 84 | { |
| 85 | context_->getRemoteHostFilter().checkURL(Poco::URI(arguments.url)); |
| 86 | |
| 87 | if (arguments.format_name.empty()) |
| 88 | arguments.format_name = "auto"; |
| 89 | if (arguments.compression_method.empty()) |
| 90 | arguments.compression_method = "auto"; |
| 91 | |
| 92 | StorageInMemoryMetadata metadata; |
| 93 | metadata.setSettingsChanges(setting_changes_); |
| 94 | metadata.setColumns(required_columns_); |
| 95 | metadata.setConstraints(constraints_); |
| 96 | setInMemoryMetadata(metadata); |
| 97 | |
| 98 | String path = arguments.url.substr(arguments.url.find('/', arguments.url.find("//") + 2)); |
| 99 | arguments.is_glob_path = path.find_first_of("*?{") != std::string::npos; |
| 100 | |
| 101 | file_list.emplace_back(arguments.url); |
| 102 | |
| 103 | auto default_virtuals = NamesAndTypesList{{"_path", std::make_shared<DataTypeString>()}, {"_file", std::make_shared<DataTypeString>()}}; |
| 104 | virtual_columns = getVirtualsForStorage(metadata.getSampleBlock().getNamesAndTypesList(), default_virtuals); |
| 105 | for (const auto & column : virtual_columns) |
| 106 | virtual_header.insert({column.type->createColumn(), column.type, column.name}); |
| 107 | } |
| 108 | |
| 109 | Pipe IStorageCnchFile::read( |
| 110 | const Names & column_names, |
nothing calls this directly
no test coverage detected