Skip to content

Bug Report: Unexpected result when using bit-wise inversion and logical OR #16590

@suyZhong

Description

@suyZhong

Overview of the Issue

Consider the following test case. The first query for the expression ~(1||0) IS NULL is evaluated to 0, which means the WHERE predicate in the second query should also be evaluated to 0. The expected result of the second query should be an empty table. However, it returns 1.

Reproduction Steps

Start the Vittestserver docker container according to https://vitess.io/docs/21.0/get-started/vttestserver-docker-image/

Execute the following SQL using a MySQL client

SELECT (~ (1||0)) IS NULL; -- 0
SELECT 1 WHERE (~ (1||0)) IS NULL;
-- Expected: empty result
-- Actual: 1

-- MySQL:
SELECT (~ (1||0)) IS NULL; -- 0
SELECT 1 WHERE (~ (1||0)) IS NULL; -- Empty

Binary Version

Version: 21.0.0-SNAPSHOT (Git revision f2d5d1cf5438d861127b3a65984cb39843225901 branch 'main')

Operating System and Environment details

docker pull vitess/vttestserver:mysql80
x86_64

Log Fragments

No response

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