Skip to content

Unexpected result when using ARRAY(TEXT) in IN #16652

Closed

Description

@suyZhong

CrateDB version

CrateDB 5.9.0-SNAPSHOT built 23be7d1

CrateDB setup information

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

Problem description

Consider the test case below. It is unexpected that the last query returns an empty result since the second query shows that the expression should be evaluated as TRUE, and thus the third query should return the row in the table.

Steps to Reproduce

DROP TABLE IF EXISTS t0;

CREATE   TABLE  t0(c1 ARRAY(TEXT));
INSERT INTO t0(c1) VALUES (ARRAY['hello','world']);
REFRESH TABLE t0;


SELECT t0.c1 FROM t0; -- ["hello", "world"]
SELECT (t0.c1 IN (ARRAY['hello','world'])) FROM t0; -- TRUE
SELECT t0.c1 FROM t0 WHERE (t0.c1 IN (ARRAY['hello','world']));
-- Expected: ["hello", "world"]
-- Actual: empty result set

Actual Result

empty table

Expected Result

["hello", "world"]

Activity

  1. added
    triageAn issue that needs to be triaged by a maintainer
    on Sep 23, 2024
  2. BaurzhanSakhariev commented on Sep 23, 2024

    @BaurzhanSakhariev
    Contributor

    Checked whether it's a recent regression but it's not: doesn't work in 5.6.5 and 5.7.5 as well

  3. removed
    triageAn issue that needs to be triaged by a maintainer
    on Sep 24, 2024
  4. jeeminso commented on Sep 24, 2024

    @jeeminso
    Contributor

    Thank you for reporting @suyZhong . The fix will be available with the next hotfix relase.

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