MCPcopy Create free account
hub / github.com/ByConity/ByConity / getActualTableStructure

Method getActualTableStructure

src/TableFunctions/ITableFunctionFileLike.cpp:96–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96ColumnsDescription ITableFunctionFileLike::getActualTableStructure(ContextPtr context) const
97{
98 if (arguments.structure.empty())
99 {
100 size_t total_bytes_to_read = 0;
101 Strings paths = StorageFile::getPathsList(arguments.url, context->getUserFilesPath(), context, total_bytes_to_read);
102 if (paths.empty())
103 throw Exception("Cannot get table structure from file, because no files match specified name", ErrorCodes::INCORRECT_FILE_NAME);
104 auto read_stream = StorageDistributedDirectoryMonitor::createSourceFromFile(paths[0]);
105 return ColumnsDescription{read_stream->getOutputs().front().getHeader().getNamesAndTypesList()};
106 }
107 return parseColumnsListFromString(arguments.structure, context);
108}
109
110StoragePtr ITableFunctionFileLike::executeImpl(const ASTPtr & /*ast_function*/, ContextPtr context, const std::string & table_name, ColumnsDescription /*cached_columns*/) const
111{

Callers

nothing calls this directly

Calls 7

getUserFilesPathMethod · 0.80
frontMethod · 0.80
ExceptionClass · 0.50
emptyMethod · 0.45
getNamesAndTypesListMethod · 0.45
getHeaderMethod · 0.45

Tested by

no test coverage detected