8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 15:23:02 +01:00

Simplifications.

This commit is contained in:
Adriano dos Santos Fernandes 2016-09-29 13:41:08 -03:00
parent af5ef8fafd
commit 017ed2cf79

View File

@ -7678,16 +7678,6 @@ ValueExprNode* OverNode::dsqlFieldRemapper(FieldRemapper& visitor)
// Save the values to restore them in the end. // Save the values to restore them in the end.
AutoSetRestore<WindowClause*> autoWindowNode(&visitor.windowNode, visitor.windowNode); AutoSetRestore<WindowClause*> autoWindowNode(&visitor.windowNode, visitor.windowNode);
if (window->partition)
{
if (Aggregate2Finder::find(visitor.context->ctx_scope_level, FIELD_MATCH_TYPE_EQUAL,
true, window->partition))
{
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
Arg::Gds(isc_dsql_agg_nested_err));
}
}
if (Aggregate2Finder::find(visitor.context->ctx_scope_level, FIELD_MATCH_TYPE_EQUAL, if (Aggregate2Finder::find(visitor.context->ctx_scope_level, FIELD_MATCH_TYPE_EQUAL,
true, window)) true, window))
{ {
@ -7718,37 +7708,15 @@ ValueExprNode* OverNode::dsqlFieldRemapper(FieldRemapper& visitor)
{ {
if (!visitor.window) if (!visitor.window)
{ {
{ // scope AutoSetRestore<WindowClause*> autoWindowNode2(&visitor.windowNode, NULL);
AutoSetRestore<WindowClause*> autoWindowNode2(&visitor.windowNode, NULL);
for (auto& child : aggNode->dsqlChildNodes) for (auto& child : aggNode->dsqlChildNodes)
child->remap(visitor); child->remap(visitor);
}
if (window->partition) doDsqlFieldRemapper(visitor, window);
{
for (unsigned i = 0; i < window->partition->items.getCount(); ++i)
{
AutoSetRestore<WindowClause*> autoWindowNode2(&visitor.windowNode, NULL);
doDsqlFieldRemapper(visitor, window->partition->items[i]);
}
}
// ASF: I'm not sure if this is enough or frame values needs to be remapped as well.
if (window->order)
{
for (unsigned i = 0; i < window->order->items.getCount(); ++i)
{
AutoSetRestore<WindowClause*> autoWindowNode2(&visitor.windowNode, NULL);
doDsqlFieldRemapper(visitor, window->order->items[i]);
}
}
} }
else if (visitor.dsqlScratch->scopeLevel == aggFinder.deepestLevel) else if (visitor.dsqlScratch->scopeLevel == aggFinder.deepestLevel)
{ {
return PASS1_post_map(visitor.dsqlScratch, aggNode, visitor.context, return PASS1_post_map(visitor.dsqlScratch, aggNode, visitor.context,
visitor.windowNode); visitor.windowNode);
} }