You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/09/27 08:23:35 UTC
[GitHub] [shardingsphere] strongduanmu opened a new issue, #21220: Missing conversion is LogicalSort occurs when execute limit with sql federation
strongduanmu opened a new issue, #21220:
URL: https://github.com/apache/shardingsphere/issues/21220
## Bug Report
### Which version of ShardingSphere did you use?
https://github.com/apache/shardingsphere/commit/5df14e707e290e482878f11786ef402024e317ed
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy
### Expected behavior
Execute `select * from test where aid > 0 limit 1;` successfully.
### Actual behavior
```
sharding_db=> select * from test where aid > 0 limit 1;
ERROR: There are not enough rules to produce a node with desired properties: convention=ENUMERABLE, sort=[].
Missing conversion is LogicalSort[convention: NONE -> ENUMERABLE]
There is 1 empty subset: rel#331:RelSubset#5.ENUMERABLE.[], the relevant part of the original plan is as follows
329:LogicalSort(fetch=[1])
327:LogicalJoin(subset=[rel#328:RelSubset#4.NONE.[]], condition=[=($0, $2)], joinType=[inner])
322:LogicalCalc(subset=[rel#323:RelSubset#1.NONE.[]], expr#0..1=[{inputs}], expr#2=[0], expr#3=[>($t0, $t2)], proj#0..1=[{exprs}], $condition=[$t3])
268:LogicalTableScan(subset=[rel#321:RelSubset#0.NONE.[]], table=[[public, a]])
325:LogicalCalc(subset=[rel#326:RelSubset#3.NONE.[]], expr#0..1=[{inputs}], expr#2=[0], expr#3=[>($t0, $t2)], proj#0..1=[{exprs}], $condition=[$t3])
270:LogicalTableScan(subset=[rel#324:RelSubset#2.NONE.[]], table=[[public, b]])
Root: rel#331:RelSubset#5.ENUMERABLE.[]
Original rel:
LogicalSort(subset=[rel#331:RelSubset#5.ENUMERABLE.[]], fetch=[1]): rowcount = 1.0, cumulative cost = {1.0 rows, 28.0 cpu, 0.0 io}, id = 329
LogicalJoin(subset=[rel#328:RelSubset#4.NONE.[]], condition=[=($0, $2)], joinType=[inner]): rowcount = 375.0, cumulative cost = {375.0 rows, 0.0 cpu, 0.0 io}, id = 327
LogicalCalc(subset=[rel#323:RelSubset#1.NONE.[]], expr#0..1=[{inputs}], expr#2=[0], expr#3=[>($t0, $t2)], proj#0..1=[{exprs}], $condition=[$t3]): rowcount = 50.0, cumulative cost = {50.0 rows, 700.0 cpu, 0.0 io}, id = 322
LogicalTableScan(subset=[rel#321:RelSubset#0.NONE.[]], table=[[public, a]]): rowcount = 100.0, cumulative cost = {100.0 rows, 101.0 cpu, 0.0 io}, id = 268
LogicalCalc(subset=[rel#326:RelSubset#3.NONE.[]], expr#0..1=[{inputs}], expr#2=[0], expr#3=[>($t0, $t2)], proj#0..1=[{exprs}], $condition=[$t3]): rowcount = 50.0, cumulative cost = {50.0 rows, 700.0 cpu, 0.0 io}, id = 325
LogicalTableScan(subset=[rel#324:RelSubset#2.NONE.[]], table=[[public, b]]): rowcount = 100.0, cumulative cost = {100.0 rows, 101.0 cpu, 0.0 io}, id = 270
Sets:
Set#0, type: RecordType(JavaType(class java.lang.Integer) id, JavaType(class java.lang.String) name)
rel#321:RelSubset#0.NONE.[], best=null
rel#268:LogicalTableScan.NONE.[](table=[public, a]), rowcount=100.0, cumulative cost={inf}
rel#334:RelSubset#0.ENUMERABLE.[], best=rel#333
rel#333:EnumerableTableScan.ENUMERABLE.[](table=[public, a]), rowcount=100.0, cumulative cost={100.0 rows, 101.0 cpu, 0.0 io}
Set#1, type: RecordType(JavaType(class java.lang.Integer) id, JavaType(class java.lang.String) name)
rel#323:RelSubset#1.NONE.[], best=null
rel#322:LogicalCalc.NONE.[](input=RelSubset#321,expr#0..1={inputs},expr#2=0,expr#3=>($t0, $t2),proj#0..1={exprs},$condition=$t3), rowcount=50.0, cumulative cost={inf}
rel#336:RelSubset#1.ENUMERABLE.[], best=rel#335
rel#335:EnumerableCalc.ENUMERABLE.[](input=RelSubset#334,expr#0..1={inputs},expr#2=0,expr#3=>($t0, $t2),proj#0..1={exprs},$condition=$t3), rowcount=50.0, cumulative cost={150.0 rows, 801.0 cpu, 0.0 io}
Set#2, type: RecordType(JavaType(class java.lang.Integer) id, JavaType(class java.lang.String) name)
rel#324:RelSubset#2.NONE.[], best=null
rel#270:LogicalTableScan.NONE.[](table=[public, b]), rowcount=100.0, cumulative cost={inf}
rel#338:RelSubset#2.ENUMERABLE.[], best=rel#337
rel#337:EnumerableTableScan.ENUMERABLE.[](table=[public, b]), rowcount=100.0, cumulative cost={100.0 rows, 101.0 cpu, 0.0 io}
Set#3, type: RecordType(JavaType(class java.lang.Integer) id, JavaType(class java.lang.String) name)
rel#326:RelSubset#3.NONE.[], best=null
rel#325:LogicalCalc.NONE.[](input=RelSubset#324,expr#0..1={inputs},expr#2=0,expr#3=>($t0, $t2),proj#0..1={exprs},$condition=$t3), rowcount=50.0, cumulative cost={inf}
rel#340:RelSubset#3.ENUMERABLE.[], best=rel#339
rel#339:EnumerableCalc.ENUMERABLE.[](input=RelSubset#338,expr#0..1={inputs},expr#2=0,expr#3=>($t0, $t2),proj#0..1={exprs},$condition=$t3), rowcount=50.0, cumulative cost={150.0 rows, 801.0 cpu, 0.0 io}
Set#4, type: RecordType(JavaType(class java.lang.Integer) id, JavaType(class java.lang.String) name, JavaType(class java.lang.Integer) id0, JavaType(class java.lang.String) name0)
rel#328:RelSubset#4.NONE.[], best=null
rel#327:LogicalJoin.NONE.[](left=RelSubset#323,right=RelSubset#326,condition==($0, $2),joinType=inner), rowcount=375.0, cumulative cost={inf}
rel#342:RelSubset#4.ENUMERABLE.[], best=rel#341
rel#341:EnumerableHashJoin.ENUMERABLE.[](left=RelSubset#336,right=RelSubset#340,condition==($0, $2),joinType=inner), rowcount=375.0, cumulative cost={920.6011502714073 rows, 1602.0 cpu, 0.0 io}
Set#5, type: RecordType(JavaType(class java.lang.Integer) id, JavaType(class java.lang.String) name, JavaType(class java.lang.Integer) id0, JavaType(class java.lang.String) name0)
rel#330:RelSubset#5.NONE.[], best=null
rel#329:LogicalSort.NONE.[](input=RelSubset#328,fetch=1), rowcount=1.0, cumulative cost={inf}
rel#331:RelSubset#5.ENUMERABLE.[], best=null
rel#332:AbstractConverter.ENUMERABLE.[](input=RelSubset#330,convention=ENUMERABLE,sort=[]), rowcount=1.0, cumulative cost={inf}
Graphviz:
digraph G {
root [style=filled,label="Root"];
subgraph cluster0{
label="Set 0 RecordType(JavaType(class java.lang.Integer) id, JavaType(class java.lang.String) name)";
rel268 [label="rel#268:LogicalTableScan\ntable=[public, a]\nrows=100.0, cost={inf}",shape=box]
rel333 [label="rel#333:EnumerableTableScan\ntable=[public, a]\nrows=100.0, cost={100.0 rows, 101.0 cpu, 0.0 io}",color=blue,shape=box]
subset321 [label="rel#321:RelSubset#0.NONE.[]"]
subset334 [label="rel#334:RelSubset#0.ENUMERABLE.[]"]
}
subgraph cluster1{
label="Set 1 RecordType(JavaType(class java.lang.Integer) id, JavaType(class java.lang.String) name)";
rel322 [label="rel#322:LogicalCalc\ninput=RelSubset#321,expr#0..1={inputs},expr#2=0,expr#3=>($t0, $t2),proj#0..1={exprs},$condition=$t3\nrows=50.0, cost={inf}",shape=box]
rel335 [label="rel#335:EnumerableCalc\ninput=RelSubset#334,expr#0..1={inputs},expr#2=0,expr#3=>($t0, $t2),proj#0..1={exprs},$condition=$t3\nrows=50.0, cost={150.0 rows, 801.0 cpu, 0.0 io}",color=blue,shape=box]
subset323 [label="rel#323:RelSubset#1.NONE.[]"]
subset336 [label="rel#336:RelSubset#1.ENUMERABLE.[]"]
}
subgraph cluster2{
label="Set 2 RecordType(JavaType(class java.lang.Integer) id, JavaType(class java.lang.String) name)";
rel270 [label="rel#270:LogicalTableScan\ntable=[public, b]\nrows=100.0, cost={inf}",shape=box]
rel337 [label="rel#337:EnumerableTableScan\ntable=[public, b]\nrows=100.0, cost={100.0 rows, 101.0 cpu, 0.0 io}",color=blue,shape=box]
subset324 [label="rel#324:RelSubset#2.NONE.[]"]
subset338 [label="rel#338:RelSubset#2.ENUMERABLE.[]"]
}
subgraph cluster3{
label="Set 3 RecordType(JavaType(class java.lang.Integer) id, JavaType(class java.lang.String) name)";
rel325 [label="rel#325:LogicalCalc\ninput=RelSubset#324,expr#0..1={inputs},expr#2=0,expr#3=>($t0, $t2),proj#0..1={exprs},$condition=$t3\nrows=50.0, cost={inf}",shape=box]
rel339 [label="rel#339:EnumerableCalc\ninput=RelSubset#338,expr#0..1={inputs},expr#2=0,expr#3=>($t0, $t2),proj#0..1={exprs},$condition=$t3\nrows=50.0, cost={150.0 rows, 801.0 cpu, 0.0 io}",color=blue,shape=box]
subset326 [label="rel#326:RelSubset#3.NONE.[]"]
subset340 [label="rel#340:RelSubset#3.ENUMERABLE.[]"]
}
subgraph cluster4{
label="Set 4 RecordType(JavaType(class java.lang.Integer) id, JavaType(class java.lang.String) name, JavaType(class java.lang.Integer) id0, JavaType(class java.lang.String) name0)";
rel327 [label="rel#327:LogicalJoin\nleft=RelSubset#323,right=RelSubset#326,condition==($0, $2),joinType=inner\nrows=375.0, cost={inf}",shape=box]
rel341 [label="rel#341:EnumerableHashJoin\nleft=RelSubset#336,right=RelSubset#340,condition==($0, $2),joinType=inner\nrows=375.0, cost={920.6011502714073 rows, 1602.0 cpu, 0.0 io}",color=blue,shape=box]
subset328 [label="rel#328:RelSubset#4.NONE.[]"]
subset342 [label="rel#342:RelSubset#4.ENUMERABLE.[]"]
}
subgraph cluster5{
label="Set 5 RecordType(JavaType(class java.lang.Integer) id, JavaType(class java.lang.String) name, JavaType(class java.lang.Integer) id0, JavaType(class java.lang.String) name0)";
rel329 [label="rel#329:LogicalSort\ninput=RelSubset#328,fetch=1\nrows=1.0, cost={inf}",shape=box]
rel332 [label="rel#332:AbstractConverter\ninput=RelSubset#330,convention=ENUMERABLE,sort=[]\nrows=1.0, cost={inf}",shape=box]
subset330 [label="rel#330:RelSubset#5.NONE.[]"]
subset331 [label="rel#331:RelSubset#5.ENUMERABLE.[]",color=red]
}
root -> subset331;
subset321 -> rel268;
subset334 -> rel333[color=blue];
subset323 -> rel322; rel322 -> subset321;
subset336 -> rel335[color=blue]; rel335 -> subset334[color=blue];
subset324 -> rel270;
subset338 -> rel337[color=blue];
subset326 -> rel325; rel325 -> subset324;
subset340 -> rel339[color=blue]; rel339 -> subset338[color=blue];
subset328 -> rel327; rel327 -> subset323[label="0"]; rel327 -> subset326[label="1"];
subset342 -> rel341[color=blue]; rel341 -> subset336[color=blue,label="0"]; rel341 -> subset340[color=blue,label="1"];
subset330 -> rel329; rel329 -> subset328;
subset331 -> rel332; rel332 -> subset330;
}
```
### Reason analyze (If you can)
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
Execute following sql:
```sql
create view test as select a.id as aid, a.name as aname, b.id as bid, b.name as bname from a,b where a.id = b.id;
select * from test where aid > 0 limit 1;
```
### Example codes for reproduce this issue (such as a github link).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tuichenchuxin closed issue #21220: Missing conversion is LogicalSort occurs when execute limit with sql federation
Posted by GitBox <gi...@apache.org>.
tuichenchuxin closed issue #21220: Missing conversion is LogicalSort occurs when execute limit with sql federation
URL: https://github.com/apache/shardingsphere/issues/21220
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on issue #21220: Missing conversion is LogicalSort occurs when execute limit with sql federation
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #21220:
URL: https://github.com/apache/shardingsphere/issues/21220#issuecomment-1259159664
Ref #19580.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org