| 59 | }; |
| 60 | |
| 61 | void DecodedVector::decode( |
| 62 | const BaseVector& vector, |
| 63 | const SelectivityVector* rows, |
| 64 | bool loadLazy) { |
| 65 | reset(end(vector.size(), rows)); |
| 66 | loadLazy_ = loadLazy; |
| 67 | bool isTopLevelLazyAndLoaded = |
| 68 | vector.isLazy() && vector.asUnchecked<LazyVector>()->isLoaded(); |
| 69 | if (isTopLevelLazyAndLoaded || (loadLazy_ && isLazyNotLoaded(vector))) { |
| 70 | decode(*vector.loadedVector(), rows, loadLazy); |
| 71 | return; |
| 72 | } |
| 73 | |
| 74 | auto encoding = vector.encoding(); |
| 75 | switch (encoding) { |
| 76 | case VectorEncoding::Simple::FLAT: |
| 77 | case VectorEncoding::Simple::BIASED: |
| 78 | case VectorEncoding::Simple::ROW: |
| 79 | case VectorEncoding::Simple::VARIANT: |
| 80 | case VectorEncoding::Simple::ARRAY: |
| 81 | case VectorEncoding::Simple::MAP: |
| 82 | case VectorEncoding::Simple::LAZY: |
| 83 | isIdentityMapping_ = true; |
| 84 | setBaseData(vector, rows); |
| 85 | return; |
| 86 | case VectorEncoding::Simple::CONSTANT: { |
| 87 | isConstantMapping_ = true; |
| 88 | if (isLazyNotLoaded(vector)) { |
| 89 | baseVector_ = vector.valueVector().get(); |
| 90 | constantIndex_ = vector.wrapInfo()->as<vector_size_t>()[0]; |
| 91 | mayHaveNulls_ = true; |
| 92 | } else { |
| 93 | setBaseData(vector, rows); |
| 94 | } |
| 95 | break; |
| 96 | } |
| 97 | case VectorEncoding::Simple::DICTIONARY: |
| 98 | case VectorEncoding::Simple::SEQUENCE: { |
| 99 | combineWrappers(&vector, rows); |
| 100 | break; |
| 101 | } |
| 102 | default: |
| 103 | BOLT_FAIL( |
| 104 | "Unsupported vector encoding: {}", |
| 105 | VectorEncoding::mapSimpleToName(encoding)); |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | void DecodedVector::makeIndices( |
| 110 | const BaseVector& vector, |