aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Storages/extractTableFunctionArgumentsFromSelectQuery.cpp
diff options
context:
space:
mode:
authorvitalyisaev <vitalyisaev@ydb.tech>2023-11-14 09:58:56 +0300
committervitalyisaev <vitalyisaev@ydb.tech>2023-11-14 10:20:20 +0300
commitc2b2dfd9827a400a8495e172a56343462e3ceb82 (patch)
treecd4e4f597d01bede4c82dffeb2d780d0a9046bd0 /contrib/clickhouse/src/Storages/extractTableFunctionArgumentsFromSelectQuery.cpp
parentd4ae8f119e67808cb0cf776ba6e0cf95296f2df7 (diff)
downloadydb-c2b2dfd9827a400a8495e172a56343462e3ceb82.tar.gz
YQ Connector: move tests from yql to ydb (OSS)
Перенос папки с тестами на Коннектор из папки yql в папку ydb (синхронизируется с github).
Diffstat (limited to 'contrib/clickhouse/src/Storages/extractTableFunctionArgumentsFromSelectQuery.cpp')
-rw-r--r--contrib/clickhouse/src/Storages/extractTableFunctionArgumentsFromSelectQuery.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/contrib/clickhouse/src/Storages/extractTableFunctionArgumentsFromSelectQuery.cpp b/contrib/clickhouse/src/Storages/extractTableFunctionArgumentsFromSelectQuery.cpp
new file mode 100644
index 0000000000..382964d9fe
--- /dev/null
+++ b/contrib/clickhouse/src/Storages/extractTableFunctionArgumentsFromSelectQuery.cpp
@@ -0,0 +1,29 @@
+#include <Storages/extractTableFunctionArgumentsFromSelectQuery.h>
+
+#include <Parsers/ASTExpressionList.h>
+#include <Parsers/ASTFunction.h>
+#include <Parsers/ASTLiteral.h>
+#include <Parsers/ASTSelectQuery.h>
+#include <Parsers/ASTTablesInSelectQuery.h>
+#include <Parsers/queryToString.h>
+
+
+namespace DB
+{
+
+ASTExpressionList * extractTableFunctionArgumentsFromSelectQuery(ASTPtr & query)
+{
+ auto * select_query = query->as<ASTSelectQuery>();
+ if (!select_query || !select_query->tables())
+ return nullptr;
+
+ auto * tables = select_query->tables()->as<ASTTablesInSelectQuery>();
+ auto * table_expression = tables->children[0]->as<ASTTablesInSelectQueryElement>()->table_expression->as<ASTTableExpression>();
+ if (!table_expression->table_function)
+ return nullptr;
+
+ auto * table_function = table_expression->table_function->as<ASTFunction>();
+ return table_function->arguments->as<ASTExpressionList>();
+}
+
+}