Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two sharding tables cross database join, error #968

Closed
FlyingMao opened this issue Jan 30, 2019 · 1 comment
Closed

Two sharding tables cross database join, error #968

FlyingMao opened this issue Jan 30, 2019 · 1 comment
Assignees
Labels
from auto_test resolve problem has been fixed by developer sql-coverage
Milestone

Comments

@FlyingMao
Copy link

FlyingMao commented Jan 30, 2019

  • dble version:
    5.6.29-dble-9.9.9.9-f2ee68f267caf5c53371cb68de2068998b363b72-20190128080033
  • preconditions :
use schema1
drop table if exists sharding_4_t1
drop table if exists schema2.sharding_4_t2
CREATE TABLE sharding_4_t1(`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 schema2.sharding_4_t2(`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 sharding_4_t1 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 schema2.sharding_4_t2 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)
  • configs:

schema.xml

<schema name="schema1" sqlMaxLimit="100" dataNode="dn5">
		<table name="sharding_4_t1" dataNode="dn1,dn2,dn3,dn4" rule="hash-four" />
	</schema>
	<schema name="schema2" sqlMaxLimit="100">
		<table name="sharding_4_t2" dataNode="dn1,dn2,dn3,dn4" rule="hash-four" />
	</schema>

rule.xml



server.xml



  • steps:
    step1.
select * from sharding_4_t1 natural right join schema2.sharding_4_t2;
  • expect result:
    1.
mysql> select * from sharding_4_t1 natural right join schema2.sharding_4_t2;
+----+----------------+-----+------+------+
| id | name           | pad | o_id | t_id |
+----+----------------+-----+------+------+
|  1 | order中id为1   |   1 |    1 | NULL |
|  2 | test_2         |   2 |    2 |    2 |
|  3 | order中id为3   |   3 |    3 | NULL |
|  4 | $order$4       |   4 |    4 | NULL |
|  5 | order...5      |   1 |    5 | NULL |
+----+----------------+-----+------+------+
5 rows in set (0.00 sec)
  • real result:
    1.
mysql> select * from sharding_4_t1 natural right join schema2.sharding_4_t2;
ERROR 1003 (HY000): Table 'db3.sharding_4_t2' doesn't exist

  • supplements:
    1.explain result in dble
mysql> explain select * from sharding_4_t1 natural right join schema2.sharding_4_t2;
+-----------------+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| DATA_NODE       | TYPE          | SQL/REF                                                                                                                                                                                                                                                                                                                              |
+-----------------+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| dn5_0           | BASE SQL      | select `sharding_4_t2`.`id`,`sharding_4_t2`.`m_id`,`sharding_4_t2`.`name`,`sharding_4_t2`.`pad` from  `sharding_4_t2` left join  `sharding_4_t1` on sharding_4_t2.id = sharding_4_t1.id and sharding_4_t2.m_id = sharding_4_t1.m_id and sharding_4_t2.name = sharding_4_t1.name and sharding_4_t2.pad = sharding_4_t1.pad where 1=1  |
| merge_1         | MERGE         | dn5_0                                                                                                                                                                                                                                                                                                                                |
| shuffle_field_1 | SHUFFLE_FIELD | merge_1                                                                                                                                                                                                                                                                                                                              |
+-----------------+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
3 rows in set (0.01 sec)

for tester
in autotest: dble/sqls/sqls_mixed/select/join_shardings.sql(line:88)

/label ~BUG

@yanhuqing666 yanhuqing666 added this to the 2.19.01.0 milestone Jan 31, 2019
yanhuqing666 added a commit that referenced this issue Jan 31, 2019
#968 #967 change median column into schema.table.column
@sunsun314 sunsun314 added the resolve problem has been fixed by developer label Jan 31, 2019
@sunsun314 sunsun314 assigned FlyingMao and unassigned sunsun314 Jan 31, 2019
@sunsun314 sunsun314 assigned sunsun314 and unassigned FlyingMao Feb 21, 2019
@sunsun314 sunsun314 removed the resolve problem has been fixed by developer label Feb 21, 2019
@sunsun314 sunsun314 mentioned this issue Feb 25, 2019
sunsun314 added a commit that referenced this issue Feb 26, 2019
sunsun314 added a commit that referenced this issue Feb 26, 2019
sunsun314 added a commit that referenced this issue Feb 26, 2019
yanhuqing666 added a commit that referenced this issue Feb 26, 2019
@sunsun314 sunsun314 added the resolve problem has been fixed by developer label Feb 27, 2019
@sunsun314 sunsun314 assigned FlyingMao and unassigned sunsun314 Feb 27, 2019
@FlyingMao
Copy link
Author

verified version: 5.6.29-dble-9.9.9.9-d395c5efe3733f839360964cf9482465e95c7236-20190227063450

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from auto_test resolve problem has been fixed by developer sql-coverage
Projects
None yet
Development

No branches or pull requests

3 participants