Fix test fails

This commit is contained in:
Smita Kulkarni 2024-01-16 11:22:27 +01:00
parent f421e74402
commit 605c76e66e

View File

@ -6400,8 +6400,11 @@ void QueryAnalyzer::resolveTableFunction(QueryTreeNodePtr & table_function_node,
{
String database_name = scope.context->getCurrentDatabase();
String table_name = table_function_node->getOriginalAST()->as<ASTFunction>()->name;
String table_name = "";
if (table_function_node->getOriginalAST() && table_function_node->getOriginalAST()->as<ASTFunction>())
{
table_name = table_function_node->getOriginalAST()->as<ASTFunction>()->name;
if (table_function_node->getOriginalAST()->as<ASTFunction>()->is_compound_name)
{
std::vector<std::string> parts;
@ -6413,10 +6416,11 @@ void QueryAnalyzer::resolveTableFunction(QueryTreeNodePtr & table_function_node,
table_name = parts[1];
}
}
}
auto & table_function_node_typed = table_function_node->as<TableFunctionNode &>();
StoragePtr table = DatabaseCatalog::instance().tryGetTable({database_name, table_name}, scope.context->getQueryContext());
StoragePtr table = table_name.empty() ? nullptr : DatabaseCatalog::instance().tryGetTable({database_name, table_name}, scope.context->getQueryContext());
if (table)
{
if (table.get()->isView() && table->as<StorageView>() && table->as<StorageView>()->isParameterizedView())