cockroachdb / cockroachdb/cockroach
Unexpected Result of a complex expression
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
**Describe the problem**
The distributed plan gets the wrong result.
**To Reproduce**
```sql
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.
```shell
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]
```bash
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
Contributor guide
Assessment
This issue has not been assessed yet.