Updated comment on fetching parameter values from query and fixed style comment- 40907 Parameterized views as table functions

This commit is contained in:
Smita Kulkarni 2022-12-16 12:19:11 +01:00
parent dd8df3347b
commit 22c2956a06
2 changed files with 4 additions and 1 deletions

View File

@ -510,6 +510,9 @@ InterpreterSelectQuery::InterpreterSelectQuery(
{
query_info.is_parameterized_view = view->isParameterizedView();
/// We need to fetch the parameters set for SELECT parameterized view before the query is replaced.
/// replaceWithSubquery replaces the function child and adds the subquery in its place.
/// the parameters are children of function child, if function is replaced the parameters are also gone from tree
/// So we need to get the parameters before they are removed from the tree
/// and after query is replaced, we use these parameters to substitute in the parameterized view query
if (query_info.is_parameterized_view)
{

View File

@ -1409,7 +1409,7 @@ TreeRewriterResultPtr TreeRewriter::analyzeSelect(
if ((pos = column_name.find(parameter.first)) != std::string::npos)
{
String parameter_name("_CAST(" + parameter.second + ", '" + column.type->getName() + "')");
column.name.replace(pos,parameter.first.size(),parameter_name);
column.name.replace(pos, parameter.first.size(), parameter_name);
break;
}
}