Error using date as a filter with clickhouse "java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2"

Hi everyone,
I'm trying to use a date as a filter and at the same time I'm comparing it to another date and it keeps giving me this error: java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2.

Btw i'm using clickhouse and a native question, as in the print bellow.

And this is my query:
SELECT COUNT(DISTINCT(people.id)) AS Total, dict_age_groups.title AS grupo FROM people JOIN dict_age_groups ON people.age_group_id = dict_age_groups.id LEFT JOIN plans ON people.plan_id = plans.id LEFT JOIN uses ON people.id = uses.person_id WHERE 1=1 [[AND people.customer_id in ({{customer_id_in}})]] [[AND people.customer_id not in ({{customer_id_notin}})]] [[AND people.company_id in ({{company_id_in}})]] [[AND people.company_id not in ({{company_id_notin}})]] [[AND plans.plan_name in ({{plan_name_in}})]] [[AND plans.plan_name not in ({{plan_name_notin}})]] [[AND people.age_group_id in ({{age_group_id}})]] [[AND toInt64(people.age) >= {{age_start}}]] [[AND toInt64(people.age) <= {{age_end}}]] [[AND {{is_active}}]] [[AND {{is_owner}}]] [[AND people.gender in {{gender}}]] [[AND {{use_date}}]] [[AND {{competency_date}}]] [[AND people.exclude_date >= Date({{use_date_start}}) or null]] [[AND people.include_date =< Date({{use_date_end}})]] GROUP BY grupo ORDER BY Total desc

The main problem is with this particular part of the code:
[[AND people.exclude_date >= Date({{use_date_start}}) or null]]
[[AND people.include_date =< Date({{use_date_end}})]]

Does someone knows how to solve this problem?

I've never used clickhouse, but is the "or null" part of the query ok?

Great point!

I've solved it with:
[[AND people.include_date <= {{use_date_start}}
AND (
people.exclude_date >= {{use_date_end}}
OR people.exclude_date is null
)
]]

Thanks Luiggi :slight_smile: