Skip to content

Commit 5948eb6

Browse files
committed
Add AppendRaw to ColumnDateTime
1 parent a162509 commit 5948eb6

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

clickhouse/columns/date.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ std::time_t ColumnDateTime::At(size_t n) const {
200200
return data_->At(n);
201201
}
202202

203+
void ColumnDateTime::AppendRaw(uint32_t value) {
204+
data_->Append(value);
205+
}
206+
203207
std::string ColumnDateTime::Timezone() const {
204208
return type_->As<DateTimeType>()->Timezone();
205209
}

clickhouse/columns/date.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ class ColumnDateTime : public Column {
150150
std::time_t At(size_t n) const;
151151
inline std::time_t operator [] (size_t n) const { return At(n); }
152152

153+
/// Append raw as UNIX epoch seconds in uint32
154+
void AppendRaw(uint32_t value);
155+
153156
/// Timezone associated with a data column.
154157
std::string Timezone() const;
155158

ut/columns_ut.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,8 @@ TEST(ColumnsCase, Date32Swap) {
421421
TEST(ColumnsCase, DateTimeSwap) {
422422
auto col = std::make_shared<ColumnDateTime>();
423423

424-
col->Append(1u);
425-
col->Append(1234u);
424+
col->AppendRaw(1u);
425+
col->AppendRaw(1234u);
426426

427427
ASSERT_EQ(col->Size(), 2u);
428428
ASSERT_EQ(col->At(0), 1u);

0 commit comments

Comments
 (0)