summaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/TableFunctions/TableFunctionS3Cluster.h
diff options
context:
space:
mode:
authorvitalyisaev <[email protected]>2023-11-14 09:58:56 +0300
committervitalyisaev <[email protected]>2023-11-14 10:20:20 +0300
commitc2b2dfd9827a400a8495e172a56343462e3ceb82 (patch)
treecd4e4f597d01bede4c82dffeb2d780d0a9046bd0 /contrib/clickhouse/src/TableFunctions/TableFunctionS3Cluster.h
parentd4ae8f119e67808cb0cf776ba6e0cf95296f2df7 (diff)
YQ Connector: move tests from yql to ydb (OSS)
Перенос папки с тестами на Коннектор из папки yql в папку ydb (синхронизируется с github).
Diffstat (limited to 'contrib/clickhouse/src/TableFunctions/TableFunctionS3Cluster.h')
-rw-r--r--contrib/clickhouse/src/TableFunctions/TableFunctionS3Cluster.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/contrib/clickhouse/src/TableFunctions/TableFunctionS3Cluster.h b/contrib/clickhouse/src/TableFunctions/TableFunctionS3Cluster.h
new file mode 100644
index 00000000000..4b87f743cc3
--- /dev/null
+++ b/contrib/clickhouse/src/TableFunctions/TableFunctionS3Cluster.h
@@ -0,0 +1,63 @@
+#pragma once
+
+#include "clickhouse_config.h"
+
+#if USE_AWS_S3
+
+#include <TableFunctions/ITableFunction.h>
+#include <TableFunctions/TableFunctionS3.h>
+#include <TableFunctions/ITableFunctionCluster.h>
+#include <Storages/StorageS3Cluster.h>
+
+
+namespace DB
+{
+
+class Context;
+
+/**
+ * s3cluster(cluster_name, source, [access_key_id, secret_access_key,] format, structure, compression_method)
+ * A table function, which allows to process many files from S3 on a specific cluster
+ * On initiator it creates a connection to _all_ nodes in cluster, discloses asterisks
+ * in S3 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.
+ */
+class TableFunctionS3Cluster : public ITableFunctionCluster<TableFunctionS3>
+{
+public:
+ static constexpr auto name = "s3Cluster";
+ static constexpr auto signature = " - cluster, url\n"
+ " - cluster, url, format\n"
+ " - cluster, url, format, structure\n"
+ " - cluster, url, access_key_id, secret_access_key\n"
+ " - cluster, url, format, structure, compression_method\n"
+ " - cluster, url, access_key_id, secret_access_key, format\n"
+ " - cluster, url, access_key_id, secret_access_key, format, structure\n"
+ " - cluster, url, access_key_id, secret_access_key, format, structure, compression_method\n"
+ "All signatures supports optional headers (specified as `headers('name'='value', 'name2'='value2')`)";
+
+ String getName() const override
+ {
+ return name;
+ }
+
+ String getSignature() const override
+ {
+ return signature;
+ }
+
+protected:
+ StoragePtr executeImpl(
+ const ASTPtr & ast_function,
+ ContextPtr context,
+ const std::string & table_name,
+ ColumnsDescription cached_columns,
+ bool is_insert_query) const override;
+
+ const char * getStorageTypeName() const override { return "S3Cluster"; }
+};
+
+}
+
+#endif