Skip to content

Commit

Permalink
fix: IPPrefix serialization with null case (facebookincubator#12280)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebookincubator#12280

We need let `serializeWrapped` handle dealing with nulls for ipprefix. It will deal with the dictionary with `wrappedVectorShared`.

Reviewed By: Yuhta

Differential Revision: D69266615

fbshipit-source-id: 4c54c5e27c3a091b8419e3fb01f8104a2891753d
  • Loading branch information
yuandagits authored and facebook-github-bot committed Feb 6, 2025
1 parent 1e45534 commit 4f946c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 0 additions & 3 deletions velox/serializers/PrestoSerializerSerializationUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,9 +810,6 @@ void serializeWrapped(
simd::transpose(indices, rows, innerRows);
numInner = numRows;
} else {
if (isIPPrefixType(vector->type())) {
return serializeIPPrefix(vector, rows, stream);
}
wrapped = &BaseVector::wrappedVectorShared(vector);
for (int32_t i = 0; i < rows.size(); ++i) {
if (mayHaveNulls && vector->isNullAt(rows[i])) {
Expand Down
8 changes: 6 additions & 2 deletions velox/serializers/tests/PrestoSerializerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1207,9 +1207,13 @@ TEST_P(PrestoSerializerTest, ipprefix) {

// Test that if the vector is wrapped, we can still properly
// deserialize the ipprefix type
auto oneIndex = makeIndices(100, [](auto) { return 0; });
auto oneIndex = makeIndices(100, [](auto row) { return row; });
auto wrappedVector = makeRowVector({
BaseVector::wrapInDictionary(nullptr, oneIndex, 100, vector),
BaseVector::wrapInDictionary(
makeNulls(100, [](auto row) { return row % 2 == 0; }),
oneIndex,
100,
vector),
});
testRoundTrip(wrappedVector);
}
Expand Down

0 comments on commit 4f946c7

Please sign in to comment.