timeSlots function starting time slot before start date.

18 views
Skip to first unread message

Amit Sharma

unread,
May 20, 2021, 12:50:00 AMMay 20
to ClickHouse
Hi, 
I am trying to use the timeSlots function in ClickHouse. 
Here is the query I am running - 


SELECT timeSlots(toDateTime('2021-01-01 00:00:00'), 2592000, 432000)




Query id: d75d0b9f-7acd-4ac5-9627-25c16a1ef8d5




┌─timeSlots(toDateTime('2021-01-01 00:00:00'), 2592000, 432000)───────────────────────────────────────────────────────────────────────────────────────────────┐

│ ['2020-12-29 00:00:00','2021-01-03 00:00:00','2021-01-08 00:00:00','2021-01-13 00:00:00','2021-01-18 00:00:00','2021-01-23 00:00:00','2021-01-28 00:00:00'] │

└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
based on the ClickHouse documentation the first time slot should start on the start day provided in the function but it is clearly not the case and timetimeslotsslots are starting 2 days in advance. What am I missing ?

Regards,
Amit

Denis Zhuravlev

unread,
May 20, 2021, 11:24:53 AMMay 20
to ClickHouse


SELECT arrayMap(i -> ((i * 432000) + toDateTime('2021-01-01 00:00:00')), range(7))

┌─arrayMap(lambda(tuple(i), plus(multiply(i, 432000), toDateTime('2021-01-01 00:00:00'))), range(7))──────────────────────────────────────────────────────────┐
│ ['2021-01-01 00:00:00','2021-01-06 00:00:00','2021-01-11 00:00:00','2021-01-16 00:00:00','2021-01-21 00:00:00','2021-01-26 00:00:00','2021-01-31 00:00:00'] │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Reply all
Reply to author
Forward
0 new messages