MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / finalizeInternal

Method finalizeInternal

src/processor/operator/result_collector.cpp:60–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60void 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
89std::unique_ptr<main::QueryResult> ResultCollector::getQueryResult() const {
90 return std::make_unique<main::MaterializedQueryResult>(sharedState->getTable());

Callers

nothing calls this directly

Calls 9

getResultSetFunction · 0.85
getColumnMethod · 0.80
getMethod · 0.45
getTableMethod · 0.45
getTableSchemaMethod · 0.45
sizeMethod · 0.45
isFlatMethod · 0.45
isEmptyMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected