ClickHouse/dbms/Storages/tests/part_name.cpp

22 lines
594 B
C++
Raw Normal View History

#include <IO/ReadHelpers.h>
#include <Storages/MergeTree/MergeTreePartInfo.h>
#include <common/LocalDateTime.h>
2014-11-05 20:55:33 +00:00
2017-12-02 02:47:12 +00:00
int main(int, char **)
2014-11-05 20:55:33 +00:00
{
DayNum today = DateLUT::instance().toDayNum(time(nullptr));
2014-11-05 20:55:33 +00:00
for (DayNum date = today; DayNum(date + 10) > today; --date)
{
DB::MergeTreePartInfo part_info("partition", 0, 0, 0);
std::string name = part_info.getPartNameV0(date, date);
std::cerr << name << '\n';
2014-11-05 20:55:33 +00:00
time_t time = DateLUT::instance().YYYYMMDDToDate(DB::parse<UInt32>(name));
std::cerr << LocalDateTime(time) << '\n';
}
2014-11-05 20:55:33 +00:00
return 0;
2014-11-05 20:55:33 +00:00
}