Skip to content

Commit

Permalink
Use nested namespce in "/vector" directory
Browse files Browse the repository at this point in the history
The Velox code specification requires to always use "nested namespace
definition", but I found that although most of the files in the
"/vector" directory are already used, there are still some files that
are not used. This patch fixes this problem.

No functional changes.
  • Loading branch information
lingbin committed Oct 3, 2024
1 parent f94aa6a commit 1f6a08e
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 80 deletions.
6 changes: 2 additions & 4 deletions velox/vector/BaseVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
#include "velox/vector/VectorEncoding.h"
#include "velox/vector/VectorUtil.h"

namespace facebook {
namespace velox {
namespace facebook::velox {

template <typename T>
class SimpleVector;
Expand Down Expand Up @@ -1006,8 +1005,7 @@ std::string printIndices(
const BufferPtr& indices,
vector_size_t maxIndicesToPrint = 10);

} // namespace velox
} // namespace facebook
} // namespace facebook::velox

namespace folly {

Expand Down
6 changes: 2 additions & 4 deletions velox/vector/BiasVector-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
#include "velox/vector/FlatVector.h"
#include "velox/vector/TypeAliases.h"

namespace facebook {
namespace velox {
namespace facebook::velox {

/*
* NOTE - biased vector is stored solely as a standard numeric flat array in
Expand Down Expand Up @@ -145,5 +144,4 @@ xsimd::batch<T> BiasVector<T>::loadSIMDValueBufferAt(size_t index) const {
}
}

} // namespace velox
} // namespace facebook
} // namespace facebook::velox
6 changes: 2 additions & 4 deletions velox/vector/BuilderTypeUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
// Miscellaneous utilities regarding type, to avoid duplication
// and improve readability in places that have to reason about types.

namespace facebook {
namespace velox {
namespace facebook::velox {

/**
* @return true iff the type T can be used in a biased vector
Expand Down Expand Up @@ -95,5 +94,4 @@ inline bool deltaAllowsBias<int16_t>(uint64_t delta) {
return delta <= std::numeric_limits<uint8_t>::max();
}

} // namespace velox
} // namespace facebook
} // namespace facebook::velox
6 changes: 2 additions & 4 deletions velox/vector/ComplexVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
#include "velox/vector/ComplexVector.h"
#include "velox/vector/SimpleVector.h"

namespace facebook {
namespace velox {
namespace facebook::velox {

// Up to # of elements to show as debug string for `toString()`.
constexpr vector_size_t kMaxElementsInToString = 5;
Expand Down Expand Up @@ -1715,5 +1714,4 @@ void RowVector::appendNulls(vector_size_t numberOfRows) {
bits::fillBits(mutableRawNulls(), oldSize, newSize, bits::kNull);
}

} // namespace velox
} // namespace facebook
} // namespace facebook::velox
6 changes: 2 additions & 4 deletions velox/vector/ConstantVector-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
* limitations under the License.
*/

namespace facebook {
namespace velox {
namespace facebook::velox {

template <typename T>
std::unique_ptr<SimpleVector<uint64_t>> ConstantVector<T>::hashAll() const {
Expand All @@ -29,5 +28,4 @@ std::unique_ptr<SimpleVector<uint64_t>> ConstantVector<T>::hashAll() const {
sizeof(uint64_t) * BaseVector::length_ /* representedBytes */);
}

} // namespace velox
} // namespace facebook
} // namespace facebook::velox
6 changes: 2 additions & 4 deletions velox/vector/ConstantVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

#include "velox/vector/ConstantVector.h"

namespace facebook {
namespace velox {
namespace facebook::velox {

template <>
void ConstantVector<StringView>::setValue(const std::string& string) {
Expand All @@ -42,5 +41,4 @@ void ConstantVector<ComplexType>::setValue(const std::string& /*string*/) {
"ConstantVectors of ComplexType cannot be initialized from string values.");
}

} // namespace velox
} // namespace facebook
} // namespace facebook::velox
6 changes: 2 additions & 4 deletions velox/vector/DictionaryVector-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
#include "velox/vector/FlatVector.h"
#include "velox/vector/TypeAliases.h"

namespace facebook {
namespace velox {
namespace facebook::velox {

template <typename T>
void DictionaryVector<T>::setInternalState() {
Expand Down Expand Up @@ -218,5 +217,4 @@ void DictionaryVector<T>::validate(const VectorValidateOptions& options) const {
dictionaryValues_->validate(options);
}

} // namespace velox
} // namespace facebook
} // namespace facebook::velox
6 changes: 2 additions & 4 deletions velox/vector/DictionaryVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
#include "velox/vector/SimpleVector.h"
#include "velox/vector/TypeAliases.h"

namespace facebook {
namespace velox {
namespace facebook::velox {

template <typename T>
class DictionaryVector : public SimpleVector<T> {
Expand Down Expand Up @@ -270,7 +269,6 @@ class DictionaryVector : public SimpleVector<T> {
template <typename T>
using DictionaryVectorPtr = std::shared_ptr<DictionaryVector<T>>;

} // namespace velox
} // namespace facebook
} // namespace facebook::velox

#include "velox/vector/DictionaryVector-inl.h"
7 changes: 3 additions & 4 deletions velox/vector/FlatVector-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
#include "velox/vector/DecodedVector.h"
#include "velox/vector/TypeAliases.h"

namespace facebook {
namespace velox {
namespace facebook::velox {

// Here are some common intel intrsic operations. Please refer to
// https://software.intel.com/sites/landingpage/IntrinsicsGuide for examples.
Expand Down Expand Up @@ -592,5 +591,5 @@ inline void FlatVector<bool>::resizeValues(
values_ = std::move(newValues);
rawValues_ = values_->asMutable<bool>();
}
} // namespace velox
} // namespace facebook

} // namespace facebook::velox
6 changes: 2 additions & 4 deletions velox/vector/FlatVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
#include "velox/vector/ConstantVector.h"
#include "velox/vector/TypeAliases.h"

namespace facebook {
namespace velox {
namespace facebook::velox {

template <>
const bool* FlatVector<bool>::rawValues() const {
Expand Down Expand Up @@ -373,5 +372,4 @@ void FlatVector<StringView>::validate(
}
}

} // namespace velox
} // namespace facebook
} // namespace facebook::velox
7 changes: 3 additions & 4 deletions velox/vector/SelectivityVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
#include "velox/common/base/Range.h"
#include "velox/vector/TypeAliases.h"

namespace facebook {
namespace velox {
namespace facebook::velox {

// A selectivityVector is used to logically filter / select data in place.
// The goal here is to be able to pass this vector between filter stages on
Expand Down Expand Up @@ -469,5 +468,5 @@ void translateToInnerRows(
const vector_size_t* indices,
const uint64_t* nulls,
SelectivityVector& innerRows);
} // namespace velox
} // namespace facebook

} // namespace facebook::velox
6 changes: 2 additions & 4 deletions velox/vector/SequenceVector-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

#include "velox/vector/BuilderTypeUtils.h"

namespace facebook {
namespace velox {
namespace facebook::velox {

template <typename T>
SequenceVector<T>::SequenceVector(
Expand Down Expand Up @@ -196,5 +195,4 @@ static inline vector_size_t offsetOfIndex(
return *lastIndex;
}

} // namespace velox
} // namespace facebook
} // namespace facebook::velox
6 changes: 2 additions & 4 deletions velox/vector/SequenceVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@

#include "velox/vector/SequenceVector.h"

namespace facebook {
namespace velox {
namespace facebook::velox {

template class SequenceVector<int32_t>;

} // namespace velox
} // namespace facebook
} // namespace facebook::velox
6 changes: 2 additions & 4 deletions velox/vector/SimpleVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
#include "velox/vector/BaseVector.h"
#include "velox/vector/TypeAliases.h"

namespace facebook {
namespace velox {
namespace facebook::velox {

namespace exec {
class EvalCtx;
Expand Down Expand Up @@ -538,5 +537,4 @@ inline uint64_t SimpleVector<ComplexType>::hashValueAt(
template <typename T>
using SimpleVectorPtr = std::shared_ptr<SimpleVector<T>>;

} // namespace velox
} // namespace facebook
} // namespace facebook::velox
6 changes: 2 additions & 4 deletions velox/vector/TypeAliases.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
#pragma once
#include <cstdint>

namespace facebook {
namespace velox {
namespace facebook::velox {

/**
* The reason for centralizing these types is to maintain consistency in the
Expand All @@ -34,5 +33,4 @@ using ByteCount = int32_t;
// involved in storage, and should not be changed.
using SequenceLength = uint32_t;

} // namespace velox
} // namespace facebook
} // namespace facebook::velox
6 changes: 2 additions & 4 deletions velox/vector/VectorTypeUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
#include "velox/type/Type.h"
#include "velox/vector/ComplexVector.h"

namespace facebook {
namespace velox {
namespace facebook::velox {

// Maps TypeKind to the corresponding writable vector.
template <TypeKind K>
Expand Down Expand Up @@ -84,5 +83,4 @@ struct TypeToFlatVector {
using type = typename KindToFlatVector<SimpleTypeTrait<T>::typeKind>::type;
};

} // namespace velox
} // namespace facebook
} // namespace facebook::velox
6 changes: 2 additions & 4 deletions velox/vector/VectorUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
#include "velox/common/base/Exceptions.h"
#include "velox/type/Type.h"

namespace facebook {
namespace velox {
namespace facebook::velox {

template <typename T>
static inline BufferPtr copyToBuffer(
Expand All @@ -45,5 +44,4 @@ static inline BufferPtr copyToBuffer(
return returnsNullptr ? nullptr : AlignedBuffer::allocate<Value>(0, pool);
}

} // namespace velox
} // namespace facebook
} // namespace facebook::velox
8 changes: 2 additions & 6 deletions velox/vector/benchmarks/SelectivityVectorBenchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
#include "velox/common/base/BitUtil.h"
#include "velox/vector/SelectivityVector.h"

namespace facebook {
namespace velox {
namespace test {
namespace facebook::velox::test {

// ctor Tests

Expand Down Expand Up @@ -300,9 +298,7 @@ BENCHMARK_PARAM(BM_operatorEquals, 1000000);
BENCHMARK_PARAM(BM_operatorEquals, 10000000);
BENCHMARK_DRAW_LINE();

} // namespace test
} // namespace velox
} // namespace facebook
} // namespace facebook::velox::test

// To run:
// buck run @mode/opt-clang-thinlto \
Expand Down
9 changes: 3 additions & 6 deletions velox/vector/tests/VectorUtilTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
#include "velox/buffer/Buffer.h"
#include "velox/vector/VectorUtil.h"

namespace facebook {
namespace velox {
namespace test {
namespace facebook::velox::test {

template <typename T>
class VectorUtilTest : public testing::Test {
Expand Down Expand Up @@ -85,6 +83,5 @@ TYPED_TEST(VectorUtilTest, copyToBufferWithEmptyVector) {
TYPED_TEST(VectorUtilTest, copyToBufferWithEmptyVectorReturnsNullptr) {
this->runTestWithEmptyVectorAndReturnsNullptr();
}
} // namespace test
} // namespace velox
} // namespace facebook

} // namespace facebook::velox::test

0 comments on commit 1f6a08e

Please sign in to comment.