| 1932 | |
| 1933 | template <TypeKind Kind> |
| 1934 | void 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 | |
| 1962 | template <TypeKind kind> |
| 1963 | void serializeConstantVectorImpl( |
nothing calls this directly
no test coverage detected