Skip to content

Missing Results when using Floating-point in BETWEEN #9825

Closed

Description

@suyZhong

What happens?

Considering the test case below: The third SELECT returns an empty result, which is surprising: If the result of second query contains at least one true, the value of the BETWEEN expression should be true, and thus the third query should return one row in t0.

If replacing 3.1 to 3, or only inserting 5, things go well.

To Reproduce

CREATE TABLE t0(c1 INT);
INSERT INTO t0(c1) VALUES (-1);
INSERT INTO t0(c1) VALUES (5);

SELECT * FROM t0; -- -1, 5
SELECT (c1 BETWEEN 3.1 AND c1) FROM t0; -- false, true
SELECT * FROM t0 WHERE (c1 BETWEEN 3.1 AND c1); 
-- Expected: 5
-- Actual: empty

OS:

ubuntu 22.04

DuckDB Version:

v0.9.3-dev915 e46ece4

DuckDB Client:

CLI

Full Name:

Suyang Zhong

Affiliation:

NUS

Have you tried this on the latest main branch?

I have tested with a main build

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • Yes, I have

Activity

  1. added a commit that references this issue on Nov 28, 2023
    88db0b3
  2. added a commit that references this issue on Nov 28, 2023
    134199b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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