@@ -2457,31 +2457,48 @@ RecordSource* UnionSourceNode::compile(thread_db* tdbb, Optimizer* opt, bool /*i
2457
2457
// Identify all of the streams for which a dbkey may need to be carried through a sort.
2458
2458
void UnionSourceNode::computeDbKeyStreams (StreamList& streamList) const
2459
2459
{
2460
- const NestConst<RseNode>* ptr = clauses.begin ();
2461
-
2462
- for (const NestConst<RseNode>* const end = clauses.end (); ptr != end; ++ptr)
2463
- (*ptr)->computeDbKeyStreams (streamList);
2460
+ for (const auto & clause : clauses)
2461
+ clause->computeDbKeyStreams (streamList);
2464
2462
}
2465
2463
2466
2464
bool UnionSourceNode::computable (CompilerScratch* csb, StreamType stream,
2467
2465
bool allowOnlyCurrentStream, ValueExprNode* /* value*/ )
2468
2466
{
2469
- NestConst<RseNode>* ptr = clauses.begin ();
2470
-
2471
- for (NestConst<RseNode>* const end = clauses.end (); ptr != end; ++ptr)
2467
+ for (auto & clause : clauses)
2472
2468
{
2473
- if (!(*ptr) ->computable (csb, stream, allowOnlyCurrentStream, NULL ))
2469
+ if (!clause ->computable (csb, stream, allowOnlyCurrentStream, NULL ))
2474
2470
return false ;
2475
2471
}
2476
2472
2473
+ for (auto & map : maps)
2474
+ {
2475
+ for (auto & source : map->sourceList )
2476
+ {
2477
+ if (!source->computable (csb, stream, allowOnlyCurrentStream, NULL ))
2478
+ return false ;
2479
+ }
2480
+
2481
+ // dimitr: no need to process also map->targetList,
2482
+ // as its nodes are purely local to the union stream
2483
+ }
2484
+
2477
2485
return true ;
2478
2486
}
2479
2487
2480
2488
void UnionSourceNode::findDependentFromStreams (const CompilerScratch* csb,
2481
2489
StreamType currentStream, SortedStreamList* streamList)
2482
2490
{
2483
- for (auto clause : clauses)
2491
+ for (auto & clause : clauses)
2484
2492
clause->findDependentFromStreams (csb, currentStream, streamList);
2493
+
2494
+ for (auto & map : maps)
2495
+ {
2496
+ for (auto & source : map->sourceList )
2497
+ source->findDependentFromStreams (csb, currentStream, streamList);
2498
+
2499
+ // dimitr: no need to process also map->targetList,
2500
+ // as its nodes are purely local to the union stream
2501
+ }
2485
2502
}
2486
2503
2487
2504
0 commit comments