Skip to content

Unexpected result after creating index on DATE column #13842

Closed

Description

@suyZhong

What happens?

Consider the following test case. The third query is unexpected as it falsely omitted one row. The second query shows that the expression '1970-01-03' >= t0.c0 is true for all the rows and thus the third query should return all three rows of the original table.

I built duckdb by GEN=ninja make. Not sure if the issue is related to #13785.

To Reproduce

DROP TABLE IF EXISTS t0;

CREATE TABLE  t0(c0 DATE);
INSERT INTO t0(c0) VALUES  ('1970-01-02');
INSERT INTO t0(c0) VALUES ('1970-01-02');
CREATE INDEX t0i0 ON t0(c0 DESC);
INSERT INTO t0(c0) VALUES ('1970-01-03');

SELECT * FROM t0; -- 1970-01-02, 1970-01-02, 1970-01-03
SELECT ('1970-01-03' >= t0.c0) FROM t0; -- true, true, true (3 rows)
SELECT * FROM t0 WHERE ('1970-01-03' >= t0.c0);
-- Expected: 1970-01-02, 1970-01-02, 1970-01-03 (3 rows)
-- Actual: 1970-01-02, 1970-01-02 (2 rows)

OS:

ubuntu 22.04

DuckDB Version:

v1.1.1-dev25 d9e89b5

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?

Yes

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