Skip to content
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

Using UInt64 with partition using toYYYYMMDD produces empty result on queries filtering against negative values #35304

Closed
fassisrosa opened this issue Mar 15, 2022 · 1 comment · Fixed by #35334
Assignees
Labels
backward compatibility bug Confirmed user-visible misbehaviour in official release comp-optimizers Query optimizations

Comments

@fassisrosa
Copy link

Describe the issue
A table that includes a field with UInt64 and uses that field to create partition using toYYYYMMDD fails to return values when doing a query for values larger than -1. This used to work in ClickHouse version 20.8.7.15 and it is currently broken in version 22.2.3.1 resulting in broken code.

Which ClickHouse server versions are incompatible
Versions 20.8.7.15 and 22.2.3.1

How to reproduce
Create table and insert data:

CREATE TABLE broken ( time UInt64 ) ENGINE = MergeTree PARTITION BY toYYYYMMDD(toDate(time / 1000)) ORDER BY time;
INSERT INTO broken (time) VALUES (1647353101000), (1647353101001), (1647353101002), (1647353101003);

Run the following queries:

SELECT * FROM broken WHERE time>0;
SELECT * FROM broken WHERE time>-1;

The first query returns all records, the second one returns empty result.

@den-crane
Copy link
Contributor

cc @amosbird

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backward compatibility bug Confirmed user-visible misbehaviour in official release comp-optimizers Query optimizations
Projects
None yet
3 participants