Tencent / TBase

TBase is an enterprise-level distributed HTAP database. Through a single database cluster to provide users with highly consistent distributed database services and high-performance data warehouse services, a set of integrated enterprise-level solutions is formed.
Other
1.38k stars 262 forks source link

(0,0)equals(0,null) in tbase? #61

Closed l1t1 closed 4 years ago

l1t1 commented 4 years ago

https://github.com/Tencent/TBase/commit/6abec7e1fba490e94a685dd314f1f8b502b437e1 and https://github.com/Tencent/TBase/blob/6abec7e1fba490e94a685dd314f1f8b502b437e1/src/test/regress/expected/subselect_1.out says it fixed a bug #7597, but the newer version's result seems wrong too. the version build by https://github.com/Tencent/TBase/archive/master.zip

test=# --
test=# -- Test case for cross-type partial matching in hashed subplan (bug #7597)
test=# --
test=# create temp table outer_7597 (f1 int4, f2 int4);
insert into outer_7597 values (1, 0);
insert into outer_7597 values (0, null);
insert into outer_7597 values (1, null);
create temp table inner_7597(c1 int8, c2 int8);
insert into inner_7597 values(0, null);
select * from outer_7597 where (f1, f2) not in (select * from inner_7597) order by 1;
CREATE TABLE
test=# insert into outer_7597 values (0, 0);
INSERT 0 1
test=# insert into outer_7597 values (1, 0);
INSERT 0 1
test=# insert into outer_7597 values (0, null);
INSERT 0 1
test=# insert into outer_7597 values (1, null);
INSERT 0 1
test=# create temp table inner_7597(c1 int8, c2 int8);
CREATE TABLE
test=# insert into inner_7597 values(0, null);
INSERT 0 1
test=# select * from outer_7597 where (f1, f2) not in (select * from inner_7597) order by 1;
 f1 | f2
----+----
  1 |  0
  1 |
(2 rows)

and the version build with https://github.com/Tencent/TBase/archive/v2.1.0.tar.gz

test=# --
test=# -- Test case for cross-type partial matching in hashed subplan (bug #7597)
test=# --
test=# create temp table outer_7597 (f1 int4, f2 int4);
insert into outer_7597 values (0, null);
insert into outer_7597 values (1, null);
create temp table inner_7597(c1 int8, c2 int8);
insert into inner_7597 values(0, null);
select * from outer_7597 where (f1, f2) not in (select * from inner_7597) order by 1;CREATE TABLE
test=# insert into outer_7597 values (0, 0);
INSERT 0 1
test=# insert into outer_7597 values (1, 0);
INSERT 0 1
test=# insert into outer_7597 values (0, null);
INSERT 0 1
test=# insert into outer_7597 values (1, null);
INSERT 0 1
test=# create temp table inner_7597(c1 int8, c2 int8);
CREATE TABLE
test=# insert into inner_7597 values(0, null);
INSERT 0 1
test=# select * from outer_7597 where (f1, f2) not in (select * from inner_7597) order by 1;
 f1 | f2
----+----
  0 |  0
  0 |
  1 |  0
  1 |
(4 rows)
l1t1 commented 4 years ago

other tests

test=# select 1 where (0,null) in((0,0));
 ?column?
----------
(0 rows)

test=# select 1 where (0,null) not in((0,0));
 ?column?
----------
(0 rows)

test=# select 1 where (0,null) in((0,null));
 ?column?
----------
(0 rows)

test=# select 1 where (0,0) in((0,null));
 ?column?
----------
(0 rows)

test=# select 1 where (0,0) in((0,0));
 ?column?
----------
        1
l1t1 commented 4 years ago

the result is same as oracle,close