blob: 68cbe3d4e455f0e5f09ac5a2138b9d035759eacd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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>;
}
|