Skip to content

Unexpected Result of a complex expression #148279

@bajinsheng

Description

@bajinsheng

Describe the problem

The distributed plan gets the wrong result.

To Reproduce

create table t0(c0 text);
insert into t0 values('/a');
select * from t0 join (select 1) on not(-61.100 // 79 || c0 <= c0); -- {/a|1}, Expected: {}

If the query is executed by a distributed plan, we get a one-row result, which is unexpected, as not (-61.100 // 79 || c0 <= c0) is always false.

                          info                          
--------------------------------------------------------
 distribution: full
 vectorized: true
 
 • render
 │
 └── • filter
     │ filter: c0 < (-0 || c0)
     │
     └── • scan
           missing stats
           table: t0@t0_pkey
           spans: FULL SCAN

Expected behavior
The result should be empty.

Environment:

  • CockroachDB version [7625d9f]
  • Server OS: [Linux/Ubuntu]
  • Client app [psql]
cockroach start --insecure --store=node1 --locality=region=r1,zone=r1a --listen-addr=0.0.0.0:26257 --http-addr=0.0.0.0:8080 --join=127.0.0.1:26257,127.0.0.1:26258,127.0.0.1:26259 --background > node1.log 2>&1
cockroach start --insecure --store=node2 --locality=region=r2,zone=r2a --listen-addr=0.0.0.0:26258 --http-addr=0.0.0.0:8081 --join=127.0.0.1:26257,127.0.0.1:26258,127.0.0.1:26259 --background > node2.log 2>&1
cockroach init --insecure --host=127.0.0.1:26257

Jira issue: CRDB-51513

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.O-communityOriginated from the communityT-sql-queriesSQL Queries TeamX-blathers-triagedblathers was able to find an owner

    Type

    No type

    Projects

    Status

    Bugs to Fix

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions