Skip to content

Commit eda9628

Browse files
YiChengLee03facebook-github-bot
authored andcommitted
refactor: Rename copyPreserveEncodings to testingCopyPreserveEncodings (facebookincubator#13408)
Summary: Pull Request resolved: facebookincubator#13408 [T222142639] copyPreserveEncodings are only used in test file with the exception of facebook::velox::exec::Values::initialize. We also replaced the call in Values::initialize() as it was not called elsewhere in the codebase. Reviewed By: zacw7 Differential Revision: D75084110 fbshipit-source-id: 0c27776290f0716970055bce1991766668da634e
1 parent a7bacbe commit eda9628

14 files changed

+45
-45
lines changed

velox/exec/Values.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
#include "velox/exec/Values.h"
1717
#include "velox/common/testutil/TestValue.h"
18-
1918
using facebook::velox::common::testutil::TestValue;
2019

2120
namespace facebook::velox::exec {
@@ -47,7 +46,7 @@ void Values::initialize() {
4746
// being shared across threads. Note that the contract in ValuesNode is
4847
// that this should only be enabled for testing.
4948
values_.emplace_back(std::static_pointer_cast<RowVector>(
50-
vector->copyPreserveEncodings()));
49+
vector->testingCopyPreserveEncodings()));
5150
} else {
5251
values_.emplace_back(vector);
5352
}

velox/exec/tests/OrderByTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@ DEBUG_ONLY_TEST_F(OrderByTest, orderByWithLazyInput) {
13771377

13781378
std::vector<RowVectorPtr> lazyInputCopy;
13791379
lazyInputCopy.push_back(std::dynamic_pointer_cast<RowVector>(
1380-
nonLazyVector->copyPreserveEncodings()));
1380+
nonLazyVector->testingCopyPreserveEncodings()));
13811381
createDuckDbTable(lazyInputCopy);
13821382

13831383
std::atomic_bool nonReclaimableSectionEntered{false};

