| 76 | } |
| 77 | |
| 78 | static void appendStorageInfoForChunkData(StorageInfoLocalState* localState, DataChunk& outputChunk, |
| 79 | StorageInfoOutputData& outputData, const Column& column, const ColumnChunkData& chunkData, |
| 80 | bool ignoreNull = false) { |
| 81 | resetOutputIfNecessary(localState, outputChunk); |
| 82 | auto vectorPos = outputChunk.state->getSelVector().getSelSize(); |
| 83 | auto residency = chunkData.getResidencyState(); |
| 84 | ColumnChunkMetadata metadata; |
| 85 | switch (residency) { |
| 86 | case ResidencyState::IN_MEMORY: { |
| 87 | metadata = chunkData.getMetadataToFlush(); |
| 88 | } break; |
| 89 | case ResidencyState::ON_DISK: { |
| 90 | metadata = chunkData.getMetadata(); |
| 91 | } break; |
| 92 | default: { |
| 93 | UNREACHABLE_CODE; |
| 94 | } |
| 95 | } |
| 96 | auto& columnType = chunkData.getDataType(); |
| 97 | outputChunk.getValueVectorMutable(0).setValue(vectorPos, outputData.tableType); |
| 98 | outputChunk.getValueVectorMutable(1).setValue<uint64_t>(vectorPos, outputData.nodeGroupIdx); |
| 99 | outputChunk.getValueVectorMutable(2).setValue<uint64_t>(vectorPos, outputData.chunkIdx); |
| 100 | outputChunk.getValueVectorMutable(3).setValue(vectorPos, |
| 101 | ResidencyStateUtils::toString(residency)); |
| 102 | outputChunk.getValueVectorMutable(4).setValue(vectorPos, column.getName()); |
| 103 | outputChunk.getValueVectorMutable(5).setValue(vectorPos, columnType.toString()); |
| 104 | outputChunk.getValueVectorMutable(6).setValue<uint64_t>(vectorPos, metadata.getStartPageIdx()); |
| 105 | outputChunk.getValueVectorMutable(7).setValue<uint64_t>(vectorPos, metadata.getNumPages()); |
| 106 | outputChunk.getValueVectorMutable(8).setValue<uint64_t>(vectorPos, metadata.numValues); |
| 107 | |
| 108 | auto customToString = [&]<typename T>(T) { |
| 109 | outputChunk.getValueVectorMutable(9).setValue(vectorPos, |
| 110 | std::to_string(metadata.compMeta.min.get<T>())); |
| 111 | outputChunk.getValueVectorMutable(10).setValue(vectorPos, |
| 112 | std::to_string(metadata.compMeta.max.get<T>())); |
| 113 | }; |
| 114 | auto physicalType = columnType.getPhysicalType(); |
| 115 | TypeUtils::visit( |
| 116 | physicalType, [&](string_t) { customToString(uint32_t()); }, |
| 117 | [&](list_entry_t) { customToString(uint64_t()); }, |
| 118 | [&](internalID_t) { customToString(uint64_t()); }, |
| 119 | [&]<typename T>(T) |
| 120 | requires(std::integral<T> || std::floating_point<T>) |
| 121 | { |
| 122 | auto min = metadata.compMeta.min.get<T>(); |
| 123 | auto max = metadata.compMeta.max.get<T>(); |
| 124 | outputChunk.getValueVectorMutable(9).setValue(vectorPos, |
| 125 | TypeUtils::entryToString(columnType, (uint8_t*)&min, |
| 126 | &outputChunk.getValueVectorMutable(9))); |
| 127 | outputChunk.getValueVectorMutable(10).setValue(vectorPos, |
| 128 | TypeUtils::entryToString(columnType, (uint8_t*)&max, |
| 129 | &outputChunk.getValueVectorMutable(10))); |
| 130 | }, |
| 131 | // Types which don't support statistics. |
| 132 | // types not supported by TypeUtils::visit can |
| 133 | // also be ignored since we don't track statistics for them |
| 134 | [](int128_t) {}, [](struct_entry_t) {}, [](interval_t) {}, [](uint128_t) {}); |
| 135 | outputChunk.getValueVectorMutable(11).setValue(vectorPos, |
no test coverage detected