diff --git a/src/Processors/Merges/Algorithms/GraphiteRollupSortedAlgorithm.cpp b/src/Processors/Merges/Algorithms/GraphiteRollupSortedAlgorithm.cpp index fcee47adcf8..7795292f922 100644 --- a/src/Processors/Merges/Algorithms/GraphiteRollupSortedAlgorithm.cpp +++ b/src/Processors/Merges/Algorithms/GraphiteRollupSortedAlgorithm.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include @@ -148,7 +149,10 @@ static time_t roundTimeToPrecision(const DateLUTImpl & date_lut, time_t time, UI IMergingAlgorithm::Status GraphiteRollupSortedAlgorithm::merge() { - const DateLUTImpl & date_lut = dynamic_cast(*columns_definition.time_column_type).getTimeZone(); + /// Timestamp column can be DateTime or UInt32. If it is DateTime, we can use its timezone for calculations. + const TimezoneMixin * timezone = dynamic_cast(columns_definition.time_column_type.get()); + + const DateLUTImpl & date_lut = timezone ? timezone->getTimeZone() : DateLUT::instance(); /// Take rows in needed order and put them into `merged_data` until we get `max_block_size` rows. ///