2021-12-03 05:25:14 +00:00
|
|
|
#pragma once
|
|
|
|
|
2022-09-28 08:45:15 +00:00
|
|
|
#include "config.h"
|
2021-12-03 05:25:14 +00:00
|
|
|
|
|
|
|
#if USE_HDFS
|
|
|
|
|
2022-06-03 13:54:29 +00:00
|
|
|
#include <TableFunctions/ITableFunctionFileLike.h>
|
2023-05-12 13:58:45 +00:00
|
|
|
#include <TableFunctions/TableFunctionHDFS.h>
|
|
|
|
#include <TableFunctions/ITableFunctionCluster.h>
|
2021-12-03 05:25:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class Context;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* hdfsCluster(cluster, URI, format, structure, compression_method)
|
|
|
|
* A table function, which allows to process many files from HDFS on a specific cluster
|
2023-05-04 16:35:18 +00:00
|
|
|
* On initiator it creates a connection to _all_ nodes in cluster, discloses asterisks
|
2021-12-03 05:25:14 +00:00
|
|
|
* in HDFS file path and dispatch each file dynamically.
|
|
|
|
* On worker node it asks initiator about next task to process, processes it.
|
|
|
|
* This is repeated until the tasks are finished.
|
|
|
|
*/
|
2023-05-12 13:58:45 +00:00
|
|
|
class TableFunctionHDFSCluster : public ITableFunctionCluster<TableFunctionHDFS>
|
2021-12-03 05:25:14 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
static constexpr auto name = "hdfsCluster";
|
2023-05-12 13:58:45 +00:00
|
|
|
static constexpr auto signature = " - cluster_name, uri\n"
|
|
|
|
" - cluster_name, uri, format\n"
|
|
|
|
" - cluster_name, uri, format, structure\n"
|
|
|
|
" - cluster_name, uri, format, structure, compression_method\n";
|
|
|
|
|
|
|
|
String getName() const override
|
2021-12-03 05:25:14 +00:00
|
|
|
{
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2023-05-12 13:58:45 +00:00
|
|
|
String getSignature() const override
|
|
|
|
{
|
|
|
|
return signature;
|
|
|
|
}
|
|
|
|
|
2021-12-03 05:25:14 +00:00
|
|
|
protected:
|
2022-06-03 13:54:29 +00:00
|
|
|
StoragePtr getStorage(
|
|
|
|
const String & source, const String & format_, const ColumnsDescription & columns, ContextPtr global_context,
|
|
|
|
const std::string & table_name, const String & compression_method_) const override;
|
2021-12-03 05:25:14 +00:00
|
|
|
|
|
|
|
const char * getStorageTypeName() const override { return "HDFSCluster"; }
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|