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

Function serializeDictionaryVector

bolt/serializers/PrestoSerializer.cpp:1934–1960  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1932
1933template <TypeKind Kind>
1934void serializeDictionaryVector(
1935 const BaseVector* vector,
1936 const folly::Range<const IndexRange*>& ranges,
1937 VectorStream* stream) {
1938 // Cannot serialize dictionary as PrestoPage dictionary if it has nulls.
1939 // Also check if the stream was set up for dictionary (we had to know the
1940 // encoding type when creating VectorStream for that).
1941 if (vector->nulls() || !stream->isDictionaryStream()) {
1942 serializeWrapped(vector, ranges, stream);
1943 return;
1944 }
1945
1946 using T = typename KindToFlatVector<Kind>::WrapperType;
1947 auto dictionaryVector = vector->as<DictionaryVector<T>>();
1948
1949 std::vector<IndexRange> childRanges;
1950 childRanges.push_back({0, dictionaryVector->valueVector()->size()});
1951 serializeColumn(
1952 dictionaryVector->valueVector().get(), childRanges, stream->childAt(0));
1953
1954 const BufferPtr& indices = dictionaryVector->indices();
1955 auto* rawIndices = indices->as<vector_size_t>();
1956 for (const auto& range : ranges) {
1957 stream->appendNonNull(range.size);
1958 stream->append<int32_t>(folly::Range(&rawIndices[range.begin], range.size));
1959 }
1960}
1961
1962template <TypeKind kind>
1963void serializeConstantVectorImpl(

Callers

nothing calls this directly

Calls 11

serializeWrappedFunction · 0.85
serializeColumnFunction · 0.85
isDictionaryStreamMethod · 0.80
childAtMethod · 0.80
indicesMethod · 0.80
RangeClass · 0.50
nullsMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
appendNonNullMethod · 0.45

Tested by

no test coverage detected