velox/vector/BaseVector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ class BaseVector {
543543

544544
/// This makes a deep copy of the Vector allocating new child Vectors and
545545
/// Buffers recursively. Unlike copy, this preserves encodings recursively.
546-
virtual VectorPtr copyPreserveEncodings(
546+
virtual VectorPtr testingCopyPreserveEncodings(
547547
velox::memory::MemoryPool* pool = nullptr) const = 0;
548548

549549
/// Construct a zero-copy slice of the vector with the indicated offset and

velox/vector/BiasVector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class BiasVector : public SimpleVector<T> {
163163
VELOX_NYI();
164164
}
165165

166-
VectorPtr copyPreserveEncodings(
166+
VectorPtr testingCopyPreserveEncodings(
167167
velox::memory::MemoryPool* pool = nullptr) const override {
168168
auto selfPool = pool ? pool : BaseVector::pool_;
169169
return std::make_shared<BiasVector<T>>(

velox/vector/ComplexVector.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,12 @@ class RowVector : public BaseVector {
164164
const BaseVector* source,
165165
const folly::Range<const CopyRange*>& ranges) override;
166166

167-
VectorPtr copyPreserveEncodings(
167+
VectorPtr testingCopyPreserveEncodings(
168168
velox::memory::MemoryPool* pool = nullptr) const override {
169169
std::vector<VectorPtr> copiedChildren(children_.size());
170170

171171
for (auto i = 0; i < children_.size(); ++i) {
172-
copiedChildren[i] = children_[i]->copyPreserveEncodings(pool);
172+
copiedChildren[i] = children_[i]->testingCopyPreserveEncodings(pool);
173173
}
174174

175175
auto selfPool = pool ? pool : pool_;
@@ -493,7 +493,7 @@ class ArrayVector : public ArrayVectorBase {
493493
const BaseVector* source,
494494
const folly::Range<const CopyRange*>& ranges) override;
495495

496-
VectorPtr copyPreserveEncodings(
496+
VectorPtr testingCopyPreserveEncodings(
497497
velox::memory::MemoryPool* pool = nullptr) const override {
498498
auto selfPool = pool ? pool : pool_;
499499
return std::make_shared<ArrayVector>(
@@ -503,7 +503,7 @@ class ArrayVector : public ArrayVectorBase {
503503
length_,
504504
AlignedBuffer::copy(selfPool, offsets_),
505505
AlignedBuffer::copy(selfPool, sizes_),
506-
elements_->copyPreserveEncodings(pool),
506+
elements_->testingCopyPreserveEncodings(pool),
507507
nullCount_);
508508
}
509509

@@ -636,7 +636,7 @@ class MapVector : public ArrayVectorBase {
636636
const BaseVector* source,
637637
const folly::Range<const CopyRange*>& ranges) override;
638638

639-
VectorPtr copyPreserveEncodings(
639+
VectorPtr testingCopyPreserveEncodings(
640640
velox::memory::MemoryPool* pool = nullptr) const override {
641641
auto selfPool = pool ? pool : pool_;
642642
return std::make_shared<MapVector>(
@@ -646,8 +646,8 @@ class MapVector : public ArrayVectorBase {
646646
length_,
647647
AlignedBuffer::copy(selfPool, offsets_),
648648
AlignedBuffer::copy(selfPool, sizes_),
649-
keys_->copyPreserveEncodings(pool),
650-
values_->copyPreserveEncodings(pool),
649+
keys_->testingCopyPreserveEncodings(pool),
650+
values_->testingCopyPreserveEncodings(pool),
651651
nullCount_,
652652
sortedKeys_);
653653
}

velox/vector/ConstantVector.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,15 +373,15 @@ class ConstantVector final : public SimpleVector<T> {
373373
}
374374
}
375375

376-
VectorPtr copyPreserveEncodings(
376+
VectorPtr testingCopyPreserveEncodings(
377377
velox::memory::MemoryPool* pool = nullptr) const override {
378378
auto selfPool = pool ? pool : BaseVector::pool_;
379379
if (valueVector_) {
380380
return std::make_shared<ConstantVector<T>>(
381381
selfPool,
382382
BaseVector::length_,
383383
index_,
384-
valueVector_->copyPreserveEncodings(pool),
384+
valueVector_->testingCopyPreserveEncodings(pool),
385385
SimpleVector<T>::stats_);
386386
}
387387

velox/vector/DictionaryVector.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,14 @@ class DictionaryVector : public SimpleVector<T> {
233233

234234
void validate(const VectorValidateOptions& options) const override;
235235

236-
VectorPtr copyPreserveEncodings(
236+
VectorPtr testingCopyPreserveEncodings(
237237
velox::memory::MemoryPool* pool = nullptr) const override {
238238
auto selfPool = pool ? pool : BaseVector::pool_;
239239
return std::make_shared<DictionaryVector<T>>(
240240
selfPool,
241241
AlignedBuffer::copy(selfPool, BaseVector::nulls_),
242242
BaseVector::length_,
243-
dictionaryValues_->copyPreserveEncodings(),
243+
dictionaryValues_->testingCopyPreserveEncodings(),
244244
AlignedBuffer::copy(selfPool, indices_),
245245
SimpleVector<T>::stats_,
246246
BaseVector::distinctValueCount_,

velox/vector/FlatVector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ void FlatVector<StringView>::copy(
322322
// need to perform a deep copy and reconstruct the string views against the
323323
// updated stringBuffers.
324324
template <>
325-
VectorPtr FlatVector<StringView>::copyPreserveEncodings(
325+
VectorPtr FlatVector<StringView>::testingCopyPreserveEncodings(
326326
velox::memory::MemoryPool* pool) const {
327327
const auto allocPool = pool ? pool : BaseVector::pool_;
328328
// If the backing memory pool is the same as the vector pool

velox/vector/FlatVector.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ class FlatVector final : public SimpleVector<T> {
271271
const BaseVector* source,
272272
const folly::Range<const BaseVector::CopyRange*>& ranges) override;
273273

274-
VectorPtr copyPreserveEncodings(
274+
VectorPtr testingCopyPreserveEncodings(
275275
velox::memory::MemoryPool* pool = nullptr) const override {
276276
const auto allocPool = pool ? pool : BaseVector::pool_;
277277
return std::make_shared<FlatVector<T>>(
@@ -652,7 +652,7 @@ template <>
652652
void FlatVector<StringView>::prepareForReuse();
653653

654654
template <>
655-
VectorPtr FlatVector<StringView>::copyPreserveEncodings(
655+
VectorPtr FlatVector<StringView>::testingCopyPreserveEncodings(
656656
velox::memory::MemoryPool* pool) const;
657657

658658
template <typename T>

velox/vector/FunctionVector.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,10 @@ class FunctionVector : public BaseVector {
196196
VELOX_NYI();
197197
}
198198

199-
VectorPtr copyPreserveEncodings(
199+
VectorPtr testingCopyPreserveEncodings(
200200
velox::memory::MemoryPool* /* pool */ = nullptr) const override {
201-
VELOX_UNSUPPORTED("copyPreserveEncodings not defined for FunctionVector");
201+
VELOX_UNSUPPORTED(
202+
"testingCopyPreserveEncodings not defined for FunctionVector");
202203
}
203204

204205
private:

0 commit comments

Comments
 (0)