mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-14 18:32:29 +00:00
Updated comment on fetching parameter values from query and fixed style comment- 40907 Parameterized views as table functions
This commit is contained in:
parent
dd8df3347b
commit
22c2956a06
@ -510,6 +510,9 @@ InterpreterSelectQuery::InterpreterSelectQuery(
|
|||||||
{
|
{
|
||||||
query_info.is_parameterized_view = view->isParameterizedView();
|
query_info.is_parameterized_view = view->isParameterizedView();
|
||||||
/// We need to fetch the parameters set for SELECT parameterized view before the query is replaced.
|
/// 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
|
/// and after query is replaced, we use these parameters to substitute in the parameterized view query
|
||||||
if (query_info.is_parameterized_view)
|
if (query_info.is_parameterized_view)
|
||||||
{
|
{
|
||||||
|
@ -1409,7 +1409,7 @@ TreeRewriterResultPtr TreeRewriter::analyzeSelect(
|
|||||||
if ((pos = column_name.find(parameter.first)) != std::string::npos)
|
if ((pos = column_name.find(parameter.first)) != std::string::npos)
|
||||||
{
|
{
|
||||||
String parameter_name("_CAST(" + parameter.second + ", '" + column.type->getName() + "')");
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user