Appendable container for serialized values. To append a value at a time, call appendNull or appendNonNull first. Then call appendLength if the type has a length. A null value has a length of 0. Then call appendValue if the value was not null.
| 1224 | // type has a length. A null value has a length of 0. Then call appendValue if |
| 1225 | // the value was not null. |
| 1226 | class VectorStream { |
| 1227 | public: |
| 1228 | // This constructor takes an optional encoding and vector. In cases where the |
| 1229 | // vector (data) is not available when the stream is created, callers can also |
| 1230 | // manually specify the encoding, which only applies to the top level stream. |
| 1231 | // If both are specified, `encoding` takes precedence over the actual |
| 1232 | // encoding of `vector`. Only 'flat' encoding can take precedence over the |
| 1233 | // input data encoding. |
| 1234 | VectorStream( |
| 1235 | const TypePtr& type, |
| 1236 | std::optional<VectorEncoding::Simple> encoding, |
| 1237 | std::optional<VectorPtr> vector, |
| 1238 | StreamArena* streamArena, |
| 1239 | int32_t initialNumRows, |
| 1240 | bool useLosslessTimestamp) |
| 1241 | : type_(type), |
| 1242 | streamArena_(streamArena), |
| 1243 | encoding_(getEncoding(encoding, vector)), |
| 1244 | useLosslessTimestamp_(useLosslessTimestamp), |
| 1245 | nulls_(streamArena, true, true), |
| 1246 | lengths_(streamArena), |
| 1247 | values_(streamArena), |
| 1248 | isLongDecimal_(type_->isLongDecimal()) { |
| 1249 | if (initialNumRows == 0) { |
| 1250 | initializeHeader(typeToEncodingName(type), *streamArena); |
| 1251 | return; |
| 1252 | } |
| 1253 | |
| 1254 | if (encoding_.has_value()) { |
| 1255 | switch (encoding_.value()) { |
| 1256 | case VectorEncoding::Simple::CONSTANT: { |
| 1257 | initializeHeader(kRLE, *streamArena); |
| 1258 | isConstantStream_ = true; |
| 1259 | children_.emplace_back(std::make_unique<VectorStream>( |
| 1260 | type_, |
| 1261 | std::nullopt, |
| 1262 | std::nullopt, |
| 1263 | streamArena, |
| 1264 | initialNumRows, |
| 1265 | useLosslessTimestamp)); |
| 1266 | return; |
| 1267 | } |
| 1268 | case VectorEncoding::Simple::DICTIONARY: { |
| 1269 | initializeHeader(kDictionary, *streamArena); |
| 1270 | values_.startWrite(initialNumRows * 4); |
| 1271 | isDictionaryStream_ = true; |
| 1272 | children_.emplace_back(std::make_unique<VectorStream>( |
| 1273 | type_, |
| 1274 | std::nullopt, |
| 1275 | std::nullopt, |
| 1276 | streamArena, |
| 1277 | initialNumRows, |
| 1278 | useLosslessTimestamp)); |
| 1279 | return; |
| 1280 | } |
| 1281 | default: |
| 1282 | break; |
| 1283 | } |
nothing calls this directly
no outgoing calls
no test coverage detected