mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-14 10:22:10 +00:00
78fc36ca49
This makes the target location consistent with other auto-generated files like config_formats.h, config_core.h, and config_functions.h and simplifies the build of clickhouse_common.
49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
#include "config.h"
|
|
#include "registerTableFunctions.h"
|
|
|
|
#if USE_HDFS
|
|
#include <Storages/HDFS/StorageHDFS.h>
|
|
#include <Storages/ColumnsDescription.h>
|
|
#include <TableFunctions/TableFunctionFactory.h>
|
|
#include <TableFunctions/TableFunctionHDFS.h>
|
|
#include <Interpreters/parseColumnsListForTableFunction.h>
|
|
#include <Interpreters/Context.h>
|
|
#include <Access/Common/AccessFlags.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
StoragePtr TableFunctionHDFS::getStorage(
|
|
const String & source, const String & format_, const ColumnsDescription & columns, ContextPtr global_context,
|
|
const std::string & table_name, const String & compression_method_) const
|
|
{
|
|
return std::make_shared<StorageHDFS>(
|
|
source,
|
|
StorageID(getDatabaseName(), table_name),
|
|
format_,
|
|
columns,
|
|
ConstraintsDescription{},
|
|
String{},
|
|
global_context,
|
|
compression_method_);
|
|
}
|
|
|
|
ColumnsDescription TableFunctionHDFS::getActualTableStructure(ContextPtr context) const
|
|
{
|
|
if (structure == "auto")
|
|
{
|
|
context->checkAccess(getSourceAccessType());
|
|
return StorageHDFS::getTableStructureFromData(format, filename, compression_method, context);
|
|
}
|
|
|
|
return parseColumnsListFromString(structure, context);
|
|
}
|
|
|
|
void registerTableFunctionHDFS(TableFunctionFactory & factory)
|
|
{
|
|
factory.registerFunction<TableFunctionHDFS>();
|
|
}
|
|
|
|
}
|
|
#endif
|