Skip to content

Unexpected results after indexing a column with multiple rows #16074

@suyZhong

Description

@suyZhong

What happens?

Consider the test case below. The second query returns one row of true and two rows of false, which means the expression is evaluated to true for only one row; however, the third query returns all three rows in the table. The result is expected if the index is removed, or testing on 1.1.3.

To Reproduce

CREATE  TABLE  t0(c1 TIMESTAMP);
INSERT INTO t0( c1) VALUES ('2020-02-29 12:00:00'), ('1969-12-09 09:26:38'), ('2020-02-29 12:00:00');
CREATE INDEX i0 ON t0(c1 );

SELECT * FROM t0; -- 3 rows
SELECT ((t0.c1)<=('2007-07-07 07:07:07')) FROM t0; -- false, true, false
SELECT * FROM t0 WHERE ((t0.c1)<=('2007-07-07 07:07:07'));
-- Expected: 1 row
-- Actual: 3 rows

I also found similar issues for other datatypes, e.g., VARCHAR, and FLOAT.

OS:

Ubuntu 22.04

DuckDB Version:

v1.1.4-dev5216 1b8c902

DuckDB Client:

CLI

Hardware:

No response

Full Name:

Suyang Zhong

Affiliation:

NUS

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a source build

Did you include all relevant data sets for reproducing the issue?

Not applicable - the reproduction does not require a data set

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions