Skip to content

Commit

Permalink
Schema evolution support for reader value hooks (#72)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #72

X-link: facebookincubator/velox#10755

Currently reader value hook is not considering schema evolution at all, this change fix that.

Reviewed By: kevinwilfong

Differential Revision: D61229494

fbshipit-source-id: 729bb90611fb3164282b524376eda20985a30194
  • Loading branch information
Yuhta authored and facebook-github-bot committed Aug 20, 2024
1 parent 73fb6ff commit eb3a1dd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
13 changes: 5 additions & 8 deletions dwio/nimble/encodings/DictionaryEncoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,16 @@ class DictionaryIndicesHook : public velox::ValueHook {
return false;
}

void addValue(vector_size_t i, const void* value) final {
indices_[i - offset_] = *reinterpret_cast<const uint32_t*>(value);
void addValue(vector_size_t i, int64_t value) final {
indices_[i - offset_] = value;
}

void addValues(
const vector_size_t* rows,
const void* values,
vector_size_t size,
uint8_t valueWidth) final {
NIMBLE_DASSERT(valueWidth == sizeof(uint32_t), "");
auto* indices = reinterpret_cast<const uint32_t*>(values);
const int32_t* values,
vector_size_t size) final {
for (vector_size_t i = 0; i < size; ++i) {
indices_[rows[i] - offset_] = indices[i];
indices_[rows[i] - offset_] = values[i];
}
}

Expand Down
3 changes: 1 addition & 2 deletions dwio/nimble/encodings/MainlyConstantEncoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,7 @@ void MainlyConstantEncoding<T>::bulkScan(
visitor.setRowIndex(visitor.numRows());
if constexpr (V::kHasHook) {
NIMBLE_DASSERT(numValues == numNonNulls, "");
visitor.hook().addValues(
scatterRows, values, numNonNulls, sizeof(ValueType));
visitor.hook().addValues(scatterRows, values, numNonNulls);
} else {
visitor.addNumValues(V::kFilterOnly ? numHits : numValues);
}
Expand Down
3 changes: 1 addition & 2 deletions dwio/nimble/encodings/RleEncoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,7 @@ void RLEEncoding<T>::bulkScan(
}
if constexpr (V::kHasHook) {
NIMBLE_DASSERT(numValues == numNonNulls, "");
visitor.hook().addValues(
scatterRows, values, numNonNulls, sizeof(ValueType));
visitor.hook().addValues(scatterRows, values, numNonNulls);
} else {
visitor.addNumValues(V::kFilterOnly ? numHits : numValues);
}
Expand Down

0 comments on commit eb3a1dd

Please sign in to comment.