| 141 | } |
| 142 | |
| 143 | static offset_t tableFunc(const TableFuncInput& input, TableFuncOutput&) { |
| 144 | auto& bindData = input.bindData->cast<CacheArrayColumnBindData>(); |
| 145 | const auto sharedState = input.sharedState->ptrCast<CacheArrayColumnSharedState>(); |
| 146 | auto localState = input.localState->ptrCast<CacheArrayColumnLocalState>(); |
| 147 | const auto morsel = sharedState->getMorsel(); |
| 148 | if (morsel.isInvalid()) { |
| 149 | return 0; |
| 150 | } |
| 151 | auto context = input.context->clientContext; |
| 152 | auto columnType = bindData.tableEntry->getProperty(bindData.propertyID).getType().copy(); |
| 153 | auto& table = sharedState->table; |
| 154 | auto& scanState = *localState->scanState; |
| 155 | for (auto i = morsel.startOffset; i < morsel.endOffset; i++) { |
| 156 | auto numRows = table.getNumTuplesInNodeGroup(i); |
| 157 | auto data = storage::ColumnChunkFactory::createColumnChunkData( |
| 158 | *storage::MemoryManager::Get(*context), columnType.copy(), false /*enableCompression*/, |
| 159 | numRows, storage::ResidencyState::IN_MEMORY, true /*hasNullData*/, |
| 160 | false /*initializeToZero*/); |
| 161 | if (columnType.getLogicalTypeID() == LogicalTypeID::ARRAY) { |
| 162 | auto arrayTypeInfo = columnType.getExtraTypeInfo()->constPtrCast<ArrayTypeInfo>(); |
| 163 | data->cast<storage::ListChunkData>().getDataColumnChunk()->resize( |
| 164 | numRows * arrayTypeInfo->getNumElements()); |
| 165 | } |
| 166 | scanTableDataToChunk(i, scanState, data.get(), transaction::Transaction::Get(*context), |
| 167 | table); |
| 168 | sharedState->merge(i, std::move(data)); |
| 169 | } |
| 170 | return morsel.endOffset - morsel.startOffset; |
| 171 | } |
| 172 | |
| 173 | static double progressFunc(TableFuncSharedState* sharedState) { |
| 174 | const auto cacheColumnSharedState = sharedState->ptrCast<CacheArrayColumnSharedState>(); |
nothing calls this directly
no test coverage detected