| 58 | } |
| 59 | |
| 60 | void ResultCollector::finalizeInternal(ExecutionContext* context) { |
| 61 | switch (info.accumulateType) { |
| 62 | case AccumulateType::OPTIONAL_: { |
| 63 | auto localResultSet = getResultSet(MemoryManager::Get(*context->clientContext)); |
| 64 | initNecessaryLocalState(localResultSet.get(), context); |
| 65 | // We should remove currIdx completely as some of the code still relies on currIdx = -1 to |
| 66 | // check if the state if unFlat or not. This should no longer be necessary. |
| 67 | // TODO(Ziyi): add an interface in factorized table |
| 68 | auto table = sharedState->getTable(); |
| 69 | auto tableSchema = table->getTableSchema(); |
| 70 | for (auto i = 0u; i < payloadVectors.size(); ++i) { |
| 71 | auto columnSchema = tableSchema->getColumn(i); |
| 72 | if (columnSchema->isFlat()) { |
| 73 | payloadVectors[i]->state->setToFlat(); |
| 74 | } |
| 75 | } |
| 76 | if (table->isEmpty()) { |
| 77 | for (auto& vector : payloadVectors) { |
| 78 | vector->setAsSingleNullEntry(); |
| 79 | } |
| 80 | markVector->setValue<bool>(0, false); |
| 81 | table->append(payloadAndMarkVectors); |
| 82 | } |
| 83 | } |
| 84 | default: |
| 85 | break; |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | std::unique_ptr<main::QueryResult> ResultCollector::getQueryResult() const { |
| 90 | return std::make_unique<main::MaterializedQueryResult>(sharedState->getTable()); |
nothing calls this directly
no test coverage detected