Skip to content

Commit

Permalink
More mutable properties from vectors (facebookincubator#8737)
Browse files Browse the repository at this point in the history
Summary:

Exposing additional mutable properties (indices and valuesVector) from DictionaryVector without requiring a shared pointer (and messing up ref counting).

Reviewed By: Yuhta, pedroerp

Differential Revision: D53693084
  • Loading branch information
helfman authored and facebook-github-bot committed Mar 26, 2024
1 parent 7fc0966 commit 5d56bbc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions velox/vector/BaseVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,10 @@ class BaseVector {
VELOX_UNSUPPORTED("Vector is not a wrapper");
}

virtual VectorPtr& valueVector() {
VELOX_UNSUPPORTED("Vector is not a wrapper");
}

virtual BaseVector* loadedVector() {
return this;
}
Expand Down
4 changes: 4 additions & 0 deletions velox/vector/ConstantVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ class ConstantVector final : public SimpleVector<T> {
return valueVector_;
}

VectorPtr& valueVector() override {
return valueVector_;
}

// Index of the element of the base vector that determines the value of this
// constant vector.
vector_size_t index() const {
Expand Down
8 changes: 8 additions & 0 deletions velox/vector/DictionaryVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,18 @@ class DictionaryVector : public SimpleVector<T> {
return indices_;
}

inline BufferPtr& indices() {
return indices_;
}

const VectorPtr& valueVector() const override {
return dictionaryValues_;
}

VectorPtr& valueVector() override {
return dictionaryValues_;
}

BufferPtr wrapInfo() const override {
return indices_;
}
Expand Down
4 changes: 4 additions & 0 deletions velox/vector/SequenceVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ class SequenceVector : public SimpleVector<T> {
return sequenceValues_;
}

VectorPtr& valueVector() override {
return sequenceValues_;
}

BufferPtr getSequenceLengths() const {
return sequenceLengths_;
}
Expand Down

0 comments on commit 5d56bbc

Please sign in to comment.