Note that we can have NULL order here, in case of window function with shouldCallWinPass returning true, with partition, and without order. Example: ROW_NUMBER() OVER (PARTITION BY N).
| 457 | // Note that we can have NULL order here, in case of window function with shouldCallWinPass |
| 458 | // returning true, with partition, and without order. Example: ROW_NUMBER() OVER (PARTITION BY N). |
| 459 | WindowedStream::WindowStream::WindowStream(thread_db* tdbb, CompilerScratch* csb, StreamType stream, |
| 460 | const NestValueArray* group, BaseBufferedStream* next, |
| 461 | SortNode* order, MapNode* windowMap, |
| 462 | FrameExtent* frameExtent, |
| 463 | Exclusion exclusion) |
| 464 | : BaseAggWinStream(tdbb, csb, stream, group, NULL, false, next), |
| 465 | m_order(order), |
| 466 | m_windowMap(windowMap), |
| 467 | m_frameExtent(frameExtent), |
| 468 | m_arithNodes(csb->csb_pool), |
| 469 | m_aggSources(csb->csb_pool), |
| 470 | m_aggTargets(csb->csb_pool), |
| 471 | m_winPassSources(csb->csb_pool), |
| 472 | m_winPassTargets(csb->csb_pool), |
| 473 | m_exclusion(exclusion), |
| 474 | m_invariantOffsets(0) |
| 475 | { |
| 476 | // Separate nodes that requires the winPass call. |
| 477 | |
| 478 | const NestConst<ValueExprNode>* const sourceEnd = m_windowMap->sourceList.end(); |
| 479 | |
| 480 | for (const NestConst<ValueExprNode>* source = m_windowMap->sourceList.begin(), |
| 481 | *target = m_windowMap->targetList.begin(); |
| 482 | source != sourceEnd; |
| 483 | ++source, ++target) |
| 484 | { |
| 485 | const AggNode* aggNode = nodeAs<AggNode>(*source); |
| 486 | |
| 487 | if (aggNode) |
| 488 | { |
| 489 | unsigned capabilities = aggNode->getCapabilities(); |
| 490 | |
| 491 | if (capabilities & AggNode::CAP_WANTS_AGG_CALLS) |
| 492 | { |
| 493 | m_aggSources.add(*source); |
| 494 | m_aggTargets.add(*target); |
| 495 | } |
| 496 | |
| 497 | if (capabilities & AggNode::CAP_WANTS_WIN_PASS_CALL) |
| 498 | { |
| 499 | m_winPassSources.add(*source); |
| 500 | m_winPassTargets.add(*target); |
| 501 | } |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | m_arithNodes.resize(2); |
| 506 | |
| 507 | if (m_order) |
| 508 | { |
| 509 | dsc dummyDesc; |
| 510 | |
| 511 | for (unsigned i = 0; i < 2; ++i) |
| 512 | { |
| 513 | Frame* frame = i == 0 ? |
| 514 | m_frameExtent->frame1 : m_frameExtent->frame2; |
| 515 | |
| 516 | if (m_frameExtent->unit == FrameExtent::Unit::RANGE && frame->value) |
nothing calls this directly
no test coverage detected