Skip to content

Unexpected result when using FORMAT_TYPE #16225

Closed

Description

@suyZhong

CrateDB version

CrateDB 5.8.0-SNAPSHOT built da0993c

CrateDB setup information

Manual build following the instructions here: https://github.com/crate/crate/blob/master/devs/docs/basics.rst

Problem description

The expression using FORMAT_TYPE and applying the != operator should return TRUE. Consequently, the WHERE clause should not filter out the row. However, the actual result set does not include the row with the value NULL, which indicates misbehavior.

Steps to Reproduce

DROP TABLE IF EXISTS t0;
CREATE TABLE  t0 ( c1 INTEGER) ;
INSERT INTO t0(c1) VALUES (NULL);
REFRESH TABLE t0;

SELECT * FROM t0; -- NULL
SELECT ('text' != FORMAT_TYPE(3, t0.c1)) FROM t0; -- TRUE

SELECT * FROM t0 WHERE ('text' != FORMAT_TYPE(3, t0.c1));
-- Expected: NULL
-- Actual: empty table

Actual Result

Empty table

Expected Result

NULL

Activity

  1. added
    triageAn issue that needs to be triaged by a maintainer
    on Jun 25, 2024
  2. added
    bugClear identification of incorrect behaviour
    and removed
    triageAn issue that needs to be triaged by a maintainer
    on Jun 25, 2024
  3. self-assigned this
    on Jun 25, 2024
  4. added a commit that references this issue on Jun 25, 2024
    56d0772
  5. added 2 commits that reference this issue on Jun 25, 2024
    d435720
    143dfde
  6. added 2 commits that reference this issue on Jun 25, 2024
    7b832ec
    d39b6ab
  7. added a commit that references this issue on Jun 25, 2024
    fd4bf11
  8. matriv commented on Jun 25, 2024

    @matriv
    Contributor

    Thx for reporting yet another issue with null handling in the WHERE clause for functions, @suyZhong !
    It has been fixed and will be available with the next hotfix release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugClear identification of incorrect behaviour

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions