forked from pingcap/tidb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
planner/cascades: implement ImplementationRule for Selection (pingcap…
- Loading branch information
1 parent
46a505d
commit d0113f4
Showing
19 changed files
with
472 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[ | ||
{ | ||
"name": "TestPKIsHandleRangeScan", | ||
"cases": [ | ||
"explain select b from t where a > 1", | ||
"select b from t where a > 1", | ||
"explain select b from t where a > 1 and a < 3", | ||
"select b from t where a > 1 and a < 3", | ||
"explain select b from t where a > 1 and b < 6", | ||
"select b from t where a > 1 and b < 6", | ||
"explain select a from t where a * 3 + 1 > 9 and a < 5", | ||
"select a from t where a * 3 + 1 > 9 and a < 5", | ||
// Test TiDBSelection Implementation. | ||
// TODO: change this test case to agg + sel or join + sel when we support them. | ||
"explain select a from t where a * 3 + 1 > 9 and sin(a) < 0.5 and a < 5", | ||
"select a from t where a * 3 + 1 > 9 and sin(a) < 0.5 and a < 5" | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
[ | ||
{ | ||
"Name": "TestPKIsHandleRangeScan", | ||
"Cases": [ | ||
{ | ||
"SQL": "explain select b from t where a > 1", | ||
"Result": [ | ||
"Projection_8 3333.33 root Column#2", | ||
"└─TableReader_9 3333.33 root data:TableScan_10", | ||
" └─TableScan_10 3333.33 cop[tikv] table:t, range:(1,+inf], keep order:false, stats:pseudo" | ||
] | ||
}, | ||
{ | ||
"SQL": "select b from t where a > 1", | ||
"Result": [ | ||
"4", | ||
"6" | ||
] | ||
}, | ||
{ | ||
"SQL": "explain select b from t where a > 1 and a < 3", | ||
"Result": [ | ||
"Projection_8 2.00 root Column#2", | ||
"└─TableReader_9 2.00 root data:TableScan_10", | ||
" └─TableScan_10 2.00 cop[tikv] table:t, range:(1,3), keep order:false, stats:pseudo" | ||
] | ||
}, | ||
{ | ||
"SQL": "select b from t where a > 1 and a < 3", | ||
"Result": null | ||
}, | ||
{ | ||
"SQL": "explain select b from t where a > 1 and b < 6", | ||
"Result": [ | ||
"Projection_9 2666.67 root Column#2", | ||
"└─TableReader_10 2666.67 root data:Selection_11", | ||
" └─Selection_11 2666.67 cop[tikv] lt(Column#2, 6)", | ||
" └─TableScan_12 3333.33 cop[tikv] table:t, range:(1,+inf], keep order:false, stats:pseudo" | ||
] | ||
}, | ||
{ | ||
"SQL": "select b from t where a > 1 and b < 6", | ||
"Result": [ | ||
"4" | ||
] | ||
}, | ||
{ | ||
"SQL": "explain select a from t where a * 3 + 1 > 9 and a < 5", | ||
"Result": [ | ||
"Projection_9 4.00 root Column#1", | ||
"└─TableReader_10 4.00 root data:Selection_11", | ||
" └─Selection_11 4.00 cop[tikv] gt(plus(mul(Column#1, 3), 1), 9)", | ||
" └─TableScan_12 5.00 cop[tikv] table:t, range:[-inf,5), keep order:false, stats:pseudo" | ||
] | ||
}, | ||
{ | ||
"SQL": "select a from t where a * 3 + 1 > 9 and a < 5", | ||
"Result": [ | ||
"3" | ||
] | ||
}, | ||
{ | ||
"SQL": "explain select a from t where a * 3 + 1 > 9 and sin(a) < 0.5 and a < 5", | ||
"Result": [ | ||
"Projection_10 3.20 root Column#1", | ||
"└─Selection_11 3.20 root lt(sin(cast(Column#1)), 0.5)", | ||
" └─TableReader_12 4.00 root data:Selection_13", | ||
" └─Selection_13 4.00 cop[tikv] gt(plus(mul(Column#1, 3), 1), 9)", | ||
" └─TableScan_14 5.00 cop[tikv] table:t, range:[-inf,5), keep order:false, stats:pseudo" | ||
] | ||
}, | ||
{ | ||
"SQL": "select a from t where a * 3 + 1 > 9 and sin(a) < 0.5 and a < 5", | ||
"Result": [ | ||
"3" | ||
] | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.