| 797 | vector_size_t size = indices->size() / sizeof(vector_size_t); |
| 798 | return wrapInDictionary( |
| 799 | BufferPtr(nullptr), std::move(indices), size, std::move(source)); |
| 800 | } |
| 801 | |
| 802 | bool isLazyNotLoaded(const BaseVector& vector) { |
| 803 | switch (vector.encoding()) { |
| 804 | case VectorEncoding::Simple::LAZY: |
| 805 | if (!vector.asUnchecked<LazyVector>()->isLoaded()) { |
| 806 | return true; |
| 807 | } |
| 808 | |
| 809 | // Lazy Vectors may wrap lazy vectors (e.g. nested Rows) so we need to go |
| 810 | // deeper. |
| 811 | return isLazyNotLoaded(*vector.asUnchecked<LazyVector>()->loadedVector()); |
| 812 | case VectorEncoding::Simple::DICTIONARY: |
| 813 | case VectorEncoding::Simple::SEQUENCE: |
| 814 | return isLazyNotLoaded(*vector.valueVector()); |
| 815 | case VectorEncoding::Simple::CONSTANT: |
| 816 | return vector.valueVector() ? isLazyNotLoaded(*vector.valueVector()) |
| 817 | : false; |
| 818 | case VectorEncoding::Simple::ROW: |
| 819 | return vector.asUnchecked<RowVector>()->containsLazyNotLoaded(); |
| 820 | default: |
| 821 | return false; |
| 822 | } |
| 823 | } |