@@ -2175,31 +2175,48 @@ RecordSource* UnionSourceNode::compile(thread_db* tdbb, Optimizer* opt, bool /*i
21752175// Identify all of the streams for which a dbkey may need to be carried through a sort.
21762176void UnionSourceNode::computeDbKeyStreams (StreamList& streamList) const
21772177{
2178- const NestConst<RseNode>* ptr = clauses.begin ();
2179-
2180- for (const NestConst<RseNode>* const end = clauses.end (); ptr != end; ++ptr)
2181- (*ptr)->computeDbKeyStreams (streamList);
2178+ for (const auto & clause : clauses)
2179+ clause->computeDbKeyStreams (streamList);
21822180}
21832181
21842182bool UnionSourceNode::computable (CompilerScratch* csb, StreamType stream,
21852183 bool allowOnlyCurrentStream, ValueExprNode* /* value*/ )
21862184{
2187- NestConst<RseNode>* ptr = clauses.begin ();
2188-
2189- for (NestConst<RseNode>* const end = clauses.end (); ptr != end; ++ptr)
2185+ for (auto & clause : clauses)
21902186 {
2191- if (!(*ptr) ->computable (csb, stream, allowOnlyCurrentStream, NULL ))
2187+ if (!clause ->computable (csb, stream, allowOnlyCurrentStream, NULL ))
21922188 return false ;
21932189 }
21942190
2191+ for (auto & map : maps)
2192+ {
2193+ for (auto & source : map->sourceList )
2194+ {
2195+ if (!source->computable (csb, stream, allowOnlyCurrentStream, NULL ))
2196+ return false ;
2197+ }
2198+
2199+ // dimitr: no need to process also map->targetList,
2200+ // as its nodes are purely local to the union stream
2201+ }
2202+
21952203 return true ;
21962204}
21972205
21982206void UnionSourceNode::findDependentFromStreams (const CompilerScratch* csb,
21992207 StreamType currentStream, SortedStreamList* streamList)
22002208{
2201- for (auto clause : clauses)
2209+ for (auto & clause : clauses)
22022210 clause->findDependentFromStreams (csb, currentStream, streamList);
2211+
2212+ for (auto & map : maps)
2213+ {
2214+ for (auto & source : map->sourceList )
2215+ source->findDependentFromStreams (csb, currentStream, streamList);
2216+
2217+ // dimitr: no need to process also map->targetList,
2218+ // as its nodes are purely local to the union stream
2219+ }
22032220}
22042221
22052222
0 commit comments