```
SELECT (toDate(number % 1024) AS base) + toIntervalMonth(number) AS d, toDateTime(d) AS t, toQuarter(d) AS qd, toQuarter(t) AS qt, arrayJoin([65537, NULL, NULL, 255, NULL]), toStartOfQuarter(d) AS sqd, toStartOfQuarter(t) AS sqt, NULL, toRelativeQuarterNum(d) - toRelativeQuarterNum(base) AS qdiff_d, toRelativeQuarterNum(t) - toRelativeQuarterNum(base) AS qdiff_t FROM system.numbers LIMIT 1048577



==75==WARNING: MemorySanitizer: use-of-uninitialized-value
2021.01.22 00:10:30.189774 [ 124 ] {} <Debug> AsynchronousMetrics: MemoryTracking: was 5.85 GiB, peak 6.91 GiB, will set to 6.27 GiB (RSS), difference: 427.34 MiB
    #0 0x2042935c in DateLUTImpl::addMonths(StrongTypedef<unsigned short, DayNumTag>, long) const (/workspace/clickhouse+0x2042935c)
    #1 0x2042ab4d in void DB::Adder<DB::AddMonthsImpl>::vectorVector<DB::PODArray<unsigned short, 4096ul, Allocator<false, false>, 15ul, 16ul>, DB::PODArray<unsigned short, 4096ul, Allocator<false, false>, 15ul, 16ul>, DB::ColumnVector<long> >(DB::PODArray<unsigned short, 4096ul, Allocator<false, false>, 15ul, 16ul> const&, DB::PODArray<unsigned short, 4096ul, Allocator<false, false>, 15ul, 16ul>&, DB::ColumnVector<long> const&, DateLUTImpl const&, unsigned long) const (/workspace/clickhouse+0x2042ab4d)
    #2 0x20427b0c in void DB::Adder<DB::AddMonthsImpl>::vectorVector<DB::PODArray<unsigned short, 4096ul, Allocator<false, false>, 15ul, 16ul>, DB::PODArray<unsigned short, 4096ul, Allocator<false, false>, 15ul, 16ul> >(DB::PODArray<unsigned short, 4096ul, Allocator<false, false>, 15ul, 16ul> const&, DB::PODArray<unsigned short, 4096ul, Allocator<false, false>, 15ul, 16ul>&, DB::IColumn const&, DateLUTImpl const&) const (/workspace/clickhouse+0x20427b0c)
    #3 0x204242ee in DB::DateTimeAddIntervalImpl<DB::DataTypeDate, DB::DataTypeDate, DB::AddMonthsImpl>::execute(DB::AddMonthsImpl, std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&) (/workspace/clickhouse+0x204242ee)
    #4 0x20420ff9 in DB::FunctionDateOrDateTimeAddInterval<DB::AddMonthsImpl>::executeImpl(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long) const (/workspace/clickhouse+0x20420ff9)
    #5 0x1218de5c in DB::DefaultExecutable::execute(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long) const (/workspace/clickhouse+0x1218de5c)
    #6 0x123067de in DB::ExecutableFunctionAdaptor::executeWithoutLowCardinalityColumns(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const (/workspace/clickhouse+0x123067de)
    #7 0x12308953 in DB::ExecutableFunctionAdaptor::execute(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const (/workspace/clickhouse+0x12308953)
    #8 0x1232eaf3 in DB::IFunctionBase::execute(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const (/workspace/clickhouse+0x1232eaf3)
    #9 0x15a1d821 in DB::FunctionBinaryArithmetic<DB::PlusImpl, DB::NamePlus, true>::executeDateTimeIntervalPlusMinus(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, std::__1::shared_ptr<DB::IFunctionOverloadResolver> const&) const (/workspace/clickhouse+0x15a1d821)
    #10 0x15a1a957 in DB::FunctionBinaryArithmetic<DB::PlusImpl, DB::NamePlus, true>::executeImpl(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long) const (/workspace/clickhouse+0x15a1a957)
    #11 0x1218de5c in DB::DefaultExecutable::execute(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long) const (/workspace/clickhouse+0x1218de5c)
    #12 0x123067de in DB::ExecutableFunctionAdaptor::executeWithoutLowCardinalityColumns(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const (/workspace/clickhouse+0x123067de)
    #13 0x12308953 in DB::ExecutableFunctionAdaptor::execute(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const (/workspace/clickhouse+0x12308953)
    #14 0x2c320796 in DB::executeAction(DB::ExpressionActions::Action const&, DB::(anonymous namespace)::ExecutionContext&, bool) obj-x86_64-linux-gnu/../src/Interpreters/ExpressionActions.cpp:333:56
    #15 0x2c320796 in DB::ExpressionActions::execute(DB::Block&, unsigned long&, bool) const obj-x86_64-linux-gnu/../src/Interpreters/ExpressionActions.cpp:449:13
    #16 0x30664319 in DB::ExpressionTransform::transform(DB::Chunk&) obj-x86_64-linux-gnu/../src/Processors/Transforms/ExpressionTransform.cpp:25:17
2021.01.22 00:10:31.104031 [ 93 ] {} <Trace> SystemLog (system.query_thread_log): Flushing system log, 139 entries to flush
    #17 0x2eca8656 in DB::ISimpleTransform::transform(DB::Chunk&, DB::Chunk&) obj-x86_64-linux-gnu/../src/Processors/ISimpleTransform.h:42:9
2021.01.22 00:10:31.115189 [ 93 ] {} <Debug> DiskLocal: Reserving 1.00 MiB on disk `default`, having unreserved 1.04 TiB.
    #18 0x300f280e in DB::ISimpleTransform::work() obj-x86_64-linux-gnu/../src/Processors/ISimpleTransform.cpp:89:9
2021.01.22 00:10:31.127293 [ 93 ] {} <Trace> system.query_thread_log (507277e5-eb51-482d-ba7a-f4f50ab655e4): Renaming temporary part tmp_insert_202101_194_194_0 to 202101_194_194_0.
    #19 0x30209c28 in DB::executeJob(DB::IProcessor*) obj-x86_64-linux-gnu/../src/Processors/Executors/PipelineExecutor.cpp:79:20
    #20 0x30209c28 in DB::PipelineExecutor::addJob(DB::ExecutingGraph::Node*)::$_0::operator()() const obj-x86_64-linux-gnu/../src/Processors/Executors/PipelineExecutor.cpp:96:13
    #21 0x30209c28 in decltype(std::__1::forward<DB::PipelineExecutor::addJob(DB::ExecutingGraph::Node*)::$_0&>(fp)()) std::__1::__invoke<DB::PipelineExecutor::addJob(DB::ExecutingGraph::Node*)::$_0&>(DB::PipelineExecutor::addJob(DB::ExecutingGraph::Node*)::$_0&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3676:1
    #22 0x30209c28 in void std::__1::__invoke_void_return_wrapper<void>::__call<DB::PipelineExecutor::addJob(DB::ExecutingGraph::Node*)::$_0&>(DB::PipelineExecutor::addJob(DB::ExecutingGraph::Node*)::$_0&) obj-x86_64-linux-gnu/../contrib/libcxx/include/__functional_base:348:9
    #23 0x30209c28 in std::__1::__function::__default_alloc_func<DB::PipelineExecutor::addJob(DB::ExecutingGraph::Node*)::$_0, void ()>::operator()() obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:1608:12
    #24 0x30209c28 in void std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<DB::PipelineExecutor::addJob(DB::ExecutingGraph::Node*)::$_0, void ()> >(std::__1::__function::__policy_storage const*) obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2089:16
    #25 0x30202798 in std::__1::__function::__policy_func<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2221:16
    #26 0x30202798 in std::__1::function<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2560:12
    #27 0x30202798 in DB::PipelineExecutor::executeStepImpl(unsigned long, unsigned long, std::__1::atomic<bool>*) obj-x86_64-linux-gnu/../src/Processors/Executors/PipelineExecutor.cpp:580:17
    #28 0x301fbfbb in DB::PipelineExecutor::executeSingleThread(unsigned long, unsigned long) obj-x86_64-linux-gnu/../src/Processors/Executors/PipelineExecutor.cpp:473:5
    #29 0x301fbfbb in DB::PipelineExecutor::executeImpl(unsigned long) obj-x86_64-linux-gnu/../src/Processors/Executors/PipelineExecutor.cpp:807:9
    #30 0x301fa389 in DB::PipelineExecutor::execute(unsigned long) obj-x86_64-linux-gnu/../src/Processors/Executors/PipelineExecutor.cpp:395:9
2021.01.22 00:10:31.128865 [ 93 ] {} <Trace> SystemLog (system.query_thread_log): Flushed system log
    #31 0x30239707 in DB::threadFunction(DB::PullingAsyncPipelineExecutor::Data&, std::__1::shared_ptr<DB::ThreadGroupStatus>, unsigned long) obj-x86_64-linux-gnu/../src/Processors/Executors/PullingAsyncPipelineExecutor.cpp:79:24
    #32 0x30239707 in DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0::operator()() const obj-x86_64-linux-gnu/../src/Processors/Executors/PullingAsyncPipelineExecutor.cpp:101:13
    #33 0x30239707 in decltype(std::__1::forward<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&>(fp)()) std::__1::__invoke_constexpr<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3682:1
    #34 0x30239707 in decltype(auto) std::__1::__apply_tuple_impl<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&, std::__1::tuple<>&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&, std::__1::tuple<>&, std::__1::__tuple_indices<>) obj-x86_64-linux-gnu/../contrib/libcxx/include/tuple:1415:1
    #35 0x30239707 in decltype(auto) std::__1::apply<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&, std::__1::tuple<>&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&, std::__1::tuple<>&) obj-x86_64-linux-gnu/../contrib/libcxx/include/tuple:1424:1
    #36 0x30239707 in ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'()::operator()() obj-x86_64-linux-gnu/../src/Common/ThreadPool.h:178:13
    #37 0x30239707 in decltype(std::__1::forward<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(fp)()) std::__1::__invoke<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'()&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3676:1
    #38 0x30239707 in void std::__1::__invoke_void_return_wrapper<void>::__call<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'()&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&...) obj-x86_64-linux-gnu/../contrib/libcxx/include/__functional_base:348:9
    #39 0x30239707 in std::__1::__function::__default_alloc_func<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'(), void ()>::operator()() obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:1608:12
    #40 0x30239707 in void std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'(), void ()> >(std::__1::__function::__policy_storage const*) obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2089:16
    #41 0x8e84ac6 in std::__1::__function::__policy_func<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2221:16
    #42 0x8e84ac6 in std::__1::function<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2560:12
    #43 0x8e84ac6 in ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:247:17
    #44 0x8e93147 in void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda1'()::operator()() const obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:124:73
    #45 0x8e93147 in decltype(std::__1::forward<void>(fp)(std::__1::forward<void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda1'()>(fp0)...)) std::__1::__invoke<void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda1'()>(void&&, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda1'()&&...) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3676:1
    #46 0x8e93147 in void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda1'()>(std::__1::tuple<void, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda1'()>&, std::__1::__tuple_indices<>) obj-x86_64-linux-gnu/../contrib/libcxx/include/thread:280:5
    #47 0x8e93147 in void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda1'()> >(void*) obj-x86_64-linux-gnu/../contrib/libcxx/include/thread:291:5
    #48 0x7fc751149608 in start_thread /build/glibc-ZN95T4/glibc-2.31/nptl/pthread_create.c:477:8
2021.01.22 00:10:31.141948 [ 151 ] {} <Trace> system.text_log (b8497000-33d9-41b9-ac94-fb118fa3defc): Found 2 old parts to remove.
2021.01.22 00:10:31.142114 [ 151 ] {} <Debug> system.text_log (b8497000-33d9-41b9-ac94-fb118fa3defc): Removing part from filesystem 202101_92_142_33
2021.01.22 00:10:31.143288 [ 151 ] {} <Debug> system.text_log (b8497000-33d9-41b9-ac94-fb118fa3defc): Removing part from filesystem 202101_143_143_0
    #49 0x7fc751070292 in clone /build/glibc-ZN95T4/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

  Uninitialized value was created by a heap allocation
    #0 0x8d30f59 in operator new(unsigned long) (/workspace/clickhouse+0x8d30f59)
    #1 0x3a3b8994 in std::__1::__unique_if<DateLUTImpl>::__unique_single std::__1::make_unique<DateLUTImpl, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2068:28
    #2 0x3a3b8994 in DateLUT::getImplementation(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const obj-x86_64-linux-gnu/../base/common/DateLUT.cpp:155:22
    #3 0x3a3b715c in DateLUT::DateLUT() obj-x86_64-linux-gnu/../base/common/DateLUT.cpp:145:25
    #4 0x3a3b8f38 in DateLUT::getInstance() obj-x86_64-linux-gnu/../base/common/DateLUT.cpp:162:20
    #5 0x9446001 in DateLUT::instance() obj-x86_64-linux-gnu/../base/daemon/../common/DateLUT.h:22:33
    #6 0x9446001 in BaseDaemon::setupWatchdog() obj-x86_64-linux-gnu/../base/daemon/BaseDaemon.cpp:915:5
    #7 0x9442fbc in BaseDaemon::initialize(Poco::Util::Application&) obj-x86_64-linux-gnu/../base/daemon/BaseDaemon.cpp:684:9
    #8 0x8d3e8f2 in DB::Server::initialize(Poco::Util::Application&) obj-x86_64-linux-gnu/../programs/server/Server.cpp:330:17
    #9 0x3a59a758 in Poco::Util::Application::run() obj-x86_64-linux-gnu/../contrib/poco/Util/src/Application.cpp:329:2
    #10 0x8d3e6df in DB::Server::run() obj-x86_64-linux-gnu/../programs/server/Server.cpp:325:25
    #11 0x3a5f8997 in Poco::Util::ServerApplication::run(int, char**) obj-x86_64-linux-gnu/../contrib/poco/Util/src/ServerApplication.cpp:611:9
    #12 0x8d3a3ea in mainEntryClickHouseServer(int, char**) obj-x86_64-linux-gnu/../programs/server/Server.cpp:117:20
    #13 0x8d34dd3 in main obj-x86_64-linux-gnu/../programs/main.cpp:368:12
    #14 0x7fc750f750b2 in __libc_start_main /build/glibc-ZN95T4/glibc-2.31/csu/../csu/libc-start.c:308:16

SUMMARY: MemorySanitizer: use-of-uninitialized-value (/workspace/clickhouse+0x2042935c) in DateLUTImpl::addMonths(StrongTypedef<unsigned short, DayNumTag>, long) const
Exiting
2021.01.22 00:10:31.207355 [ 76 ] {} <Trace> BaseDaemon: Received signal -3
2021.01.22 00:10:31.207778 [ 164 ] {} <Fatal> BaseDaemon: ########################################
2021.01.22 00:10:31.208191 [ 164 ] {} <Fatal> BaseDaemon: (version 21.2.1.5755, build id: F1A4445C24A6E92131892AF512612B8E9929650E) (from thread 160) (query_id: d407de76-cf24-4783-80c3-e7aeb1183911) Received signal Unknown signal (-3)
2021.01.22 00:10:31.208406 [ 164 ] {} <Fatal> BaseDaemon: Sanitizer trap.
2021.01.22 00:10:31.208650 [ 164 ] {} <Fatal> BaseDaemon: Stack trace: 0x8e335d9 0x944ebcc 0x8d20e76 0x8cb76c3 0x2042935d 0x2042ab4e 0x20427b0d 0x204242ef 0x20420ffa 0x1218de5d 0x123067df 0x12308954 0x1232eaf4 0x15a1d822 0x15a1a958 0x1218de5d 0x123067df 0x12308954 0x2c320797 0x3066431a 0x2eca8657 0x300f280f 0x30209c29 0x30202799 0x301fbfbc 0x301fa38a 0x30239708 0x8e84ac7 0x8e93148 0x7fc751149609 0x7fc751070293
2021.01.22 00:10:31.209174 [ 164 ] {} <Fatal> BaseDaemon: 0. ./obj-x86_64-linux-gnu/../src/Common/StackTrace.cpp:293: StackTrace::StackTrace() @ 0x8e335d9 in /workspace/clickhouse
2021.01.22 00:10:31.210266 [ 164 ] {} <Fatal> BaseDaemon: 1. ./obj-x86_64-linux-gnu/../src/Common/CurrentThread.h:81: sanitizerDeathCallback() @ 0x944ebcc in /workspace/clickhouse
2021.01.22 00:10:31.214559 [ 164 ] {} <Fatal> BaseDaemon: 2. __sanitizer::Die() @ 0x8d20e76 in /workspace/clickhouse
2021.01.22 00:10:31.218654 [ 164 ] {} <Fatal> BaseDaemon: 3. ? @ 0x8cb76c3 in /workspace/clickhouse
2021.01.22 00:10:31.222694 [ 164 ] {} <Fatal> BaseDaemon: 4. DateLUTImpl::addMonths(StrongTypedef<unsigned short, DayNumTag>, long) const @ 0x2042935d in /workspace/clickhouse
2021.01.22 00:10:31.226809 [ 164 ] {} <Fatal> BaseDaemon: 5. void DB::Adder<DB::AddMonthsImpl>::vectorVector<DB::PODArray<unsigned short, 4096ul, Allocator<false, false>, 15ul, 16ul>, DB::PODArray<unsigned short, 4096ul, Allocator<false, false>, 15ul, 16ul>, DB::ColumnVector<long> >(DB::PODArray<unsigned short, 4096ul, Allocator<false, false>, 15ul, 16ul> const&, DB::PODArray<unsigned short, 4096ul, Allocator<false, false>, 15ul, 16ul>&, DB::ColumnVector<long> const&, DateLUTImpl const&, unsigned long) const @ 0x2042ab4e in /workspace/clickhouse
2021.01.22 00:10:31.230890 [ 164 ] {} <Fatal> BaseDaemon: 6. void DB::Adder<DB::AddMonthsImpl>::vectorVector<DB::PODArray<unsigned short, 4096ul, Allocator<false, false>, 15ul, 16ul>, DB::PODArray<unsigned short, 4096ul, Allocator<false, false>, 15ul, 16ul> >(DB::PODArray<unsigned short, 4096ul, Allocator<false, false>, 15ul, 16ul> const&, DB::PODArray<unsigned short, 4096ul, Allocator<false, false>, 15ul, 16ul>&, DB::IColumn const&, DateLUTImpl const&) const @ 0x20427b0d in /workspace/clickhouse
2021.01.22 00:10:31.234976 [ 164 ] {} <Fatal> BaseDaemon: 7. DB::DateTimeAddIntervalImpl<DB::DataTypeDate, DB::DataTypeDate, DB::AddMonthsImpl>::execute(DB::AddMonthsImpl, std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&) @ 0x204242ef in /workspace/clickhouse
2021.01.22 00:10:31.239023 [ 164 ] {} <Fatal> BaseDaemon: 8. DB::FunctionDateOrDateTimeAddInterval<DB::AddMonthsImpl>::executeImpl(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long) const @ 0x20420ffa in /workspace/clickhouse
2021.01.22 00:10:31.243204 [ 164 ] {} <Fatal> BaseDaemon: 9. DB::DefaultExecutable::execute(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long) const @ 0x1218de5d in /workspace/clickhouse
2021.01.22 00:10:31.247175 [ 164 ] {} <Fatal> BaseDaemon: 10. DB::ExecutableFunctionAdaptor::executeWithoutLowCardinalityColumns(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const @ 0x123067df in /workspace/clickhouse
2021.01.22 00:10:31.251310 [ 164 ] {} <Fatal> BaseDaemon: 11. DB::ExecutableFunctionAdaptor::execute(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const @ 0x12308954 in /workspace/clickhouse
2021.01.22 00:10:31.255293 [ 164 ] {} <Fatal> BaseDaemon: 12. DB::IFunctionBase::execute(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const @ 0x1232eaf4 in /workspace/clickhouse
2021.01.22 00:10:31.259321 [ 164 ] {} <Fatal> BaseDaemon: 13. DB::FunctionBinaryArithmetic<DB::PlusImpl, DB::NamePlus, true>::executeDateTimeIntervalPlusMinus(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, std::__1::shared_ptr<DB::IFunctionOverloadResolver> const&) const @ 0x15a1d822 in /workspace/clickhouse
2021.01.22 00:10:31.263314 [ 164 ] {} <Fatal> BaseDaemon: 14. DB::FunctionBinaryArithmetic<DB::PlusImpl, DB::NamePlus, true>::executeImpl(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long) const @ 0x15a1a958 in /workspace/clickhouse
2021.01.22 00:10:31.267300 [ 164 ] {} <Fatal> BaseDaemon: 15. DB::DefaultExecutable::execute(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long) const @ 0x1218de5d in /workspace/clickhouse
2021.01.22 00:10:31.271164 [ 164 ] {} <Fatal> BaseDaemon: 16. DB::ExecutableFunctionAdaptor::executeWithoutLowCardinalityColumns(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const @ 0x123067df in /workspace/clickhouse
2021.01.22 00:10:31.275049 [ 164 ] {} <Fatal> BaseDaemon: 17. DB::ExecutableFunctionAdaptor::execute(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const @ 0x12308954 in /workspace/clickhouse
2021.01.22 00:10:31.277791 [ 164 ] {} <Fatal> BaseDaemon: 18. ./obj-x86_64-linux-gnu/../src/Interpreters/ExpressionActions.cpp:0: DB::ExpressionActions::execute(DB::Block&, unsigned long&, bool) const @ 0x2c320797 in /workspace/clickhouse
2021.01.22 00:10:31.280690 [ 164 ] {} <Fatal> BaseDaemon: 19. ./obj-x86_64-linux-gnu/../src/Processors/Transforms/ExpressionTransform.cpp:27: DB::ExpressionTransform::transform(DB::Chunk&) @ 0x3066431a in /workspace/clickhouse
2021.01.22 00:10:31.289856 [ 164 ] {} <Fatal> BaseDaemon: 20. ./obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3933: DB::ISimpleTransform::transform(DB::Chunk&, DB::Chunk&) @ 0x2eca8657 in /workspace/clickhouse
2021.01.22 00:10:31.293343 [ 164 ] {} <Fatal> BaseDaemon: 21. ./obj-x86_64-linux-gnu/../src/Processors/ISimpleTransform.cpp:99: DB::ISimpleTransform::work() @ 0x300f280f in /workspace/clickhouse
2021.01.22 00:10:31.297418 [ 164 ] {} <Fatal> BaseDaemon: 22. ./obj-x86_64-linux-gnu/../src/Processors/Executors/PipelineExecutor.cpp:99: void std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<DB::PipelineExecutor::addJob(DB::ExecutingGraph::Node*)::$_0, void ()> >(std::__1::__function::__policy_storage const*) @ 0x30209c29 in /workspace/clickhouse
2021.01.22 00:10:31.301110 [ 164 ] {} <Fatal> BaseDaemon: 23. ./obj-x86_64-linux-gnu/../src/Processors/Executors/PipelineExecutor.cpp:587: DB::PipelineExecutor::executeStepImpl(unsigned long, unsigned long, std::__1::atomic<bool>*) @ 0x30202799 in /workspace/clickhouse
2021.01.22 00:10:31.304646 [ 164 ] {} <Fatal> BaseDaemon: 24. ./obj-x86_64-linux-gnu/../src/Processors/Executors/PipelineExecutor.cpp:0: DB::PipelineExecutor::executeImpl(unsigned long) @ 0x301fbfbc in /workspace/clickhouse
2021.01.22 00:10:31.306845 [ 97 ] {} <Debug> DiskLocal: Reserving 1.80 MiB on disk `default`, having unreserved 1.04 TiB.
2021.01.22 00:10:31.308060 [ 164 ] {} <Fatal> BaseDaemon: 25. ./obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:1627: DB::PipelineExecutor::execute(unsigned long) @ 0x301fa38a in /workspace/clickhouse
2021.01.22 00:10:31.311478 [ 164 ] {} <Fatal> BaseDaemon: 26. ./obj-x86_64-linux-gnu/../base/common/../ext/scope_guard.h:97: void std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'(), void ()> >(std::__1::__function::__policy_storage const*) @ 0x30239708 in /workspace/clickhouse
2021.01.22 00:10:31.311896 [ 164 ] {} <Fatal> BaseDaemon: 27. ./obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2210: ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0x8e84ac7 in /workspace/clickhouse
2021.01.22 00:10:31.312884 [ 164 ] {} <Fatal> BaseDaemon: 28. ./obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:1655: void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda1'()> >(void*) @ 0x8e93148 in /workspace/clickhouse
2021.01.22 00:10:31.313029 [ 164 ] {} <Fatal> BaseDaemon: 29. start_thread @ 0x9609 in /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
2021.01.22 00:10:31.313148 [ 164 ] {} <Fatal> BaseDaemon: 30. __clone @ 0x122293 in /usr/lib/x86_64-linux-gnu/libc-2.31.so
```
{
        return fromDayNum(toFirstDayNumOfQuarter(t));
    }
    
    inline time_t toFirstDayOfYear(time_t t) const
    {
        return lut[years_lut[lut[findIndex(t)].year - DATE_LUT_MIN_YEAR]].date;
    }
    inline DayNum toFirstDayNumOfYear(DayNum d) const
    {
        return years_lut[lut[d].year - DATE_LUT_MIN_YEAR];
    }
    inline DayNum toFirstDayNumOfYear(time_t t) const
    {
        return toFirstDayNumOfYear(toDayNum(t));
    }
    inline time_t toFirstDayOfNextMonth(time_t t) const
    {
        DayNum index = findIndex(t);
        index += 32 - lut[index].day_of_month;
        return lut[index - (lut[index].day_of_month - 1)].date;
    }
    inline time_t toFirstDayOfPrevMonth(time_t t) const
    {
        DayNum index = findIndex(t);
        index -= lut[index].day_of_month;
        return lut[index - (lut[index].day_of_month - 1)].date;
    }
    inline UInt8 daysInMonth(DayNum d) const