[ { "Name": "TestOuterJoinPropConst", "Cases": [ { "SQL": "explain select * from t1 left join t2 on t1.a > t2.a and t1.a = 1", "Result": [ "HashJoin_6 33233333.33 root CARTESIAN left outer join, left cond:[eq(test.t1.a, 1)]", "├─TableReader_12(Build) 3323.33 root data:Selection_11", "│ └─Selection_11 3323.33 cop[tikv] gt(1, test.t2.a)", "│ └─TableFullScan_10 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", "└─TableReader_9(Probe) 10000.00 root data:TableFullScan_8", " └─TableFullScan_8 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 left join t2 on t1.a > t2.a where t1.a = 1", "Result": [ "HashJoin_8 33233.33 root CARTESIAN left outer join", "├─TableReader_11(Build) 10.00 root data:Selection_10", "│ └─Selection_10 10.00 cop[tikv] eq(test.t1.a, 1)", "│ └─TableFullScan_9 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", "└─TableReader_14(Probe) 3323.33 root data:Selection_13", " └─Selection_13 3323.33 cop[tikv] gt(1, test.t2.a)", " └─TableFullScan_12 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 left join t2 on t1.a = t2.a and t1.a > 1", "Result": [ "HashJoin_6 10000.00 root left outer join, equal:[eq(test.t1.a, test.t2.a)], left cond:[gt(test.t1.a, 1)]", "├─TableReader_12(Build) 3333.33 root data:Selection_11", "│ └─Selection_11 3333.33 cop[tikv] gt(test.t2.a, 1), not(isnull(test.t2.a))", "│ └─TableFullScan_10 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", "└─TableReader_9(Probe) 10000.00 root data:TableFullScan_8", " └─TableFullScan_8 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 left join t2 on t1.a = t2.a where t1.a > 1", "Result": [ "HashJoin_7 4166.67 root left outer join, equal:[eq(test.t1.a, test.t2.a)]", "├─TableReader_14(Build) 3333.33 root data:Selection_13", "│ └─Selection_13 3333.33 cop[tikv] gt(test.t2.a, 1), not(isnull(test.t2.a))", "│ └─TableFullScan_12 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", "└─TableReader_11(Probe) 3333.33 root data:Selection_10", " └─Selection_10 3333.33 cop[tikv] gt(test.t1.a, 1)", " └─TableFullScan_9 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 right join t2 on t1.a > t2.a where t2.a = 1", "Result": [ "HashJoin_8 33333.33 root CARTESIAN right outer join", "├─TableReader_14(Build) 10.00 root data:Selection_13", "│ └─Selection_13 10.00 cop[tikv] eq(test.t2.a, 1)", "│ └─TableFullScan_12 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", "└─TableReader_11(Probe) 3333.33 root data:Selection_10", " └─Selection_10 3333.33 cop[tikv] gt(test.t1.a, 1)", " └─TableFullScan_9 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 right join t2 on t1.a = t2.a where t2.a > 1", "Result": [ "HashJoin_7 4166.67 root right outer join, equal:[eq(test.t1.a, test.t2.a)]", "├─TableReader_11(Build) 3333.33 root data:Selection_10", "│ └─Selection_10 3333.33 cop[tikv] gt(test.t1.a, 1), not(isnull(test.t1.a))", "│ └─TableFullScan_9 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", "└─TableReader_14(Probe) 3333.33 root data:Selection_13", " └─Selection_13 3333.33 cop[tikv] gt(test.t2.a, 1)", " └─TableFullScan_12 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 right join t2 on t1.a = t2.a and t2.a > 1", "Result": [ "HashJoin_6 10000.00 root right outer join, equal:[eq(test.t1.a, test.t2.a)], right cond:gt(test.t2.a, 1)", "├─TableReader_10(Build) 3333.33 root data:Selection_9", "│ └─Selection_9 3333.33 cop[tikv] gt(test.t1.a, 1), not(isnull(test.t1.a))", "│ └─TableFullScan_8 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", "└─TableReader_12(Probe) 10000.00 root data:TableFullScan_11", " └─TableFullScan_11 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 right join t2 on t1.a > t2.a and t2.a = 1", "Result": [ "HashJoin_6 33333333.33 root CARTESIAN right outer join, right cond:eq(test.t2.a, 1)", "├─TableReader_10(Build) 3333.33 root data:Selection_9", "│ └─Selection_9 3333.33 cop[tikv] gt(test.t1.a, 1)", "│ └─TableFullScan_8 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", "└─TableReader_12(Probe) 10000.00 root data:TableFullScan_11", " └─TableFullScan_11 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 left join t2 on t1.a = t2.a and t2.a > 1", "Result": [ "HashJoin_6 10000.00 root left outer join, equal:[eq(test.t1.a, test.t2.a)]", "├─TableReader_12(Build) 3333.33 root data:Selection_11", "│ └─Selection_11 3333.33 cop[tikv] gt(test.t2.a, 1), not(isnull(test.t2.a))", "│ └─TableFullScan_10 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", "└─TableReader_9(Probe) 10000.00 root data:TableFullScan_8", " └─TableFullScan_8 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 left join t2 on t1.a > t2.a and t2.a = 1", "Result": [ "HashJoin_6 100000.00 root CARTESIAN left outer join, other cond:gt(test.t1.a, test.t2.a)", "├─TableReader_12(Build) 10.00 root data:Selection_11", "│ └─Selection_11 10.00 cop[tikv] eq(test.t2.a, 1), not(isnull(test.t2.a))", "│ └─TableFullScan_10 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", "└─TableReader_9(Probe) 10000.00 root data:TableFullScan_8", " └─TableFullScan_8 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 right join t2 on t1.a > t2.a and t1.a = 1", "Result": [ "HashJoin_6 100000.00 root CARTESIAN right outer join, other cond:gt(test.t1.a, test.t2.a)", "├─TableReader_10(Build) 10.00 root data:Selection_9", "│ └─Selection_9 10.00 cop[tikv] eq(test.t1.a, 1), not(isnull(test.t1.a))", "│ └─TableFullScan_8 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", "└─TableReader_12(Probe) 10000.00 root data:TableFullScan_11", " └─TableFullScan_11 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 right join t2 on t1.a = t2.a and t1.a > 1", "Result": [ "HashJoin_6 10000.00 root right outer join, equal:[eq(test.t1.a, test.t2.a)]", "├─TableReader_10(Build) 3333.33 root data:Selection_9", "│ └─Selection_9 3333.33 cop[tikv] gt(test.t1.a, 1), not(isnull(test.t1.a))", "│ └─TableFullScan_8 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", "└─TableReader_12(Probe) 10000.00 root data:TableFullScan_11", " └─TableFullScan_11 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 left join t2 on t1.a = t1.b and t1.a > 1", "Result": [ "HashJoin_6 100000000.00 root CARTESIAN left outer join, left cond:[eq(test.t1.a, test.t1.b) gt(test.t1.a, 1)]", "├─TableReader_11(Build) 10000.00 root data:TableFullScan_10", "│ └─TableFullScan_10 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", "└─TableReader_9(Probe) 10000.00 root data:TableFullScan_8", " └─TableFullScan_8 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 left join t2 on t2.a = t2.b and t2.a > 1", "Result": [ "HashJoin_6 26666666.67 root CARTESIAN left outer join", "├─TableReader_12(Build) 2666.67 root data:Selection_11", "│ └─Selection_11 2666.67 cop[tikv] eq(test.t2.a, test.t2.b), gt(test.t2.a, 1)", "│ └─TableFullScan_10 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", "└─TableReader_9(Probe) 10000.00 root data:TableFullScan_8", " └─TableFullScan_8 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 left join t2 on true where t1.a = 1 and false", "Result": [ "TableDual_8 0.00 root rows:0" ] }, { "SQL": "explain select * from t1 left join t2 on true where t1.a = 1 and null", "Result": [ "TableDual_8 0.00 root rows:0" ] }, { "SQL": "explain select * from t1 left join t2 on true where t1.a = null", "Result": [ "TableDual_8 0.00 root rows:0" ] }, { "SQL": "explain select * from t1 left join t2 on true where t1.a = 1 and t1.a = 2", "Result": [ "TableDual_8 0.00 root rows:0" ] }, { "SQL": "explain select * from t1 left join t2 on true where t1.a = 1 and t1.a = 1", "Result": [ "HashJoin_8 80000.00 root CARTESIAN left outer join", "├─TableReader_11(Build) 10.00 root data:Selection_10", "│ └─Selection_10 10.00 cop[tikv] eq(test.t1.a, 1)", "│ └─TableFullScan_9 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", "└─TableReader_13(Probe) 10000.00 root data:TableFullScan_12", " └─TableFullScan_12 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 left join t2 on false", "Result": [ "HashJoin_6 80000000.00 root CARTESIAN left outer join", "├─TableDual_10(Build) 8000.00 root rows:0", "└─TableReader_9(Probe) 10000.00 root data:TableFullScan_8", " └─TableFullScan_8 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 right join t2 on false", "Result": [ "HashJoin_6 80000000.00 root CARTESIAN right outer join", "├─TableDual_8(Build) 8000.00 root rows:0", "└─TableReader_10(Probe) 10000.00 root data:TableFullScan_9", " └─TableFullScan_9 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 left join t2 on t1.a = 1 and t1.a = 2", "Result": [ "HashJoin_6 80000000.00 root CARTESIAN left outer join", "├─TableDual_10(Build) 8000.00 root rows:0", "└─TableReader_9(Probe) 10000.00 root data:TableFullScan_8", " └─TableFullScan_8 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 left join t2 on t1.a =1 where t1.a = 2", "Result": [ "HashJoin_8 80000.00 root CARTESIAN left outer join", "├─TableReader_11(Build) 10.00 root data:Selection_10", "│ └─Selection_10 10.00 cop[tikv] eq(test.t1.a, 2)", "│ └─TableFullScan_9 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", "└─TableDual_12(Probe) 8000.00 root rows:0" ] }, { "SQL": "explain select * from t1 left join t2 on t2.a = 1 and t2.a = 2", "Result": [ "HashJoin_6 10000.00 root CARTESIAN left outer join", "├─TableReader_12(Build) 0.00 root data:Selection_11", "│ └─Selection_11 0.00 cop[tikv] eq(test.t2.a, 1), eq(test.t2.a, 2)", "│ └─TableFullScan_10 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", "└─TableReader_9(Probe) 10000.00 root data:TableFullScan_8", " └─TableFullScan_8 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 left join t2 on t1.a = 1 or (t1.a = 2 and t1.a = 3)", "Result": [ "HashJoin_6 100000000.00 root CARTESIAN left outer join, left cond:[or(eq(test.t1.a, 1), 0)]", "├─TableReader_11(Build) 10000.00 root data:TableFullScan_10", "│ └─TableFullScan_10 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", "└─TableReader_9(Probe) 10000.00 root data:TableFullScan_8", " └─TableFullScan_8 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 left join t2 on true where t1.a = 1 or (t1.a = 2 and t1.a = 3)", "Result": [ "HashJoin_8 80000.00 root CARTESIAN left outer join", "├─TableReader_11(Build) 10.00 root data:Selection_10", "│ └─Selection_10 10.00 cop[tikv] or(eq(test.t1.a, 1), 0)", "│ └─TableFullScan_9 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", "└─TableReader_13(Probe) 10000.00 root data:TableFullScan_12", " └─TableFullScan_12 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 where t1.b > 1 or t1.b in (select b from t2)", "Result": [ "Projection_7 8000.00 root test.t1.id, test.t1.a, test.t1.b", "└─Selection_8 8000.00 root or(gt(test.t1.b, 1), Column#7)", " └─HashJoin_9 10000.00 root CARTESIAN left outer semi join, other cond:eq(test.t1.b, test.t2.b)", " ├─TableReader_13(Build) 10000.00 root data:TableFullScan_12", " │ └─TableFullScan_12 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", " └─TableReader_11(Probe) 10000.00 root data:TableFullScan_10", " └─TableFullScan_10 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ] }, { "SQL": "explain select * from t1 left join t2 on t1.a = t2.a where ifnull(t2.b, t1.a) = 1", "Result": [ "Selection_7 9990.00 root eq(ifnull(test.t2.b, test.t1.a), 1)", "└─HashJoin_8 12487.50 root left outer join, equal:[eq(test.t1.a, test.t2.a)]", " ├─TableReader_14(Build) 9990.00 root data:Selection_13", " │ └─Selection_13 9990.00 cop[tikv] not(isnull(test.t2.a))", " │ └─TableFullScan_12 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", " └─TableReader_11(Probe) 10000.00 root data:TableFullScan_10", " └─TableFullScan_10 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" ] } ] } ]