From a6bd7851e80bf44a0b414f9cd646b90f0d2b63f2 Mon Sep 17 00:00:00 2001 From: asfernandes Date: Tue, 16 Feb 2010 21:16:21 +0000 Subject: [PATCH] Misc and fix per Claudio comments --- src/dsql/AggNodes.cpp | 5 ----- src/dsql/ExprNodes.cpp | 1 + src/jrd/recsrc/AggregatedStream.cpp | 34 ++++++++++++++++++----------- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/dsql/AggNodes.cpp b/src/dsql/AggNodes.cpp index cfd99dfd02..151d3ee9eb 100644 --- a/src/dsql/AggNodes.cpp +++ b/src/dsql/AggNodes.cpp @@ -244,11 +244,6 @@ bool AggNode::dsqlFieldRemapper(FieldRemapper& visitor) visitor.context, visitor.partitionNode, visitor.orderNode)); return false; } - - for (dsql_nod*** i = dsqlChildNodes.begin(); i != dsqlChildNodes.end(); ++i) - visitor.visit(*i); - - return false; } for (dsql_nod*** i = dsqlChildNodes.begin(); i != dsqlChildNodes.end(); ++i) diff --git a/src/dsql/ExprNodes.cpp b/src/dsql/ExprNodes.cpp index 0db296d6ef..2e5d13206a 100644 --- a/src/dsql/ExprNodes.cpp +++ b/src/dsql/ExprNodes.cpp @@ -481,6 +481,7 @@ bool OverNode::dsqlSubSelectFinder(SubSelectFinder& /*visitor*/) bool OverNode::dsqlFieldRemapper(FieldRemapper& visitor) { + // Save the values to restore them in the end. AutoSetRestore autoPartitionNode(&visitor.partitionNode, visitor.partitionNode); AutoSetRestore autoOrderNode(&visitor.orderNode, visitor.orderNode); diff --git a/src/jrd/recsrc/AggregatedStream.cpp b/src/jrd/recsrc/AggregatedStream.cpp index 2502793cb4..bc2fc7c6d6 100644 --- a/src/jrd/recsrc/AggregatedStream.cpp +++ b/src/jrd/recsrc/AggregatedStream.cpp @@ -562,20 +562,28 @@ bool SlidingWindow::move(SINT64 delta) return false; } - impure_value* impure = partitionKeys.getBuffer(group->nod_count); - memset(impure, 0, sizeof(impure_value) * group->nod_count); - - dsc* desc; - - for (jrd_nod** ptr = group->nod_arg, **end = ptr + group->nod_count; ptr < end; - ++ptr, ++impure) + try { - jrd_nod* from = *ptr; - desc = EVL_expr(tdbb, from); - if (request->req_flags & req_null) - impure->vlu_desc.dsc_address = NULL; - else - EVL_make_value(tdbb, desc, impure); + impure_value* impure = partitionKeys.getBuffer(group->nod_count); + memset(impure, 0, sizeof(impure_value) * group->nod_count); + + dsc* desc; + + for (jrd_nod** ptr = group->nod_arg, **end = ptr + group->nod_count; ptr < end; + ++ptr, ++impure) + { + jrd_nod* from = *ptr; + desc = EVL_expr(tdbb, from); + if (request->req_flags & req_null) + impure->vlu_desc.dsc_address = NULL; + else + EVL_make_value(tdbb, desc, impure); + } + } + catch (const Exception&) + { + stream->locate(tdbb, savedPosition); // Reposition for a new try. + throw; } moved = true;