diff options
author | galaxycrab <UgnineSirdis@ydb.tech> | 2023-11-23 11:26:33 +0300 |
---|---|---|
committer | galaxycrab <UgnineSirdis@ydb.tech> | 2023-11-23 12:01:57 +0300 |
commit | 44354d0fc55926c1d4510d1d2c9c9f6a1a5e9300 (patch) | |
tree | cb4d75cd1c6dbc3da0ed927337fd8d1b6ed9da84 /library/cpp/clickhouse/client/columns/numeric.cpp | |
parent | 0e69bf615395fdd48ecee032faaec81bc468b0b8 (diff) | |
download | ydb-44354d0fc55926c1d4510d1d2c9c9f6a1a5e9300.tar.gz |
YQ Connector:test INNER JOIN
Diffstat (limited to 'library/cpp/clickhouse/client/columns/numeric.cpp')
-rw-r--r-- | library/cpp/clickhouse/client/columns/numeric.cpp | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/library/cpp/clickhouse/client/columns/numeric.cpp b/library/cpp/clickhouse/client/columns/numeric.cpp new file mode 100644 index 0000000000..68cbe3d4e4 --- /dev/null +++ b/library/cpp/clickhouse/client/columns/numeric.cpp @@ -0,0 +1,103 @@ +#include "numeric.h" + +#include "utils.h" + +namespace NClickHouse { + template <typename T> + TColumnVector<T>::TColumnVector() + : TColumn(TType::CreateSimple<T>()) + { + } + + template <typename T> + TColumnVector<T>::TColumnVector(const TVector<T>& data) + : TColumn(TType::CreateSimple<T>()) + , Data_(data) + { + } + + template <typename T> + TColumnVector<T>::TColumnVector(TVector<T>&& data) + : TColumn(TType::CreateSimple<T>()) + , Data_(std::move(data)) + { + } + + template <typename T> + TIntrusivePtr<TColumnVector<T>> TColumnVector<T>::Create() { + return new TColumnVector<T>(); + } + + template <typename T> + TIntrusivePtr<TColumnVector<T>> TColumnVector<T>::Create(const TVector<T>& data) { + return new TColumnVector<T>(data); + } + + template <typename T> + TIntrusivePtr<TColumnVector<T>> TColumnVector<T>::Create(TVector<T>&& data) { + return new TColumnVector<T>(std::move(data)); + } + + template <typename T> + void TColumnVector<T>::Append(const T& value) { + Data_.push_back(value); + } + + template <typename T> + const T& TColumnVector<T>::At(size_t n) const { + return Data_.at(n); + } + + template <typename T> + const T& TColumnVector<T>::operator[](size_t n) const { + return Data_[n]; + } + + template <typename T> + void TColumnVector<T>::SetAt(size_t n, const T& value) { + Data_.at(n) = value; + } + + template <typename T> + void TColumnVector<T>::Append(TColumnRef column) { + if (auto col = column->As<TColumnVector<T>>()) { + Data_.insert(Data_.end(), col->Data_.begin(), col->Data_.end()); + } + } + + template <typename T> + bool TColumnVector<T>::Load(TCodedInputStream* input, size_t rows) { + Data_.resize(rows); + + return input->ReadRaw(Data_.data(), Data_.size() * sizeof(T)); + } + + template <typename T> + void TColumnVector<T>::Save(TCodedOutputStream* output) { + output->WriteRaw(Data_.data(), Data_.size() * sizeof(T)); + } + + template <typename T> + size_t TColumnVector<T>::Size() const { + return Data_.size(); + } + + template <typename T> + TColumnRef TColumnVector<T>::Slice(size_t begin, size_t len) { + return new TColumnVector<T>(SliceVector(Data_, begin, len)); + } + + template class TColumnVector<i8>; + template class TColumnVector<i16>; + template class TColumnVector<i32>; + template class TColumnVector<i64>; + + template class TColumnVector<ui8>; + template class TColumnVector<ui16>; + template class TColumnVector<ui32>; + template class TColumnVector<ui64>; + + template class TColumnVector<float>; + template class TColumnVector<double>; + +} |