Skip to content

Error when join with "where" condition  #634

@yexiaoli88

Description

@yexiaoli88

dble version:version: 5.6.29-dble-9.9.9.9-15b3b35-20180809064840

schema.xml

  <table name="a_test" primaryKey="id" dataNode="dn1,dn2,dn3,dn4" rule="mod-long" />
  <table name="a_order" primaryKey="id" dataNode="dn1,dn2,dn3,dn4" rule="mod-long" />

rule.xml

<tableRule name="mod-long">
		<rule>
			<columns>id</columns>
			<algorithm>sharding</algorithm>
		</rule>
</tableRule>
<function name="sharding" class="Hash">
		<property name="partitionCount">4</property>
		<property name="partitionLength">1</property>
	</function>	

prepare tables:

CREATE TABLE a_test(`id` int(10) unsigned NOT NULL,`t_id` int(10) unsigned NOT NULL DEFAULT '0',`name` char(120) NOT NULL DEFAULT '',`pad` int(11) NOT NULL,PRIMARY KEY (`id`),KEY `k_1` (`t_id`))DEFAULT CHARSET=UTF8;

CREATE TABLE a_order(`id` int(10) unsigned NOT NULL,`o_id` int(10) unsigned NOT NULL DEFAULT '0',`name` char(120) NOT NULL DEFAULT '',`pad` int(11) NOT NULL,PRIMARY KEY (`id`),KEY `k_1` (`o_id`))DEFAULT CHARSET=UTF8;

insert into a_test values(1,1,'test中id为1',1),(2,2,'test_2',2),(3,3,'test中id为3',4),(4,4,'$test$4',3),(5,5,'test...5',1),(6,6,'test6',6);

insert into a_order values(1,1,'order中id为1',1),(2,2,'test_2',2),(3,3,'order中id为3',3),(4,4,'$order$4',4),(5,5,'order...5',1);

steps:

  1. execute sql in dble:
mysql> select * from a_test a left join a_order b on a.pad=b.pad where a.t_id>b.o_id;
+----+------+----------+-----+----+------+------------+-----+
| id | t_id | name     | pad | id | o_id | name       | pad |
+----+------+----------+-----+----+------+------------+-----+
|  5 |    5 | test...5 |   1 |  1 |    1 | order?id?1 |   1 |
|  4 |    4 | $test$4  |   3 |  3 |    3 | order?id?3 |   3 |
|  6 |    6 | test6    |   6 | NULL | NULL | NULL       | NULL |
+----+------+----------+-----+----+------+------------+-----+
3 rows in set (0.00 sec)
  1. execute sql in mysql:
mysql> select * from a_test a left join a_order b on a.pad=b.pad where a.t_id>b.o_id;
+----+------+----------+-----+------+------+----------------+------+
| id | t_id | name     | pad | id   | o_id | name           | pad  |
+----+------+----------+-----+------+------+----------------+------+
|  5 |    5 | test...5 |   1 |    1 |    1 | order中id为1   |    1 |
|  4 |    4 | $test$4  |   3 |    3 |    3 | order中id为3   |    3 |
+----+------+----------+-----+------+------+----------------+------+
2 rows in set (0.00 sec)

expect result:
1. the result from dble should be same with mysql
real result:
1.the result from dble is different from mysql

Metadata

Metadata

Assignees

Labels

resolveproblem has been fixed by developerverifiedissue's resolve was verified by tester

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions