@@ -2175,31 +2175,48 @@ RecordSource* UnionSourceNode::compile(thread_db* tdbb, Optimizer* opt, bool /*i
2175
2175
// Identify all of the streams for which a dbkey may need to be carried through a sort.
2176
2176
void UnionSourceNode::computeDbKeyStreams (StreamList& streamList) const
2177
2177
{
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);
2182
2180
}
2183
2181
2184
2182
bool UnionSourceNode::computable (CompilerScratch* csb, StreamType stream,
2185
2183
bool allowOnlyCurrentStream, ValueExprNode* /* value*/ )
2186
2184
{
2187
- NestConst<RseNode>* ptr = clauses.begin ();
2188
-
2189
- for (NestConst<RseNode>* const end = clauses.end (); ptr != end; ++ptr)
2185
+ for (auto & clause : clauses)
2190
2186
{
2191
- if (!(*ptr) ->computable (csb, stream, allowOnlyCurrentStream, NULL ))
2187
+ if (!clause ->computable (csb, stream, allowOnlyCurrentStream, NULL ))
2192
2188
return false ;
2193
2189
}
2194
2190
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
+
2195
2203
return true ;
2196
2204
}
2197
2205
2198
2206
void UnionSourceNode::findDependentFromStreams (const CompilerScratch* csb,
2199
2207
StreamType currentStream, SortedStreamList* streamList)
2200
2208
{
2201
- for (auto clause : clauses)
2209
+ for (auto & clause : clauses)
2202
2210
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
+ }
2203
2220
}
2204
2221
2205
2222
0 commit comments