ClickHouse/dbms/TableFunctions/TableFunctionURL.cpp

29 lines
900 B
C++
Raw Normal View History

2018-06-11 12:13:00 +00:00
#include <Storages/StorageURL.h>
2019-08-01 01:53:38 +00:00
#include <Storages/ColumnsDescription.h>
#include <Access/AccessFlags.h>
2018-06-11 12:13:00 +00:00
#include <TableFunctions/TableFunctionFactory.h>
#include <TableFunctions/TableFunctionURL.h>
#include <Poco/URI.h>
2019-12-15 06:34:43 +00:00
#include "registerTableFunctions.h"
2018-06-11 12:13:00 +00:00
2019-08-24 21:20:20 +00:00
2018-06-11 12:13:00 +00:00
namespace DB
{
StoragePtr TableFunctionURL::getStorage(
const String & source, const String & format, const ColumnsDescription & columns, Context & global_context, const std::string & table_name, const String & compression_method) const
2018-06-11 12:13:00 +00:00
{
Poco::URI uri(source);
2019-12-04 16:06:55 +00:00
return StorageURL::create(uri, StorageID(getDatabaseName(), table_name), format, columns, ConstraintsDescription{}, global_context, compression_method);
2018-06-11 12:13:00 +00:00
}
2020-01-24 16:20:36 +00:00
AccessType TableFunctionURL::getRequiredAccessType() const
{
return AccessType::url;
}
2018-06-11 12:13:00 +00:00
void registerTableFunctionURL(TableFunctionFactory & factory)
{
factory.registerFunction<TableFunctionURL>();
}
}