Skip to content

Date range filter doesn't work for table partitioned by toWeek #24422

@amitsharma10

Description

@amitsharma10

(you don't have to strictly follow this form)

Describe the issue
Date filter not working when table is partitioned by week.

How to reproduce

  • Which ClickHouse server versions are incompatible 21.4.6
  • Table definition -
    CREATE TABLE returns.test_tbl
    (
    vend_nm String,
    ship_dt Date
    )
    ENGINE = MergeTree
    PARTITION BY toWeek(ship_dt)
    ORDER BY vend_nm
    SETTINGS index_granularity = 8192

Sample Data -
insert into returns.test_tbl values('1', '2020-11-11')('1', '2021-01-01');

  • Queries to run that lead to unexpected result
  1. select * From test_tbl where ship_dt>= toDate('2020-11-01') and ship_dt <= toDate('2021-05-05');
    This query returns no result.
  2. select * From test_tbl where ship_dt>= toDate('2020-01-01') and ship_dt <= toDate('2021-05-05');
    This query returns 1 record for date - 2021-01-01

This was working fine with version 20.5.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed user-visible misbehaviour in official releasemajor

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions