MCPcopy Create free account
hub / github.com/bytedance/bolt / readColumns

Function readColumns

bolt/serializers/PrestoSerializer.cpp:1105–1179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1103}
1104
1105void readColumns(
1106 ByteInputStream* source,
1107 bolt::memory::MemoryPool* pool,
1108 const std::vector<TypePtr>& types,
1109 std::vector<VectorPtr>& results,
1110 vector_size_t resultOffset,
1111 bool useLosslessTimestamp) {
1112 static const std::unordered_map<
1113 TypeKind,
1114 std::function<void(
1115 ByteInputStream * source,
1116 const TypePtr& type,
1117 bolt::memory::MemoryPool* pool,
1118 VectorPtr& result,
1119 vector_size_t resultOffset,
1120 bool useLosslessTimestamp)>>
1121 readers = {
1122 {TypeKind::BOOLEAN, &read<bool>},
1123 {TypeKind::TINYINT, &read<int8_t>},
1124 {TypeKind::SMALLINT, &read<int16_t>},
1125 {TypeKind::INTEGER, &read<int32_t>},
1126 {TypeKind::BIGINT, &read<int64_t>},
1127 {TypeKind::HUGEINT, &read<int128_t>},
1128 {TypeKind::REAL, &read<float>},
1129 {TypeKind::DOUBLE, &read<double>},
1130 {TypeKind::TIMESTAMP, &read<Timestamp>},
1131 {TypeKind::VARCHAR, &read<StringView>},
1132 {TypeKind::VARBINARY, &read<StringView>},
1133 {TypeKind::ARRAY, &readArrayVector},
1134 {TypeKind::MAP, &readMapVector},
1135 {TypeKind::ROW, &readRowVector},
1136 {TypeKind::VARIANT, &readRowVector},
1137 {TypeKind::UNKNOWN, &read<UnknownValue>}};
1138
1139 BOLT_CHECK_EQ(types.size(), results.size());
1140
1141 for (int32_t i = 0; i < types.size(); ++i) {
1142 const auto& columnType = types[i];
1143 auto& columnResult = results[i];
1144
1145 const auto encoding = readLengthPrefixedString(source);
1146 if (encoding == kRLE) {
1147 readConstantVector(
1148 source,
1149 columnType,
1150 pool,
1151 columnResult,
1152 resultOffset,
1153 useLosslessTimestamp);
1154 } else if (encoding == kDictionary) {
1155 readDictionaryVector(
1156 source,
1157 columnType,
1158 pool,
1159 columnResult,
1160 resultOffset,
1161 useLosslessTimestamp);
1162 } else {

Callers 6

readConstantVectorFunction · 0.70
readDictionaryVectorFunction · 0.70
readArrayVectorFunction · 0.70
readMapVectorFunction · 0.70
readRowVectorFunction · 0.70
deserializeMethod · 0.70

Calls 9

readLengthPrefixedStringFunction · 0.85
checkTypeEncodingFunction · 0.85
readConstantVectorFunction · 0.70
readDictionaryVectorFunction · 0.70
sizeMethod · 0.45
findMethod · 0.45
kindMethod · 0.45
endMethod · 0.45
kindNameMethod · 0.45

Tested by

no test coverage detected