-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FieldFilter variables mapped to DateTime datatype don't show results correctly #229
Comments
Could you share these? What is the driver version? OS? What is the timezone configuration (OS, CH, JVM/Metabase)? |
Yeah, i forgot to put this information there, sorry. Accidentally ctrl-enter before finished whole report .-. |
No worries. Thank you for the detailed report (emoji navigation is the next level). |
Added environment info. So yeah 1.4.0 is working perfectly fine, i was wondering is there any chance to implement this to other Filter Widgets? |
I found that it could be made like this, but i have no idea how it will affect performance:
|
OK, I see that 1.4.0 is affected. I will have a look when I am back from vacation next week. |
@slvrtrn Just double checking on this one, hit the same issue as reported, where the filters basically exclude the start/end days of the intervals (so for example a last 7 days relative range filter will return the data only for 5 days). |
I tried to reproduce it with MB 0.49.2, driver version 1.4.0, ClickHouse 24.3, and this dataset (6 rows per day, with different times: 00:00, 00:59, 01:00, 06:30, 18:45, 23:59:59; i.e. expected 42 rows per week or 7 days). I also tried both UTC and Europe/Moscow timezones in ClickHouse + MB + DateTime column. The results were correct with all filter variations in both time zones. I am pretty positive that this was fixed in #218 (similar report - #216). But if I am missing something, please let me know; I will double-check. Here are my results: (Single date) April 1st - all records for this date.(Relative date) Past 7 days - as expected, 42 dates.(Date Range with time) April 1st 12:30pm - April 2nd 12:30pm - filtered correctly.(Date Range default) April 1st 00:00 - April 2nd 23:59(Date filter) This week - 42 dates as expected.(Date filter) Today (2nd of April) - only 6 dates, correct results.(Date filter) Previous week - 42 dates as expected, March 25th - March 31st(Date filter) Previous 7 days - 42 dates as expected, March 25th - March 31stRegarding time zones setup: CH had either |
As i said earlier - it seems that #218 fixed some particular cases, but not the issue itself. driver version still 1.4.0:
ClickHouse to 24.3.2 version:
The issue itself that many filters using I used same dataset for this. Here are all examples for all filters:
It's very strange that we have different results, despite using identical versions of MD, Driver and CH. I'll try full clean install later to be sure that i missed nothing while updating to newer versions. And again apologies for my poor English - it's not my native language. I hope you could understand what i was writing about) Screenshots: Footnotes |
Thanks for the detailed answer :)
This is correct. This is mainly handled by Metabase itself via the common code; the only tweak for CH is this. Considering CAST calls, we had this issue: #196, which is why these were removed and that bit in the QP sources was introduced. Regarding the statements: If you run the queries in clickhouse-client (from CLI), are the results the same as those shown in Metabase? I suspect that this could be due to the disabled TZ switch (Related: #200, see the discussion); however, this shouldn't be the case since everything is in the same TZ on your configuration. Lastly, could you contact me in the community Slack? I think it might be easier/faster to debug that way. |
So i was wondering if it's possible to "map" Yeah i saw that some issues had been mentioned as fixed in the changelog for 1.3.0 version. If i run queries in CLI i have the same result. Also, i perform a clean install of MB, MB driver and CH - latest versions for all mentioned, and still got same results I don't think that this could be related to TZ issue, even if TZ would differ in my config - i believe TZ issue would show results which differ from expected for + or - 3 hours. ( If only +/-3 UTC is the only difference between configured timezones ) Unfortunately, Slack is restricted in my country and i can't join this community. Is it possible to communicate via different method/messenger? Telegram, perhaps? |
Feel free to contact me there. Same username. |
This should be resolved as of 1.5.1+. |
Describe the bug
Hello. I didn't knew how to lable it - bug or suggestion, but IMHO this looks like a bug.
I've discovered, that Field Filter doesn't work "correctly" if being mapped to
DateTime
datatype. All Filter Widget types for dates are affected, except one -Single Date
type.Steps to reproduce
We are checking result of the following query for
Date Filter
Filter Widget type:testing
.date_filter
.date_time
= toDate('2024-03-18')testing
.date_filter
.date_time
BETWEEN toDate('2024-03-12') AND toDate('2024-03-18')testing
.date_filter
.date_time
BETWEEN toDate('2024-03-11') AND toDate('2024-03-12')testing
.date_filter
.date_time
BETWEEN '2024-03-11 00:00:00.000' AND '2024-03-12 23:59:00.000'testing
.date_filter
.date_time
> toDate('2024-03-18')testing
.date_filter
.date_time
AS date) = toDate('2024-03-12')Following table will be all affected with same issue as above, so i'll just mention
Month and Year
testing
.date_filter
.date_time
BETWEEN toDate('2023-05-01') AND toDate('2023-05-31')Quater and Year
testing
.date_filter
.date_time
BETWEEN toDate('2023-07-01') AND toDate('2023-09-30')Data Range
without timetesting
.date_filter
.date_time
BETWEEN toDate('2024-03-18') AND toDate('2024-03-19')Data Range
with timetesting
.date_filter
.date_time
BETWEEN '2024-03-18 00:00:00.000' AND '2024-03-19 23:59:00.000'Data Range
single datetesting
.date_filter
.date_time
= toDate('2024-03-18')Date Filter
optionsAnd here is table for
Single Date
Filter Widget type:testing
.date_filter
.date_time
AS date) = toDate('2024-03-19')toStartOfMinute
(testing
.date_filter
.date_time
) = '2024-03-19 23:59:00.000'These works perfectly with
DateTime
datatype, and negate all "issues" mentioned above.Can we somehow implement same "methods" for other Filter Widgets?
Configuration
Environment
ClickHouse server
CREATE TABLE
statements for tables involved:CREATE TABLE date_filter
(
date_time
DateTime('Europe/Moscow'),)
ENGINE = TinyLog
This is example of DateTime records from the table - 5 records with different time for a day:
2023-03-25 00:00:00
2023-03-25 06:30:34
2023-03-25 12:00:00
2023-03-25 18:45:58
2023-03-25 23:59:59
2023-03-26 00:00:00
Where max value for date_time is 2024-03-19 23:59:59 and min value for date_time is 2023-03-25 00:00:00
Screenshots:
Footnotes
The text was updated successfully, but these errors were encountered: