Skip the analysis of headers argument with the new analyzer

This commit is contained in:
Nikolay Degterinsky 2023-06-27 11:47:24 +00:00
parent ac85cdbb84
commit ea11774939
2 changed files with 24 additions and 0 deletions

View File

@ -18,6 +18,8 @@
#include <Storages/NamedCollectionsHelpers.h> #include <Storages/NamedCollectionsHelpers.h>
#include <Formats/FormatFactory.h> #include <Formats/FormatFactory.h>
#include "registerTableFunctions.h" #include "registerTableFunctions.h"
#include <Analyzer/FunctionNode.h>
#include <Analyzer/TableFunctionNode.h>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
@ -32,6 +34,24 @@ namespace ErrorCodes
} }
std::vector<size_t> TableFunctionS3::skipAnalysisForArguments(const QueryTreeNodePtr & query_node_table_function, ContextPtr) const
{
auto & table_function_node = query_node_table_function->as<TableFunctionNode &>();
auto & table_function_arguments_nodes = table_function_node.getArguments().getNodes();
size_t table_function_arguments_size = table_function_arguments_nodes.size();
std::vector<size_t> result;
for (size_t i = 0; i < table_function_arguments_size; ++i)
{
auto * function_node = table_function_arguments_nodes[i]->as<FunctionNode>();
if (function_node && function_node->getFunctionName() == "headers")
result.push_back(i);
}
return result;
}
/// This is needed to avoid copy-pase. Because s3Cluster arguments only differ in additional argument (first) - cluster name /// This is needed to avoid copy-pase. Because s3Cluster arguments only differ in additional argument (first) - cluster name
void TableFunctionS3::parseArgumentsImpl(ASTs & args, const ContextPtr & context) void TableFunctionS3::parseArgumentsImpl(ASTs & args, const ContextPtr & context)
{ {

View File

@ -73,6 +73,10 @@ protected:
mutable StorageS3::Configuration configuration; mutable StorageS3::Configuration configuration;
ColumnsDescription structure_hint; ColumnsDescription structure_hint;
private:
std::vector<size_t> skipAnalysisForArguments(const QueryTreeNodePtr & query_node_table_function, ContextPtr context) const override;
}; };
} }