You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Rafael Acevedo (Jira)" <ji...@apache.org> on 2025/01/08 21:09:00 UTC

[jira] [Commented] (CALCITE-6768) Inconsistent null behavior with quantify operators

    [ https://issues.apache.org/jira/browse/CALCITE-6768?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17911239#comment-17911239 ] 

Rafael Acevedo commented on CALCITE-6768:
-----------------------------------------

Oops, I got confused with the emps table values. Closing

> Inconsistent null behavior with quantify operators
> --------------------------------------------------
>
>                 Key: CALCITE-6768
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6768
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.38.0
>            Reporter: Rafael Acevedo
>            Priority: Major
>
> Hi everyone! The quantify operators (ALL, SOME, ANY) seem to have inconsistent null behavior between operators (=, >= ...), even when the original operators work as expected.
>  
> Using the emps table:
> {code:sql}
> 0: jdbc:calcite:model=src/test/resources/mode> select TRUE = ALL (select slacker from emps);
> +--------+
> | EXPR$0 |
> +--------+
> | false  |
> +--------+
> 1 row selected (0.019 seconds)
> 0: jdbc:calcite:model=src/test/resources/mode> select TRUE >= ALL (select slacker from emps);
> +--------+
> | EXPR$0 |
> +--------+
> |        |
> +--------+
> 1 row selected (0.034 seconds)
> {code}
> In my understanding, the expected result is null for both queries, since there are null entries in the "slacker" column and both = and >= are equivalent for booleans ({{true >= <any bool>}} and {{true = <any bool>}} always yield the same result).
> As a reference, duckdb yields the same result for both queries:
> {code}
> ❯ duckdb -json -c 'SELECT TRUE = ALL (SELECT * FROM (VALUES (TRUE), (NULL))) AS result';
> [{"result":null}]
> ❯ duckdb -json -c 'SELECT TRUE >= ALL (SELECT * FROM (VALUES (TRUE), (NULL))) AS result';
> [{"result":null}]
> {code}
> Is this a bug? Anyway, some code pointers indicating why this happens would be nice.
> Thanks!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)