[
  {
    "Name": "TestPredicatePushDown",
    "Cases": [
      {
        "SQL": "select a, b from (select a, b from t as t1 order by a) as t2 where t2.b > 10",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b",
          "Group#1 Schema:[test.t.a,test.t.b]",
          "    Projection_2 input:[Group#2], test.t.a, test.t.b",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    TiKVSingleGather_7 input:[Group#3], table:t1",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    Selection_8 input:[Group#4], gt(test.t.b, 10)",
          "Group#4 Schema:[test.t.a,test.t.b]",
          "    TableScan_6 table:t1, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select a, b from (select a, b from t as t1 order by a) as t2 where t2.a > 10",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b",
          "Group#1 Schema:[test.t.a,test.t.b]",
          "    Projection_2 input:[Group#2], test.t.a, test.t.b",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    TiKVSingleGather_7 input:[Group#3], table:t1",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    TableScan_9 table:t1, pk col:test.t.a, cond:[gt(test.t.a, 10)]"
        ]
      },
      {
        "SQL": "select a, b from (select a, b, a+b as a_b from t as t1) as t2 where a_b > 10 and b = 1",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b",
          "Group#1 Schema:[test.t.a,test.t.b,Column#13]",
          "    Projection_2 input:[Group#2], test.t.a, test.t.b, plus(test.t.a, test.t.b)->Column#13",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    TiKVSingleGather_7 input:[Group#3], table:t1",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    Selection_8 input:[Group#4], eq(test.t.b, 1), gt(plus(test.t.a, test.t.b), 10)",
          "Group#4 Schema:[test.t.a,test.t.b]",
          "    TableScan_6 table:t1, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select b, @i:=@i+1 as ii from (select b, @i:=0 from t as t1) as t2 where @i < 10",
        "Result": [
          "Group#0 Schema:[test.t.b,Column#14]",
          "    Projection_4 input:[Group#1], test.t.b, setvar(i, plus(getvar(i), 1))->Column#14",
          "Group#1 Schema:[test.t.b,Column#13]",
          "    Selection_3 input:[Group#2], lt(getvar(\"i\"), 10)",
          "Group#2 Schema:[test.t.b,Column#13]",
          "    Projection_2 input:[Group#3], test.t.b, setvar(i, 0)->Column#13",
          "Group#3 Schema:[test.t.b]",
          "    TiKVSingleGather_6 input:[Group#4], table:t1",
          "Group#4 Schema:[test.t.b]",
          "    TableScan_5 table:t1"
        ]
      },
      {
        "SQL": "select b, @i:=@i+1 as ii from (select a, b, @i:=0 from t as t1) as t2 where @i < 10 and a > 10",
        "Result": [
          "Group#0 Schema:[test.t.b,Column#14]",
          "    Projection_4 input:[Group#1], test.t.b, setvar(i, plus(getvar(i), 1))->Column#14",
          "Group#1 Schema:[test.t.a,test.t.b,Column#13]",
          "    Selection_6 input:[Group#2], lt(getvar(\"i\"), 10)",
          "Group#2 Schema:[test.t.a,test.t.b,Column#13]",
          "    Projection_2 input:[Group#3], test.t.a, test.t.b, setvar(i, 0)->Column#13",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    TiKVSingleGather_8 input:[Group#4], table:t1",
          "Group#4 Schema:[test.t.a,test.t.b]",
          "    TableScan_10 table:t1, pk col:test.t.a, cond:[gt(test.t.a, 10)]"
        ]
      },
      {
        "SQL": "select a, max(b) from t group by a having a > 1",
        "Result": [
          "Group#0 Schema:[test.t.a,Column#13]",
          "    Projection_3 input:[Group#1], test.t.a, Column#13",
          "Group#1 Schema:[Column#13,test.t.a]",
          "    Aggregation_2 input:[Group#2], group by:test.t.a, funcs:max(test.t.b), firstrow(test.t.a)",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    TiKVSingleGather_8 input:[Group#3], table:t",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    TableScan_10 table:t, pk col:test.t.a, cond:[gt(test.t.a, 1)]"
        ]
      },
      {
        "SQL": "select a, avg(b) from t group by a having a > 1 and max(b) > 10",
        "Result": [
          "Group#0 Schema:[test.t.a,Column#16]",
          "    Projection_5 input:[Group#1], test.t.a, Column#13->Column#16",
          "Group#1 Schema:[test.t.a,Column#13,Column#14]",
          "    Projection_3 input:[Group#2], test.t.a, Column#13, Column#14",
          "Group#2 Schema:[Column#13,Column#14,test.t.a]",
          "    Selection_8 input:[Group#3], gt(Column#14, 10)",
          "Group#3 Schema:[Column#13,Column#14,test.t.a]",
          "    Aggregation_2 input:[Group#4], group by:test.t.a, funcs:avg(test.t.b), max(test.t.b), firstrow(test.t.a)",
          "Group#4 Schema:[test.t.a,test.t.b]",
          "    TiKVSingleGather_10 input:[Group#5], table:t",
          "Group#5 Schema:[test.t.a,test.t.b]",
          "    TableScan_12 table:t, pk col:test.t.a, cond:[gt(test.t.a, 1)]"
        ]
      },
      {
        "SQL": "select a, approx_count_distinct(b) from t group by a having a > 1 and max(b) > 10",
        "Result": [
          "Group#0 Schema:[test.t.a,Column#16]",
          "    Projection_5 input:[Group#1], test.t.a, Column#13->Column#16",
          "Group#1 Schema:[test.t.a,Column#13,Column#14]",
          "    Projection_3 input:[Group#2], test.t.a, Column#13, Column#14",
          "Group#2 Schema:[Column#13,Column#14,test.t.a]",
          "    Selection_8 input:[Group#3], gt(Column#14, 10)",
          "Group#3 Schema:[Column#13,Column#14,test.t.a]",
          "    Aggregation_2 input:[Group#4], group by:test.t.a, funcs:approx_count_distinct(test.t.b), max(test.t.b), firstrow(test.t.a)",
          "Group#4 Schema:[test.t.a,test.t.b]",
          "    TiKVSingleGather_10 input:[Group#5], table:t",
          "Group#5 Schema:[test.t.a,test.t.b]",
          "    TableScan_12 table:t, pk col:test.t.a, cond:[gt(test.t.a, 1)]"
        ]
      },
      {
        "SQL": "select t1.a, t1.b, t2.b from t t1, t t2 where t1.a = t2.a and t2.b = t1.b and t1.a > 10 and t2.b > 10 and t1.a > t2.b",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.b]",
          "    Projection_5 input:[Group#1], test.t.a, test.t.b, test.t.b",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.a,test.t.b]",
          "    Join_9 input:[Group#2,Group#3], inner join, equal:[eq(test.t.a, test.t.a) eq(test.t.b, test.t.b)], other cond:gt(test.t.a, test.t.b)",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    TiKVSingleGather_15 input:[Group#4], table:t1",
          "Group#4 Schema:[test.t.a,test.t.b]",
          "    Selection_18 input:[Group#5], gt(test.t.a, test.t.b), gt(test.t.a, test.t.b), gt(test.t.b, 10)",
          "Group#5 Schema:[test.t.a,test.t.b]",
          "    TableScan_17 table:t1, pk col:test.t.a, cond:[gt(test.t.a, 10)]",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    TiKVSingleGather_20 input:[Group#6], table:t2",
          "Group#6 Schema:[test.t.a,test.t.b]",
          "    Selection_23 input:[Group#7], gt(test.t.a, test.t.b), gt(test.t.a, test.t.b), gt(test.t.b, 10)",
          "Group#7 Schema:[test.t.a,test.t.b]",
          "    TableScan_22 table:t2, pk col:test.t.a, cond:[gt(test.t.a, 10)]"
        ]
      },
      {
        "SQL": "select t1.a, t1.b from t t1, t t2 where t1.a = t2.a and t1.a = 10 and t2.a = 5",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b]",
          "    Projection_5 input:[Group#1], test.t.a, test.t.b",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.a]",
          "    TableDual_7 rowcount:0"
        ]
      },
      {
        "SQL": "select a, f from t where f > 1",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.f]",
          "    Projection_3 input:[Group#1], test.t.a, test.t.f",
          "Group#1 Schema:[test.t.a,test.t.f]",
          "    TiKVSingleGather_5 input:[Group#2], table:t",
          "    TiKVSingleGather_7 input:[Group#3], table:t, index:f",
          "    TiKVSingleGather_9 input:[Group#4], table:t, index:f_g",
          "Group#2 Schema:[test.t.a,test.t.f]",
          "    Selection_10 input:[Group#5], gt(test.t.f, 1)",
          "Group#5 Schema:[test.t.a,test.t.f]",
          "    TableScan_4 table:t, pk col:test.t.a",
          "Group#3 Schema:[test.t.a,test.t.f]",
          "    IndexScan_13 table:t, index:f, cond:[gt(test.t.f, 1)]",
          "Group#4 Schema:[test.t.a,test.t.f]",
          "    IndexScan_14 table:t, index:f, g, cond:[gt(test.t.f, 1)]"
        ]
      },
      {
        "SQL": "select a, f from (select a, f, g from t where f = 1) t1 where g > 1",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.f]",
          "    Projection_5 input:[Group#1], test.t.a, test.t.f",
          "Group#1 Schema:[test.t.a,test.t.f,test.t.g]",
          "    Projection_3 input:[Group#2], test.t.a, test.t.f, test.t.g",
          "Group#2 Schema:[test.t.a,test.t.f,test.t.g]",
          "    TiKVSingleGather_9 input:[Group#3], table:t",
          "    TiKVSingleGather_11 input:[Group#4], table:t, index:f_g",
          "Group#3 Schema:[test.t.a,test.t.f,test.t.g]",
          "    Selection_12 input:[Group#5], eq(test.t.f, 1), gt(test.t.g, 1)",
          "Group#5 Schema:[test.t.a,test.t.f,test.t.g]",
          "    TableScan_8 table:t, pk col:test.t.a",
          "Group#4 Schema:[test.t.a,test.t.f,test.t.g]",
          "    IndexScan_14 table:t, index:f, g, cond:[eq(test.t.f, 1) gt(test.t.g, 1)]"
        ]
      },
      {
        "SQL": "select a, f from t where g > 1 and f > 1",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.f]",
          "    Projection_3 input:[Group#1], test.t.a, test.t.f",
          "Group#1 Schema:[test.t.a,test.t.f,test.t.g]",
          "    TiKVSingleGather_5 input:[Group#2], table:t",
          "    TiKVSingleGather_7 input:[Group#3], table:t, index:f_g",
          "Group#2 Schema:[test.t.a,test.t.f,test.t.g]",
          "    Selection_8 input:[Group#4], gt(test.t.f, 1), gt(test.t.g, 1)",
          "Group#4 Schema:[test.t.a,test.t.f,test.t.g]",
          "    TableScan_4 table:t, pk col:test.t.a",
          "Group#3 Schema:[test.t.a,test.t.f,test.t.g]",
          "    Selection_11 input:[Group#5], gt(test.t.g, 1)",
          "Group#5 Schema:[test.t.a,test.t.f,test.t.g]",
          "    IndexScan_10 table:t, index:f, g, cond:[gt(test.t.f, 1)]"
        ]
      },
      {
        "SQL": "select t1.a, t1.b from t t1, t t2 where t1.a = t2.a and t1.a = 10 and t2.a = 5",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b]",
          "    Projection_5 input:[Group#1], test.t.a, test.t.b",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.a]",
          "    TableDual_7 rowcount:0"
        ]
      },
      {
        "SQL": "select a, b from ((select a, b from t) union all(select c as a, d as b from t)) as t1 where a > 1",
        "Result": [
          "Group#0 Schema:[Column#25,Column#26]",
          "    Projection_9 input:[Group#1], Column#25, Column#26",
          "Group#1 Schema:[Column#25,Column#26]",
          "    Union_5 input:[Group#2,Group#3]",
          "Group#2 Schema:[Column#25,Column#26]",
          "    Projection_6 input:[Group#4], test.t.a->Column#25, test.t.b->Column#26",
          "Group#4 Schema:[test.t.a,test.t.b]",
          "    Projection_2 input:[Group#5], test.t.a, test.t.b",
          "Group#5 Schema:[test.t.a,test.t.b]",
          "    TiKVSingleGather_15 input:[Group#6], table:t",
          "Group#6 Schema:[test.t.a,test.t.b]",
          "    TableScan_17 table:t, pk col:test.t.a, cond:[gt(test.t.a, 1)]",
          "Group#3 Schema:[Column#25,Column#26]",
          "    Projection_7 input:[Group#7], test.t.c->Column#25, test.t.d->Column#26",
          "Group#7 Schema:[test.t.c,test.t.d]",
          "    Projection_4 input:[Group#8], test.t.c, test.t.d",
          "Group#8 Schema:[test.t.c,test.t.d]",
          "    TiKVSingleGather_19 input:[Group#9], table:t",
          "    TiKVSingleGather_21 input:[Group#10], table:t, index:c_d_e",
          "Group#9 Schema:[test.t.c,test.t.d]",
          "    Selection_22 input:[Group#11], gt(test.t.c, 1)",
          "Group#11 Schema:[test.t.c,test.t.d]",
          "    TableScan_18 table:t",
          "Group#10 Schema:[test.t.c,test.t.d]",
          "    IndexScan_24 table:t, index:c, d, e, cond:[gt(test.t.c, 1)]"
        ]
      },
      {
        "SQL": "select a, b from (select a, b, min(a) over(partition by b) as min_a from t)as tt where a < 10 and b > 10 and b = min_a",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b]",
          "    Projection_7 input:[Group#1], test.t.a, test.t.b",
          "Group#1 Schema:[test.t.a,test.t.b,Column#14]",
          "    Projection_5 input:[Group#2], test.t.a, test.t.b, Column#14",
          "Group#2 Schema:[test.t.a,test.t.b,Column#14]",
          "    Selection_10 input:[Group#3], eq(test.t.b, Column#14), lt(test.t.a, 10)",
          "Group#3 Schema:[test.t.a,test.t.b,Column#14]",
          "    Window_4 input:[Group#4]",
          "Group#4 Schema:[test.t.a,test.t.b]",
          "    Projection_3 input:[Group#5], test.t.a, test.t.b",
          "Group#5 Schema:[test.t.a,test.t.b]",
          "    Projection_2 input:[Group#6], test.t.a, test.t.b",
          "Group#6 Schema:[test.t.a,test.t.b]",
          "    TiKVSingleGather_14 input:[Group#7], table:t",
          "Group#7 Schema:[test.t.a,test.t.b]",
          "    Selection_15 input:[Group#8], gt(test.t.b, 10)",
          "Group#8 Schema:[test.t.a,test.t.b]",
          "    TableScan_13 table:t, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select b, c from (select b, c from t where b > 1 and c > 1) as t1 where b > 2 and c > 2",
        "Result": [
          "Group#0 Schema:[test.t.b,test.t.c]",
          "    Projection_5 input:[Group#1], test.t.b, test.t.c",
          "Group#1 Schema:[test.t.b,test.t.c]",
          "    Projection_3 input:[Group#2], test.t.b, test.t.c",
          "Group#2 Schema:[test.t.b,test.t.c]",
          "    TiKVSingleGather_9 input:[Group#3], table:t",
          "Group#3 Schema:[test.t.b,test.t.c]",
          "    Selection_10 input:[Group#4], gt(test.t.b, 1), gt(test.t.b, 2), gt(test.t.c, 1), gt(test.t.c, 2)",
          "Group#4 Schema:[test.t.b,test.t.c]",
          "    TableScan_8 table:t"
        ]
      },
      {
        "SQL": "select * from t t1 join t t2 on t1.a = t2.a and t1.a > 2",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Projection_5 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date, test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Join_9 input:[Group#2,Group#3], inner join, equal:[eq(test.t.a, test.t.a)]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_11 input:[Group#4], table:t1",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_13 table:t1, pk col:test.t.a, cond:[gt(test.t.a, 2)]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_15 input:[Group#5], table:t2",
          "Group#5 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_17 table:t2, pk col:test.t.a, cond:[gt(test.t.a, 2)]"
        ]
      }
    ]
  },
  {
    "Name": "TestAggPushDownGather",
    "Cases": [
      {
        "SQL": "select b, sum(a) from t group by b",
        "Result": [
          "Group#0 Schema:[test.t.b,Column#13], UniqueKey:[test.t.b]",
          "    Projection_3 input:[Group#1], test.t.b, Column#13",
          "Group#1 Schema:[Column#13,test.t.b], UniqueKey:[test.t.b]",
          "    Aggregation_2 input:[Group#2], group by:test.t.b, funcs:sum(test.t.a), firstrow(test.t.b)",
          "    Aggregation_7 input:[Group#3], group by:test.t.b, funcs:sum(Column#14), firstrow(test.t.b)",
          "Group#2 Schema:[test.t.a,test.t.b], UniqueKey:[test.t.a]",
          "    TiKVSingleGather_5 input:[Group#4], table:t",
          "Group#4 Schema:[test.t.a,test.t.b], UniqueKey:[test.t.a]",
          "    TableScan_4 table:t, pk col:test.t.a",
          "Group#3 Schema:[Column#14,test.t.b]",
          "    TiKVSingleGather_5 input:[Group#5], table:t",
          "Group#5 Schema:[Column#14,test.t.b]",
          "    Aggregation_6 input:[Group#4], group by:test.t.b, funcs:sum(test.t.a)"
        ]
      },
      {
        "SQL": "select b, sum(a) from t group by c, b",
        "Result": [
          "Group#0 Schema:[test.t.b,Column#13]",
          "    Projection_3 input:[Group#1], test.t.b, Column#13",
          "Group#1 Schema:[Column#13,test.t.b]",
          "    Aggregation_2 input:[Group#2], group by:test.t.b, test.t.c, funcs:sum(test.t.a), firstrow(test.t.b)",
          "    Aggregation_7 input:[Group#3], group by:test.t.b, test.t.c, funcs:sum(Column#14), firstrow(test.t.b)",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c], UniqueKey:[test.t.a]",
          "    TiKVSingleGather_5 input:[Group#4], table:t",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c], UniqueKey:[test.t.a]",
          "    TableScan_4 table:t, pk col:test.t.a",
          "Group#3 Schema:[Column#14,test.t.c,test.t.b]",
          "    TiKVSingleGather_5 input:[Group#5], table:t",
          "Group#5 Schema:[Column#14,test.t.c,test.t.b]",
          "    Aggregation_6 input:[Group#4], group by:test.t.b, test.t.c, funcs:sum(test.t.a)"
        ]
      },
      {
        "SQL": "select b, sum(a) from t group by sin(b)+sin(c), b",
        "Result": [
          "Group#0 Schema:[test.t.b,Column#13]",
          "    Projection_3 input:[Group#1], test.t.b, Column#13",
          "Group#1 Schema:[Column#13,test.t.b]",
          "    Aggregation_2 input:[Group#2], group by:plus(sin(cast(test.t.b, double BINARY)), sin(cast(test.t.c, double BINARY))), test.t.b, funcs:sum(test.t.a), firstrow(test.t.b)",
          "    Aggregation_7 input:[Group#3], group by:Column#14, test.t.b, funcs:sum(Column#15), firstrow(test.t.b)",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c], UniqueKey:[test.t.a]",
          "    TiKVSingleGather_5 input:[Group#4], table:t",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c], UniqueKey:[test.t.a]",
          "    TableScan_4 table:t, pk col:test.t.a",
          "Group#3 Schema:[Column#15,Column#14,test.t.b]",
          "    TiKVSingleGather_5 input:[Group#5], table:t",
          "Group#5 Schema:[Column#15,Column#14,test.t.b]",
          "    Aggregation_6 input:[Group#4], group by:plus(sin(cast(test.t.b, double BINARY)), sin(cast(test.t.c, double BINARY))), test.t.b, funcs:sum(test.t.a)"
        ]
      }
    ]
  },
  {
    "Name": "TestTopNRules",
    "Cases": [
      {
        "SQL": "select b from t order by a limit 2",
        "Result": [
          "Group#0 Schema:[test.t.b]",
          "    Projection_5 input:[Group#1], test.t.b",
          "Group#1 Schema:[test.t.b]",
          "    Projection_2 input:[Group#2], test.t.b, test.t.a",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    TopN_7 input:[Group#3], test.t.a, offset:0, count:2",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    TiKVSingleGather_9 input:[Group#4], table:t",
          "Group#4 Schema:[test.t.a,test.t.b]",
          "    TopN_10 input:[Group#5], test.t.a, offset:0, count:2",
          "Group#5 Schema:[test.t.a,test.t.b]",
          "    TableScan_8 table:t, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select b from t limit 2",
        "Result": [
          "Group#0 Schema:[test.t.b]",
          "    Projection_2 input:[Group#1], test.t.b",
          "Group#1 Schema:[test.t.b]",
          "    Limit_3 input:[Group#2], offset:0, count:2",
          "Group#2 Schema:[test.t.b]",
          "    TiKVSingleGather_5 input:[Group#3], table:t",
          "Group#3 Schema:[test.t.b]",
          "    Limit_6 input:[Group#4], offset:0, count:2",
          "Group#4 Schema:[test.t.b]",
          "    TableScan_4 table:t"
        ]
      },
      {
        "SQL": "select a+b from t order by a limit 1 offset 2",
        "Result": [
          "Group#0 Schema:[Column#14]",
          "    Projection_5 input:[Group#1], Column#13->Column#14",
          "Group#1 Schema:[Column#13]",
          "    Projection_2 input:[Group#2], plus(test.t.a, test.t.b)->Column#13, test.t.a",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    TopN_7 input:[Group#3], test.t.a, offset:2, count:1",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    TiKVSingleGather_9 input:[Group#4], table:t",
          "Group#4 Schema:[test.t.a,test.t.b]",
          "    TopN_10 input:[Group#5], test.t.a, offset:0, count:3",
          "Group#5 Schema:[test.t.a,test.t.b]",
          "    TableScan_8 table:t, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select c from t order by t.a limit 1",
        "Result": [
          "Group#0 Schema:[test.t.c]",
          "    Projection_5 input:[Group#1], test.t.c",
          "Group#1 Schema:[test.t.c]",
          "    Projection_2 input:[Group#2], test.t.c, test.t.a",
          "Group#2 Schema:[test.t.a,test.t.c]",
          "    TopN_7 input:[Group#3], test.t.a, offset:0, count:1",
          "    TopN_7 input:[Group#4], test.t.a, offset:0, count:1",
          "Group#3 Schema:[test.t.a,test.t.c]",
          "    TiKVSingleGather_11 input:[Group#5], table:t, index:c_d_e",
          "Group#5 Schema:[test.t.a,test.t.c]",
          "    TopN_13 input:[Group#6], test.t.a, offset:0, count:1",
          "Group#6 Schema:[test.t.a,test.t.c]",
          "    IndexScan_10 table:t, index:c, d, e",
          "Group#4 Schema:[test.t.a,test.t.c]",
          "    TiKVSingleGather_9 input:[Group#7], table:t",
          "Group#7 Schema:[test.t.a,test.t.c]",
          "    TopN_12 input:[Group#8], test.t.a, offset:0, count:1",
          "Group#8 Schema:[test.t.a,test.t.c]",
          "    TableScan_8 table:t, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select c from t order by t.a + t.b limit 1",
        "Result": [
          "Group#0 Schema:[test.t.c]",
          "    Projection_5 input:[Group#1], test.t.c",
          "Group#1 Schema:[test.t.c]",
          "    Projection_2 input:[Group#2], test.t.c, test.t.a, test.t.b",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c]",
          "    TopN_7 input:[Group#3], plus(test.t.a, test.t.b), offset:0, count:1",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c]",
          "    TiKVSingleGather_9 input:[Group#4], table:t",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c]",
          "    TopN_10 input:[Group#5], plus(test.t.a, test.t.b), offset:0, count:1",
          "Group#5 Schema:[test.t.a,test.t.b,test.t.c]",
          "    TableScan_8 table:t, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select a, b, c from t t1 where t1.a in (select t2.a as a from t t2 where t2.b > t1.b order by t1.b limit 1)",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c]",
          "    Projection_9 input:[Group#1], test.t.a, test.t.b, test.t.c",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c]",
          "    Apply_8 input:[Group#2,Group#3], semi join, equal:[eq(test.t.a, test.t.a)]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c]",
          "    TiKVSingleGather_13 input:[Group#4], table:t1",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c]",
          "    TableScan_12 table:t1, pk col:test.t.a",
          "Group#3 Schema:[test.t.a]",
          "    Projection_5 input:[Group#5], test.t.a",
          "Group#5 Schema:[test.t.a,test.t.b]",
          "    TopN_11 input:[Group#6], , offset:0, count:1",
          "Group#6 Schema:[test.t.a,test.t.b]",
          "    Selection_4 input:[Group#7], gt(test.t.b, test.t.b)",
          "Group#7 Schema:[test.t.a,test.t.b]",
          "    TiKVSingleGather_15 input:[Group#8], table:t2",
          "Group#8 Schema:[test.t.a,test.t.b]",
          "    TableScan_14 table:t2, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select a, b, c from t t1 where t1.a in (select a from (select t2.a as a, t1.b as b from t t2 where t2.b > t1.b) x order by b limit 1)",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c]",
          "    Projection_11 input:[Group#1], test.t.a, test.t.b, test.t.c",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c]",
          "    Apply_10 input:[Group#2,Group#3], semi join, equal:[eq(test.t.a, test.t.a)]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c]",
          "    TiKVSingleGather_16 input:[Group#4], table:t1",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c]",
          "    TableScan_15 table:t1, pk col:test.t.a",
          "Group#3 Schema:[test.t.a]",
          "    Projection_9 input:[Group#5], test.t.a",
          "Group#5 Schema:[test.t.a]",
          "    Projection_6 input:[Group#6], test.t.a, Column#25",
          "Group#6 Schema:[test.t.a,Column#25]",
          "    Projection_5 input:[Group#7], test.t.a, test.t.b->Column#25",
          "Group#7 Schema:[test.t.a,test.t.b]",
          "    TopN_14 input:[Group#8], test.t.b, offset:0, count:1",
          "Group#8 Schema:[test.t.a,test.t.b]",
          "    Selection_4 input:[Group#9], gt(test.t.b, test.t.b)",
          "Group#9 Schema:[test.t.a,test.t.b]",
          "    TiKVSingleGather_18 input:[Group#10], table:t2",
          "Group#10 Schema:[test.t.a,test.t.b]",
          "    TableScan_17 table:t2, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select a, b from (select @i as a, @i := @i+1 as b from t) t order by a desc limit 1",
        "Result": [
          "Group#0 Schema:[Column#13,Column#14]",
          "    Projection_3 input:[Group#1], Column#13, Column#14",
          "Group#1 Schema:[Column#13,Column#14]",
          "    TopN_7 input:[Group#2], Column#13:desc, offset:0, count:1",
          "Group#2 Schema:[Column#13,Column#14]",
          "    Projection_2 input:[Group#3], getvar(i)->Column#13, setvar(i, plus(getvar(i), 1))->Column#14",
          "Group#3 Schema:[test.t.a]",
          "    TiKVSingleGather_9 input:[Group#4], table:t",
          "    TiKVSingleGather_21 input:[Group#5], table:t, index:e_d_c_str_prefix",
          "    TiKVSingleGather_19 input:[Group#6], table:t, index:c_d_e_str",
          "    TiKVSingleGather_17 input:[Group#7], table:t, index:f_g",
          "    TiKVSingleGather_15 input:[Group#8], table:t, index:g",
          "    TiKVSingleGather_13 input:[Group#9], table:t, index:f",
          "    TiKVSingleGather_11 input:[Group#10], table:t, index:c_d_e",
          "Group#4 Schema:[test.t.a]",
          "    TableScan_8 table:t, pk col:test.t.a",
          "Group#5 Schema:[test.t.a]",
          "    IndexScan_20 table:t, index:e_str, d_str, c_str",
          "Group#6 Schema:[test.t.a]",
          "    IndexScan_18 table:t, index:c_str, d_str, e_str",
          "Group#7 Schema:[test.t.a]",
          "    IndexScan_16 table:t, index:f, g",
          "Group#8 Schema:[test.t.a]",
          "    IndexScan_14 table:t, index:g",
          "Group#9 Schema:[test.t.a]",
          "    IndexScan_12 table:t, index:f",
          "Group#10 Schema:[test.t.a]",
          "    IndexScan_10 table:t, index:c, d, e"
        ]
      },
      {
        "SQL": "select * from t t1 left join t t2 on t1.b = t2.b order by t1.b limit 1",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date, test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TopN_8 input:[Group#2], test.t.b, offset:0, count:1",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Join_3 input:[Group#3,Group#4], left outer join, equal:[eq(test.t.b, test.t.b)]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TopN_9 input:[Group#5], test.t.b, offset:0, count:1",
          "Group#5 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_11 input:[Group#6], table:t1",
          "Group#6 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TopN_12 input:[Group#7], test.t.b, offset:0, count:1",
          "Group#7 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_10 table:t1, pk col:test.t.a",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_14 input:[Group#8], table:t2",
          "Group#8 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_13 table:t2, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select * from t t1 left join t t2 on t1.b = t2.b order by t1.a, t1.c limit 1",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date, test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TopN_8 input:[Group#2], test.t.a, test.t.c, offset:0, count:1",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Join_3 input:[Group#3,Group#4], left outer join, equal:[eq(test.t.b, test.t.b)]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TopN_9 input:[Group#5], test.t.a, test.t.c, offset:0, count:1",
          "Group#5 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_11 input:[Group#6], table:t1",
          "Group#6 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TopN_12 input:[Group#7], test.t.a, test.t.c, offset:0, count:1",
          "Group#7 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_10 table:t1, pk col:test.t.a",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_14 input:[Group#8], table:t2",
          "Group#8 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_13 table:t2, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select * from t t1 left join t t2 on t1.b = t2.b order by t2.a, t2.c limit 1",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date, test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TopN_8 input:[Group#2], test.t.a, test.t.c, offset:0, count:1",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Join_3 input:[Group#3,Group#4], left outer join, equal:[eq(test.t.b, test.t.b)]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_10 input:[Group#5], table:t1",
          "Group#5 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_9 table:t1, pk col:test.t.a",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_12 input:[Group#6], table:t2",
          "Group#6 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_11 table:t2, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select * from t t1 left join t t2 on t1.b = t2.b order by t1.a, t2.c limit 1",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date, test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TopN_8 input:[Group#2], test.t.a, test.t.c, offset:0, count:1",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Join_3 input:[Group#3,Group#4], left outer join, equal:[eq(test.t.b, test.t.b)]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_10 input:[Group#5], table:t1",
          "Group#5 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_9 table:t1, pk col:test.t.a",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_12 input:[Group#6], table:t2",
          "Group#6 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_11 table:t2, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select * from t t1 right join t t2 on t1.b = t2.b order by t1.a, t1.c limit 1",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date, test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TopN_8 input:[Group#2], test.t.a, test.t.c, offset:0, count:1",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Join_3 input:[Group#3,Group#4], right outer join, equal:[eq(test.t.b, test.t.b)]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_10 input:[Group#5], table:t1",
          "Group#5 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_9 table:t1, pk col:test.t.a",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_12 input:[Group#6], table:t2",
          "Group#6 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_11 table:t2, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select * from t t1 right join t t2 on t1.b = t2.b order by t2.a, t2.c limit 1",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date, test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TopN_8 input:[Group#2], test.t.a, test.t.c, offset:0, count:1",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Join_3 input:[Group#3,Group#4], right outer join, equal:[eq(test.t.b, test.t.b)]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_11 input:[Group#5], table:t1",
          "Group#5 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_10 table:t1, pk col:test.t.a",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TopN_9 input:[Group#6], test.t.a, test.t.c, offset:0, count:1",
          "Group#6 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_13 input:[Group#7], table:t2",
          "Group#7 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TopN_14 input:[Group#8], test.t.a, test.t.c, offset:0, count:1",
          "Group#8 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_12 table:t2, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select * from t t1 right join t t2 on t1.b = t2.b order by t1.a, t2.c limit 1",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date, test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TopN_8 input:[Group#2], test.t.a, test.t.c, offset:0, count:1",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Join_3 input:[Group#3,Group#4], right outer join, equal:[eq(test.t.b, test.t.b)]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_10 input:[Group#5], table:t1",
          "Group#5 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_9 table:t1, pk col:test.t.a",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_12 input:[Group#6], table:t2",
          "Group#6 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_11 table:t2, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select * from t t1 left join t t2 on t1.b = t2.b limit 1",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date, test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Limit_5 input:[Group#2], offset:0, count:1",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Join_3 input:[Group#3,Group#4], left outer join, equal:[eq(test.t.b, test.t.b)]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Limit_6 input:[Group#5], offset:0, count:1",
          "Group#5 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_8 input:[Group#6], table:t1",
          "Group#6 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Limit_9 input:[Group#7], offset:0, count:1",
          "Group#7 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_7 table:t1, pk col:test.t.a",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_11 input:[Group#8], table:t2",
          "Group#8 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_10 table:t2, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select * from t t1 left join t t2 on t1.b = t2.b limit 5 offset 4",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date, test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Limit_5 input:[Group#2], offset:4, count:5",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Join_3 input:[Group#3,Group#4], left outer join, equal:[eq(test.t.b, test.t.b)]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Limit_6 input:[Group#5], offset:0, count:9",
          "Group#5 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_8 input:[Group#6], table:t1",
          "Group#6 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Limit_9 input:[Group#7], offset:0, count:9",
          "Group#7 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_7 table:t1, pk col:test.t.a",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_11 input:[Group#8], table:t2",
          "Group#8 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_10 table:t2, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select * from t t1 right join t t2 on t1.b = t2.b limit 1",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date, test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Limit_5 input:[Group#2], offset:0, count:1",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Join_3 input:[Group#3,Group#4], right outer join, equal:[eq(test.t.b, test.t.b)]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_8 input:[Group#5], table:t1",
          "Group#5 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_7 table:t1, pk col:test.t.a",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Limit_6 input:[Group#6], offset:0, count:1",
          "Group#6 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_10 input:[Group#7], table:t2",
          "Group#7 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Limit_11 input:[Group#8], offset:0, count:1",
          "Group#8 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_9 table:t2, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select * from t t1 right join t t2 on t1.b = t2.b limit 5 offset 4",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date, test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Limit_5 input:[Group#2], offset:4, count:5",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Join_3 input:[Group#3,Group#4], right outer join, equal:[eq(test.t.b, test.t.b)]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_8 input:[Group#5], table:t1",
          "Group#5 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_7 table:t1, pk col:test.t.a",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Limit_6 input:[Group#6], offset:0, count:9",
          "Group#6 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_10 input:[Group#7], table:t2",
          "Group#7 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Limit_11 input:[Group#8], offset:0, count:9",
          "Group#8 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_9 table:t2, pk col:test.t.a"
        ]
      },
      {
        "SQL": "(select a from t) union all (select b from t) order by a limit 2;",
        "Result": [
          "Group#0 Schema:[Column#25]",
          "    TopN_10 input:[Group#1], Column#25, offset:0, count:2",
          "Group#1 Schema:[Column#25]",
          "    Union_5 input:[Group#2,Group#3]",
          "Group#2 Schema:[Column#25]",
          "    Projection_6 input:[Group#4], test.t.a->Column#25",
          "Group#4 Schema:[test.t.a]",
          "    Projection_2 input:[Group#5], test.t.a",
          "Group#5 Schema:[test.t.a]",
          "    TopN_13 input:[Group#6], test.t.a, offset:0, count:2",
          "    TopN_13 input:[Group#7], test.t.a, offset:0, count:2",
          "    TopN_13 input:[Group#8], test.t.a, offset:0, count:2",
          "    TopN_13 input:[Group#9], test.t.a, offset:0, count:2",
          "    TopN_13 input:[Group#10], test.t.a, offset:0, count:2",
          "    TopN_13 input:[Group#11], test.t.a, offset:0, count:2",
          "    TopN_13 input:[Group#12], test.t.a, offset:0, count:2",
          "Group#6 Schema:[test.t.a]",
          "    TiKVSingleGather_19 input:[Group#13], table:t, index:c_d_e",
          "Group#13 Schema:[test.t.a]",
          "    TopN_36 input:[Group#14], test.t.a, offset:0, count:2",
          "Group#14 Schema:[test.t.a]",
          "    IndexScan_18 table:t, index:c, d, e",
          "Group#7 Schema:[test.t.a]",
          "    TiKVSingleGather_21 input:[Group#15], table:t, index:f",
          "Group#15 Schema:[test.t.a]",
          "    TopN_35 input:[Group#16], test.t.a, offset:0, count:2",
          "Group#16 Schema:[test.t.a]",
          "    IndexScan_20 table:t, index:f",
          "Group#8 Schema:[test.t.a]",
          "    TiKVSingleGather_23 input:[Group#17], table:t, index:g",
          "Group#17 Schema:[test.t.a]",
          "    TopN_34 input:[Group#18], test.t.a, offset:0, count:2",
          "Group#18 Schema:[test.t.a]",
          "    IndexScan_22 table:t, index:g",
          "Group#9 Schema:[test.t.a]",
          "    TiKVSingleGather_25 input:[Group#19], table:t, index:f_g",
          "Group#19 Schema:[test.t.a]",
          "    TopN_33 input:[Group#20], test.t.a, offset:0, count:2",
          "Group#20 Schema:[test.t.a]",
          "    IndexScan_24 table:t, index:f, g",
          "Group#10 Schema:[test.t.a]",
          "    TiKVSingleGather_27 input:[Group#21], table:t, index:c_d_e_str",
          "Group#21 Schema:[test.t.a]",
          "    TopN_32 input:[Group#22], test.t.a, offset:0, count:2",
          "Group#22 Schema:[test.t.a]",
          "    IndexScan_26 table:t, index:c_str, d_str, e_str",
          "Group#11 Schema:[test.t.a]",
          "    TiKVSingleGather_29 input:[Group#23], table:t, index:e_d_c_str_prefix",
          "Group#23 Schema:[test.t.a]",
          "    TopN_31 input:[Group#24], test.t.a, offset:0, count:2",
          "Group#24 Schema:[test.t.a]",
          "    IndexScan_28 table:t, index:e_str, d_str, c_str",
          "Group#12 Schema:[test.t.a]",
          "    TiKVSingleGather_17 input:[Group#25], table:t",
          "Group#25 Schema:[test.t.a]",
          "    TopN_30 input:[Group#26], test.t.a, offset:0, count:2",
          "Group#26 Schema:[test.t.a]",
          "    TableScan_16 table:t, pk col:test.t.a",
          "Group#3 Schema:[Column#25]",
          "    Projection_7 input:[Group#27], test.t.b->Column#25",
          "Group#27 Schema:[test.t.b]",
          "    Projection_4 input:[Group#28], test.t.b",
          "Group#28 Schema:[test.t.b]",
          "    TopN_15 input:[Group#29], test.t.b, offset:0, count:2",
          "Group#29 Schema:[test.t.b]",
          "    TiKVSingleGather_38 input:[Group#30], table:t",
          "Group#30 Schema:[test.t.b]",
          "    TopN_39 input:[Group#31], test.t.b, offset:0, count:2",
          "Group#31 Schema:[test.t.b]",
          "    TableScan_37 table:t"
        ]
      },
      {
        "SQL": "(select a from t) union all (select b from t) limit 2;",
        "Result": [
          "Group#0 Schema:[Column#25]",
          "    Limit_8 input:[Group#1], offset:0, count:2",
          "Group#1 Schema:[Column#25]",
          "    Union_5 input:[Group#2,Group#3]",
          "Group#2 Schema:[Column#25]",
          "    Projection_6 input:[Group#4], test.t.a->Column#25",
          "Group#4 Schema:[test.t.a]",
          "    Projection_2 input:[Group#5], test.t.a",
          "Group#5 Schema:[test.t.a]",
          "    Limit_9 input:[Group#6], offset:0, count:2",
          "    Limit_9 input:[Group#7], offset:0, count:2",
          "    Limit_9 input:[Group#8], offset:0, count:2",
          "    Limit_9 input:[Group#9], offset:0, count:2",
          "    Limit_9 input:[Group#10], offset:0, count:2",
          "    Limit_9 input:[Group#11], offset:0, count:2",
          "    Limit_9 input:[Group#12], offset:0, count:2",
          "Group#6 Schema:[test.t.a]",
          "    TiKVSingleGather_13 input:[Group#13], table:t, index:c_d_e",
          "Group#13 Schema:[test.t.a]",
          "    Limit_30 input:[Group#14], offset:0, count:2",
          "Group#14 Schema:[test.t.a]",
          "    IndexScan_12 table:t, index:c, d, e",
          "Group#7 Schema:[test.t.a]",
          "    TiKVSingleGather_15 input:[Group#15], table:t, index:f",
          "Group#15 Schema:[test.t.a]",
          "    Limit_29 input:[Group#16], offset:0, count:2",
          "Group#16 Schema:[test.t.a]",
          "    IndexScan_14 table:t, index:f",
          "Group#8 Schema:[test.t.a]",
          "    TiKVSingleGather_17 input:[Group#17], table:t, index:g",
          "Group#17 Schema:[test.t.a]",
          "    Limit_28 input:[Group#18], offset:0, count:2",
          "Group#18 Schema:[test.t.a]",
          "    IndexScan_16 table:t, index:g",
          "Group#9 Schema:[test.t.a]",
          "    TiKVSingleGather_19 input:[Group#19], table:t, index:f_g",
          "Group#19 Schema:[test.t.a]",
          "    Limit_27 input:[Group#20], offset:0, count:2",
          "Group#20 Schema:[test.t.a]",
          "    IndexScan_18 table:t, index:f, g",
          "Group#10 Schema:[test.t.a]",
          "    TiKVSingleGather_21 input:[Group#21], table:t, index:c_d_e_str",
          "Group#21 Schema:[test.t.a]",
          "    Limit_26 input:[Group#22], offset:0, count:2",
          "Group#22 Schema:[test.t.a]",
          "    IndexScan_20 table:t, index:c_str, d_str, e_str",
          "Group#11 Schema:[test.t.a]",
          "    TiKVSingleGather_23 input:[Group#23], table:t, index:e_d_c_str_prefix",
          "Group#23 Schema:[test.t.a]",
          "    Limit_25 input:[Group#24], offset:0, count:2",
          "Group#24 Schema:[test.t.a]",
          "    IndexScan_22 table:t, index:e_str, d_str, c_str",
          "Group#12 Schema:[test.t.a]",
          "    TiKVSingleGather_11 input:[Group#25], table:t",
          "Group#25 Schema:[test.t.a]",
          "    Limit_24 input:[Group#26], offset:0, count:2",
          "Group#26 Schema:[test.t.a]",
          "    TableScan_10 table:t, pk col:test.t.a",
          "Group#3 Schema:[Column#25]",
          "    Projection_7 input:[Group#27], test.t.b->Column#25",
          "Group#27 Schema:[test.t.b]",
          "    Projection_4 input:[Group#28], test.t.b",
          "Group#28 Schema:[test.t.b]",
          "    Limit_9 input:[Group#29], offset:0, count:2",
          "Group#29 Schema:[test.t.b]",
          "    TiKVSingleGather_32 input:[Group#30], table:t",
          "Group#30 Schema:[test.t.b]",
          "    Limit_33 input:[Group#31], offset:0, count:2",
          "Group#31 Schema:[test.t.b]",
          "    TableScan_31 table:t"
        ]
      },
      {
        "SQL": "(select a from t) union all (select b from t) limit 2 offset 5;",
        "Result": [
          "Group#0 Schema:[Column#25]",
          "    Limit_8 input:[Group#1], offset:5, count:2",
          "Group#1 Schema:[Column#25]",
          "    Union_5 input:[Group#2,Group#3]",
          "Group#2 Schema:[Column#25]",
          "    Projection_6 input:[Group#4], test.t.a->Column#25",
          "Group#4 Schema:[test.t.a]",
          "    Projection_2 input:[Group#5], test.t.a",
          "Group#5 Schema:[test.t.a]",
          "    Limit_9 input:[Group#6], offset:0, count:7",
          "    Limit_9 input:[Group#7], offset:0, count:7",
          "    Limit_9 input:[Group#8], offset:0, count:7",
          "    Limit_9 input:[Group#9], offset:0, count:7",
          "    Limit_9 input:[Group#10], offset:0, count:7",
          "    Limit_9 input:[Group#11], offset:0, count:7",
          "    Limit_9 input:[Group#12], offset:0, count:7",
          "Group#6 Schema:[test.t.a]",
          "    TiKVSingleGather_13 input:[Group#13], table:t, index:c_d_e",
          "Group#13 Schema:[test.t.a]",
          "    Limit_30 input:[Group#14], offset:0, count:7",
          "Group#14 Schema:[test.t.a]",
          "    IndexScan_12 table:t, index:c, d, e",
          "Group#7 Schema:[test.t.a]",
          "    TiKVSingleGather_15 input:[Group#15], table:t, index:f",
          "Group#15 Schema:[test.t.a]",
          "    Limit_29 input:[Group#16], offset:0, count:7",
          "Group#16 Schema:[test.t.a]",
          "    IndexScan_14 table:t, index:f",
          "Group#8 Schema:[test.t.a]",
          "    TiKVSingleGather_17 input:[Group#17], table:t, index:g",
          "Group#17 Schema:[test.t.a]",
          "    Limit_28 input:[Group#18], offset:0, count:7",
          "Group#18 Schema:[test.t.a]",
          "    IndexScan_16 table:t, index:g",
          "Group#9 Schema:[test.t.a]",
          "    TiKVSingleGather_19 input:[Group#19], table:t, index:f_g",
          "Group#19 Schema:[test.t.a]",
          "    Limit_27 input:[Group#20], offset:0, count:7",
          "Group#20 Schema:[test.t.a]",
          "    IndexScan_18 table:t, index:f, g",
          "Group#10 Schema:[test.t.a]",
          "    TiKVSingleGather_21 input:[Group#21], table:t, index:c_d_e_str",
          "Group#21 Schema:[test.t.a]",
          "    Limit_26 input:[Group#22], offset:0, count:7",
          "Group#22 Schema:[test.t.a]",
          "    IndexScan_20 table:t, index:c_str, d_str, e_str",
          "Group#11 Schema:[test.t.a]",
          "    TiKVSingleGather_23 input:[Group#23], table:t, index:e_d_c_str_prefix",
          "Group#23 Schema:[test.t.a]",
          "    Limit_25 input:[Group#24], offset:0, count:7",
          "Group#24 Schema:[test.t.a]",
          "    IndexScan_22 table:t, index:e_str, d_str, c_str",
          "Group#12 Schema:[test.t.a]",
          "    TiKVSingleGather_11 input:[Group#25], table:t",
          "Group#25 Schema:[test.t.a]",
          "    Limit_24 input:[Group#26], offset:0, count:7",
          "Group#26 Schema:[test.t.a]",
          "    TableScan_10 table:t, pk col:test.t.a",
          "Group#3 Schema:[Column#25]",
          "    Projection_7 input:[Group#27], test.t.b->Column#25",
          "Group#27 Schema:[test.t.b]",
          "    Projection_4 input:[Group#28], test.t.b",
          "Group#28 Schema:[test.t.b]",
          "    Limit_9 input:[Group#29], offset:0, count:7",
          "Group#29 Schema:[test.t.b]",
          "    TiKVSingleGather_32 input:[Group#30], table:t",
          "Group#30 Schema:[test.t.b]",
          "    Limit_33 input:[Group#31], offset:0, count:7",
          "Group#31 Schema:[test.t.b]",
          "    TableScan_31 table:t"
        ]
      },
      {
        "SQL": "(select a from t) union all (select sum(a) from t where a > 2 group by b) order by a limit 2;",
        "Result": [
          "Group#0 Schema:[Column#26]",
          "    TopN_12 input:[Group#1], Column#26, offset:0, count:2",
          "Group#1 Schema:[Column#26]",
          "    Union_7 input:[Group#2,Group#3]",
          "Group#2 Schema:[Column#26]",
          "    Projection_8 input:[Group#4], cast(test.t.a, decimal(32,0) BINARY)->Column#26",
          "Group#4 Schema:[test.t.a]",
          "    Projection_2 input:[Group#5], test.t.a",
          "Group#5 Schema:[test.t.a]",
          "    TopN_15 input:[Group#6], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:2",
          "    TopN_15 input:[Group#7], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:2",
          "    TopN_15 input:[Group#8], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:2",
          "    TopN_15 input:[Group#9], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:2",
          "    TopN_15 input:[Group#10], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:2",
          "    TopN_15 input:[Group#11], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:2",
          "    TopN_15 input:[Group#12], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:2",
          "Group#6 Schema:[test.t.a]",
          "    TiKVSingleGather_21 input:[Group#13], table:t, index:c_d_e",
          "Group#13 Schema:[test.t.a]",
          "    TopN_38 input:[Group#14], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:2",
          "Group#14 Schema:[test.t.a]",
          "    IndexScan_20 table:t, index:c, d, e",
          "Group#7 Schema:[test.t.a]",
          "    TiKVSingleGather_23 input:[Group#15], table:t, index:f",
          "Group#15 Schema:[test.t.a]",
          "    TopN_37 input:[Group#16], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:2",
          "Group#16 Schema:[test.t.a]",
          "    IndexScan_22 table:t, index:f",
          "Group#8 Schema:[test.t.a]",
          "    TiKVSingleGather_25 input:[Group#17], table:t, index:g",
          "Group#17 Schema:[test.t.a]",
          "    TopN_36 input:[Group#18], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:2",
          "Group#18 Schema:[test.t.a]",
          "    IndexScan_24 table:t, index:g",
          "Group#9 Schema:[test.t.a]",
          "    TiKVSingleGather_27 input:[Group#19], table:t, index:f_g",
          "Group#19 Schema:[test.t.a]",
          "    TopN_35 input:[Group#20], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:2",
          "Group#20 Schema:[test.t.a]",
          "    IndexScan_26 table:t, index:f, g",
          "Group#10 Schema:[test.t.a]",
          "    TiKVSingleGather_29 input:[Group#21], table:t, index:c_d_e_str",
          "Group#21 Schema:[test.t.a]",
          "    TopN_34 input:[Group#22], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:2",
          "Group#22 Schema:[test.t.a]",
          "    IndexScan_28 table:t, index:c_str, d_str, e_str",
          "Group#11 Schema:[test.t.a]",
          "    TiKVSingleGather_31 input:[Group#23], table:t, index:e_d_c_str_prefix",
          "Group#23 Schema:[test.t.a]",
          "    TopN_33 input:[Group#24], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:2",
          "Group#24 Schema:[test.t.a]",
          "    IndexScan_30 table:t, index:e_str, d_str, c_str",
          "Group#12 Schema:[test.t.a]",
          "    TiKVSingleGather_19 input:[Group#25], table:t",
          "Group#25 Schema:[test.t.a]",
          "    TopN_32 input:[Group#26], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:2",
          "Group#26 Schema:[test.t.a]",
          "    TableScan_18 table:t, pk col:test.t.a",
          "Group#3 Schema:[Column#26]",
          "    Projection_9 input:[Group#27], Column#25->Column#26",
          "Group#27 Schema:[Column#25]",
          "    Projection_6 input:[Group#28], Column#25",
          "Group#28 Schema:[Column#25]",
          "    TopN_17 input:[Group#29], Column#25, offset:0, count:2",
          "Group#29 Schema:[Column#25]",
          "    Aggregation_5 input:[Group#30], group by:test.t.b, funcs:sum(test.t.a)",
          "Group#30 Schema:[test.t.a,test.t.b]",
          "    Selection_4 input:[Group#31], gt(test.t.a, 2)",
          "Group#31 Schema:[test.t.a,test.t.b]",
          "    TiKVSingleGather_40 input:[Group#32], table:t",
          "Group#32 Schema:[test.t.a,test.t.b]",
          "    TableScan_39 table:t, pk col:test.t.a"
        ]
      },
      {
        "SQL": "(select a from t) union all (select sum(a) from t where a > 2 group by b) order by a limit 1, 2;",
        "Result": [
          "Group#0 Schema:[Column#26]",
          "    TopN_12 input:[Group#1], Column#26, offset:1, count:2",
          "Group#1 Schema:[Column#26]",
          "    Union_7 input:[Group#2,Group#3]",
          "Group#2 Schema:[Column#26]",
          "    Projection_8 input:[Group#4], cast(test.t.a, decimal(32,0) BINARY)->Column#26",
          "Group#4 Schema:[test.t.a]",
          "    Projection_2 input:[Group#5], test.t.a",
          "Group#5 Schema:[test.t.a]",
          "    TopN_15 input:[Group#6], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:3",
          "    TopN_15 input:[Group#7], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:3",
          "    TopN_15 input:[Group#8], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:3",
          "    TopN_15 input:[Group#9], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:3",
          "    TopN_15 input:[Group#10], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:3",
          "    TopN_15 input:[Group#11], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:3",
          "    TopN_15 input:[Group#12], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:3",
          "Group#6 Schema:[test.t.a]",
          "    TiKVSingleGather_21 input:[Group#13], table:t, index:c_d_e",
          "Group#13 Schema:[test.t.a]",
          "    TopN_38 input:[Group#14], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:3",
          "Group#14 Schema:[test.t.a]",
          "    IndexScan_20 table:t, index:c, d, e",
          "Group#7 Schema:[test.t.a]",
          "    TiKVSingleGather_23 input:[Group#15], table:t, index:f",
          "Group#15 Schema:[test.t.a]",
          "    TopN_37 input:[Group#16], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:3",
          "Group#16 Schema:[test.t.a]",
          "    IndexScan_22 table:t, index:f",
          "Group#8 Schema:[test.t.a]",
          "    TiKVSingleGather_25 input:[Group#17], table:t, index:g",
          "Group#17 Schema:[test.t.a]",
          "    TopN_36 input:[Group#18], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:3",
          "Group#18 Schema:[test.t.a]",
          "    IndexScan_24 table:t, index:g",
          "Group#9 Schema:[test.t.a]",
          "    TiKVSingleGather_27 input:[Group#19], table:t, index:f_g",
          "Group#19 Schema:[test.t.a]",
          "    TopN_35 input:[Group#20], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:3",
          "Group#20 Schema:[test.t.a]",
          "    IndexScan_26 table:t, index:f, g",
          "Group#10 Schema:[test.t.a]",
          "    TiKVSingleGather_29 input:[Group#21], table:t, index:c_d_e_str",
          "Group#21 Schema:[test.t.a]",
          "    TopN_34 input:[Group#22], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:3",
          "Group#22 Schema:[test.t.a]",
          "    IndexScan_28 table:t, index:c_str, d_str, e_str",
          "Group#11 Schema:[test.t.a]",
          "    TiKVSingleGather_31 input:[Group#23], table:t, index:e_d_c_str_prefix",
          "Group#23 Schema:[test.t.a]",
          "    TopN_33 input:[Group#24], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:3",
          "Group#24 Schema:[test.t.a]",
          "    IndexScan_30 table:t, index:e_str, d_str, c_str",
          "Group#12 Schema:[test.t.a]",
          "    TiKVSingleGather_19 input:[Group#25], table:t",
          "Group#25 Schema:[test.t.a]",
          "    TopN_32 input:[Group#26], cast(test.t.a, decimal(32,0) BINARY), offset:0, count:3",
          "Group#26 Schema:[test.t.a]",
          "    TableScan_18 table:t, pk col:test.t.a",
          "Group#3 Schema:[Column#26]",
          "    Projection_9 input:[Group#27], Column#25->Column#26",
          "Group#27 Schema:[Column#25]",
          "    Projection_6 input:[Group#28], Column#25",
          "Group#28 Schema:[Column#25]",
          "    TopN_17 input:[Group#29], Column#25, offset:0, count:3",
          "Group#29 Schema:[Column#25]",
          "    Aggregation_5 input:[Group#30], group by:test.t.b, funcs:sum(test.t.a)",
          "Group#30 Schema:[test.t.a,test.t.b]",
          "    Selection_4 input:[Group#31], gt(test.t.a, 2)",
          "Group#31 Schema:[test.t.a,test.t.b]",
          "    TiKVSingleGather_40 input:[Group#32], table:t",
          "Group#32 Schema:[test.t.a,test.t.b]",
          "    TableScan_39 table:t, pk col:test.t.a"
        ]
      },
      {
        "SQL": "(select a from t where a = 1) union all (select b from t where a = 2) union all (select c from t where a = 3) order by a limit 2;",
        "Result": [
          "Group#0 Schema:[Column#37]",
          "    TopN_16 input:[Group#1], Column#37, offset:0, count:2",
          "Group#1 Schema:[Column#37]",
          "    Union_10 input:[Group#2,Group#3,Group#4]",
          "Group#2 Schema:[Column#37]",
          "    Projection_11 input:[Group#5], test.t.a->Column#37",
          "Group#5 Schema:[test.t.a]",
          "    Projection_3 input:[Group#6], test.t.a",
          "Group#6 Schema:[test.t.a]",
          "    TopN_19 input:[Group#7], test.t.a, offset:0, count:2",
          "Group#7 Schema:[test.t.a]",
          "    Selection_2 input:[Group#8], eq(test.t.a, 1)",
          "Group#8 Schema:[test.t.a]",
          "    TiKVSingleGather_25 input:[Group#9], table:t",
          "    TiKVSingleGather_37 input:[Group#10], table:t, index:e_d_c_str_prefix",
          "    TiKVSingleGather_35 input:[Group#11], table:t, index:c_d_e_str",
          "    TiKVSingleGather_33 input:[Group#12], table:t, index:f_g",
          "    TiKVSingleGather_31 input:[Group#13], table:t, index:g",
          "    TiKVSingleGather_29 input:[Group#14], table:t, index:f",
          "    TiKVSingleGather_27 input:[Group#15], table:t, index:c_d_e",
          "Group#9 Schema:[test.t.a]",
          "    TableScan_24 table:t, pk col:test.t.a",
          "Group#10 Schema:[test.t.a]",
          "    IndexScan_36 table:t, index:e_str, d_str, c_str",
          "Group#11 Schema:[test.t.a]",
          "    IndexScan_34 table:t, index:c_str, d_str, e_str",
          "Group#12 Schema:[test.t.a]",
          "    IndexScan_32 table:t, index:f, g",
          "Group#13 Schema:[test.t.a]",
          "    IndexScan_30 table:t, index:g",
          "Group#14 Schema:[test.t.a]",
          "    IndexScan_28 table:t, index:f",
          "Group#15 Schema:[test.t.a]",
          "    IndexScan_26 table:t, index:c, d, e",
          "Group#3 Schema:[Column#37]",
          "    Projection_12 input:[Group#16], test.t.b->Column#37",
          "Group#16 Schema:[test.t.b]",
          "    Projection_6 input:[Group#17], test.t.b",
          "Group#17 Schema:[test.t.a,test.t.b]",
          "    TopN_21 input:[Group#18], test.t.b, offset:0, count:2",
          "Group#18 Schema:[test.t.a,test.t.b]",
          "    Selection_5 input:[Group#19], eq(test.t.a, 2)",
          "Group#19 Schema:[test.t.a,test.t.b]",
          "    TiKVSingleGather_39 input:[Group#20], table:t",
          "Group#20 Schema:[test.t.a,test.t.b]",
          "    TableScan_38 table:t, pk col:test.t.a",
          "Group#4 Schema:[Column#37]",
          "    Projection_13 input:[Group#21], test.t.c->Column#37",
          "Group#21 Schema:[test.t.c]",
          "    Projection_9 input:[Group#22], test.t.c",
          "Group#22 Schema:[test.t.a,test.t.c]",
          "    TopN_23 input:[Group#23], test.t.c, offset:0, count:2",
          "Group#23 Schema:[test.t.a,test.t.c]",
          "    Selection_8 input:[Group#24], eq(test.t.a, 3)",
          "Group#24 Schema:[test.t.a,test.t.c]",
          "    TiKVSingleGather_41 input:[Group#25], table:t",
          "    TiKVSingleGather_43 input:[Group#26], table:t, index:c_d_e",
          "Group#25 Schema:[test.t.a,test.t.c]",
          "    TableScan_40 table:t, pk col:test.t.a",
          "Group#26 Schema:[test.t.a,test.t.c]",
          "    IndexScan_42 table:t, index:c, d, e"
        ]
      }
    ]
  },
  {
    "Name": "TestProjectionElimination",
    "Cases": [
      {
        "SQL": "select a, b from (select a, b from t) as t2",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a+b from (select a, b from t) as t2",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], plus(test.t.a, test.t.b)->Column#13",
          "Group#1 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a from (select floor(a) as a from t) as t2",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_2 input:[Group#1], floor(test.t.a)->Column#13",
          "Group#1 Schema:[test.t.a]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a from (select a, b from (select a, b, c from t) as t2) as t3",
        "Result": [
          "Group#0 Schema:[test.t.a]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a+c from (select floor(a) as a, b, c from t) as t2",
        "Result": [
          "Group#0 Schema:[Column#14]",
          "    Projection_4 input:[Group#1], plus(floor(test.t.a), test.t.c)->Column#14",
          "Group#1 Schema:[test.t.a,test.t.c]",
          "    DataSource_1 table:t"
        ]
      }
    ]
  },
  {
    "Name": "TestEliminateMaxMin",
    "Cases": [
      {
        "SQL": "select max(a) from t;",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_2 input:[Group#2], funcs:max(test.t.a)",
          "    Aggregation_2 input:[Group#3], funcs:max(test.t.a)",
          "Group#2 Schema:[test.t.a]",
          "    DataSource_1 table:t",
          "Group#3 Schema:[test.t.a]",
          "    TopN_4 input:[Group#2], test.t.a:desc, offset:0, count:1"
        ]
      },
      {
        "SQL": "select min(a) from t;",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_2 input:[Group#2], funcs:min(test.t.a)",
          "    Aggregation_2 input:[Group#3], funcs:min(test.t.a)",
          "Group#2 Schema:[test.t.a]",
          "    DataSource_1 table:t",
          "Group#3 Schema:[test.t.a]",
          "    TopN_4 input:[Group#2], test.t.a, offset:0, count:1"
        ]
      }
    ]
  },
  {
    "Name": "TestMergeAggregationProjection",
    "Cases": [
      {
        "SQL": "select b, max(a) from (select a, c+d as b from t as t1) as t2 group by b",
        "Result": [
          "Group#0 Schema:[Column#13,Column#14]",
          "    Projection_4 input:[Group#1], Column#13, Column#14",
          "Group#1 Schema:[Column#14,Column#13]",
          "    Aggregation_3 input:[Group#2], group by:Column#13, funcs:max(test.t.a), firstrow(Column#13)",
          "    Aggregation_5 input:[Group#3], group by:plus(test.t.c, test.t.d), funcs:max(test.t.a), firstrow(plus(test.t.c, test.t.d))",
          "Group#2 Schema:[test.t.a,Column#13]",
          "    Projection_2 input:[Group#3], test.t.a, plus(test.t.c, test.t.d)->Column#13",
          "Group#3 Schema:[test.t.a,test.t.c,test.t.d]",
          "    DataSource_1 table:t1"
        ]
      },
      {
        "SQL": "select max(a) from (select c+d as b, a+c as a from t as t1) as t2",
        "Result": [
          "Group#0 Schema:[Column#15]",
          "    Projection_4 input:[Group#1], Column#15",
          "Group#1 Schema:[Column#15]",
          "    Aggregation_3 input:[Group#2], funcs:max(Column#14)",
          "    Aggregation_5 input:[Group#3], funcs:max(plus(test.t.a, test.t.c))",
          "Group#2 Schema:[Column#14]",
          "    Projection_2 input:[Group#3], plus(test.t.a, test.t.c)->Column#14",
          "Group#3 Schema:[test.t.a,test.t.c]",
          "    DataSource_1 table:t1"
        ]
      },
      {
        "SQL": "select b, max(a) from (select a, c+d as b, @i:=0 from t as t1) as t2 group by b",
        "Result": [
          "Group#0 Schema:[Column#13,Column#15]",
          "    Projection_4 input:[Group#1], Column#13, Column#15",
          "Group#1 Schema:[Column#15,Column#13]",
          "    Aggregation_3 input:[Group#2], group by:Column#13, funcs:max(test.t.a), firstrow(Column#13)",
          "Group#2 Schema:[test.t.a,Column#13,Column#14]",
          "    Projection_2 input:[Group#3], test.t.a, plus(test.t.c, test.t.d)->Column#13, setvar(i, 0)->Column#14",
          "Group#3 Schema:[test.t.a,test.t.c,test.t.d]",
          "    DataSource_1 table:t1"
        ]
      }
    ]
  },
  {
    "Name": "TestMergeAdjacentLimit",
    "Cases": [
      {
        "SQL": "select b from (select b from t limit 5) as t1 limit 10",
        "Result": [
          "Group#0 Schema:[test.t.b]",
          "    Projection_4 input:[Group#1], test.t.b",
          "Group#1 Schema:[test.t.b]",
          "    Projection_2 input:[Group#2], test.t.b",
          "Group#2 Schema:[test.t.b]",
          "    Limit_6 input:[Group#3], offset:0, count:5",
          "Group#3 Schema:[test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select b from (select b from t limit 20) as t1 limit 10",
        "Result": [
          "Group#0 Schema:[test.t.b]",
          "    Projection_4 input:[Group#1], test.t.b",
          "Group#1 Schema:[test.t.b]",
          "    Projection_2 input:[Group#2], test.t.b",
          "Group#2 Schema:[test.t.b]",
          "    Limit_6 input:[Group#3], offset:0, count:10",
          "Group#3 Schema:[test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select b from (select b from t limit 10) as t1 limit 10",
        "Result": [
          "Group#0 Schema:[test.t.b]",
          "    Projection_4 input:[Group#1], test.t.b",
          "Group#1 Schema:[test.t.b]",
          "    Projection_2 input:[Group#2], test.t.b",
          "Group#2 Schema:[test.t.b]",
          "    Limit_6 input:[Group#3], offset:0, count:10",
          "Group#3 Schema:[test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select b from (select b from t limit 10 offset 10) as t1 limit 10 offset 5",
        "Result": [
          "Group#0 Schema:[test.t.b]",
          "    Projection_4 input:[Group#1], test.t.b",
          "Group#1 Schema:[test.t.b]",
          "    Projection_2 input:[Group#2], test.t.b",
          "Group#2 Schema:[test.t.b]",
          "    Limit_6 input:[Group#3], offset:15, count:5",
          "Group#3 Schema:[test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select b from (select b from t limit 10 offset 2) as t1 limit 3 offset 5",
        "Result": [
          "Group#0 Schema:[test.t.b]",
          "    Projection_4 input:[Group#1], test.t.b",
          "Group#1 Schema:[test.t.b]",
          "    Projection_2 input:[Group#2], test.t.b",
          "Group#2 Schema:[test.t.b]",
          "    Limit_6 input:[Group#3], offset:7, count:3",
          "Group#3 Schema:[test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select b from (select b from t limit 10 offset 5) as t1 limit 5 offset 5",
        "Result": [
          "Group#0 Schema:[test.t.b]",
          "    Projection_4 input:[Group#1], test.t.b",
          "Group#1 Schema:[test.t.b]",
          "    Projection_2 input:[Group#2], test.t.b",
          "Group#2 Schema:[test.t.b]",
          "    Limit_6 input:[Group#3], offset:10, count:5",
          "Group#3 Schema:[test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a from (select a from t limit 3 offset 5) t1 limit 3 offset 5",
        "Result": [
          "Group#0 Schema:[test.t.a]",
          "    Projection_4 input:[Group#1], test.t.a",
          "Group#1 Schema:[test.t.a]",
          "    Projection_2 input:[Group#2], test.t.a",
          "Group#2 Schema:[test.t.a]",
          "    TableDual_6 rowcount:0"
        ]
      }
    ]
  },
  {
    "Name": "TestMergeAdjacentTopN",
    "Cases": [
      {
        "SQL": "select b from (select b from t where c > 1 order by b limit 3) as t1 order by b limit 2",
        "Result": [
          "Group#0 Schema:[test.t.b]",
          "    Projection_11 input:[Group#1], test.t.b",
          "Group#1 Schema:[test.t.b,test.t.c]",
          "    TopN_14 input:[Group#2], test.t.b, offset:0, count:2",
          "Group#2 Schema:[test.t.b,test.t.c]",
          "    Selection_2 input:[Group#3], gt(test.t.c, 1)",
          "Group#3 Schema:[test.t.b,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a from (select a from t where b > 2 order by a limit 3 offset 1) as t1 order by a limit 2 offset 1",
        "Result": [
          "Group#0 Schema:[test.t.a]",
          "    Projection_11 input:[Group#1], test.t.a",
          "Group#1 Schema:[test.t.a,test.t.b]",
          "    TopN_14 input:[Group#2], test.t.a, offset:2, count:2",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    Selection_2 input:[Group#3], gt(test.t.b, 2)",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select * from (select * from t order by a limit 3) as t1 order by a limit 5",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Projection_10 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TopN_13 input:[Group#2], test.t.a, offset:0, count:3",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select b from (select b from t order by b limit 5) as t1 order by b limit 10",
        "Result": [
          "Group#0 Schema:[test.t.b]",
          "    Projection_10 input:[Group#1], test.t.b",
          "Group#1 Schema:[test.t.b]",
          "    TopN_13 input:[Group#2], test.t.b, offset:0, count:5",
          "Group#2 Schema:[test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select b from (select b from t order by b limit 20) as t1 order by b limit 10",
        "Result": [
          "Group#0 Schema:[test.t.b]",
          "    Projection_10 input:[Group#1], test.t.b",
          "Group#1 Schema:[test.t.b]",
          "    TopN_13 input:[Group#2], test.t.b, offset:0, count:10",
          "Group#2 Schema:[test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select b from (select b from t order by b limit 10) as t1 order by b limit 10",
        "Result": [
          "Group#0 Schema:[test.t.b]",
          "    Projection_10 input:[Group#1], test.t.b",
          "Group#1 Schema:[test.t.b]",
          "    TopN_13 input:[Group#2], test.t.b, offset:0, count:10",
          "Group#2 Schema:[test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select b from (select b from t order by b limit 10 offset 10) as t1 order by b limit 10 offset 5",
        "Result": [
          "Group#0 Schema:[test.t.b]",
          "    Projection_10 input:[Group#1], test.t.b",
          "Group#1 Schema:[test.t.b]",
          "    TopN_13 input:[Group#2], test.t.b, offset:15, count:5",
          "Group#2 Schema:[test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select b from (select b from t order by b limit 10 offset 2) as t1 order by b limit 3 offset 5",
        "Result": [
          "Group#0 Schema:[test.t.b]",
          "    Projection_10 input:[Group#1], test.t.b",
          "Group#1 Schema:[test.t.b]",
          "    TopN_13 input:[Group#2], test.t.b, offset:7, count:3",
          "Group#2 Schema:[test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select b from (select b from t order by b limit 10 offset 5) as t1 order by b limit 5 offset 5",
        "Result": [
          "Group#0 Schema:[test.t.b]",
          "    Projection_10 input:[Group#1], test.t.b",
          "Group#1 Schema:[test.t.b]",
          "    TopN_13 input:[Group#2], test.t.b, offset:10, count:5",
          "Group#2 Schema:[test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a from (select a from t order by a limit 3 offset 5) as t1 order by a limit 3 offset 5",
        "Result": [
          "Group#0 Schema:[test.t.a]",
          "    Projection_10 input:[Group#1], test.t.a",
          "Group#1 Schema:[test.t.a]",
          "    TableDual_13 rowcount:0"
        ]
      },
      {
        "SQL": "select b from (select b from t where c > 1 order by b, a limit 3) as t1 order by b limit 2",
        "Result": [
          "Group#0 Schema:[test.t.b]",
          "    Projection_13 input:[Group#1], test.t.b",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c]",
          "    TopN_16 input:[Group#2], test.t.b, test.t.a, offset:0, count:2",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c]",
          "    Selection_2 input:[Group#3], gt(test.t.c, 1)",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a from (select a from t where b > 2 order by a, b limit 3 offset 1) as t1 order by a limit 2 offset 1",
        "Result": [
          "Group#0 Schema:[test.t.a]",
          "    Projection_13 input:[Group#1], test.t.a",
          "Group#1 Schema:[test.t.a,test.t.b]",
          "    TopN_16 input:[Group#2], test.t.a, test.t.b, offset:2, count:2",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    Selection_2 input:[Group#3], gt(test.t.b, 2)",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t"
        ]
      }
    ]
  },
  {
    "Name": "TestTransformLimitToTableDual",
    "Cases": [
      {
        "SQL": "select a from t limit 0 offset 1",
        "Result": [
          "Group#0 Schema:[test.t.a]",
          "    TableDual_4 rowcount:0"
        ]
      },
      {
        "SQL": "select * from t as t1 left join (select * from t limit 0 offset 1) as t2 on t1.a = t2.a;",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Projection_6 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date, test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Join_5 input:[Group#2,Group#3], left outer join, equal:[eq(test.t.a, test.t.a)]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    DataSource_1 table:t1",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableDual_7 rowcount:0"
        ]
      },
      {
        "SQL": "select a, b from ((select a, b from t) union all(select c as a, d as b from t limit 0 offset 5)) as t1 where a > 1",
        "Result": [
          "Group#0 Schema:[Column#25,Column#26]",
          "    Projection_10 input:[Group#1], Column#25, Column#26",
          "Group#1 Schema:[Column#25,Column#26]",
          "    Selection_9 input:[Group#2], gt(Column#25, 1)",
          "Group#2 Schema:[Column#25,Column#26]",
          "    Union_6 input:[Group#3,Group#4]",
          "Group#3 Schema:[Column#25,Column#26]",
          "    Projection_7 input:[Group#5], test.t.a->Column#25, test.t.b->Column#26",
          "Group#5 Schema:[test.t.a,test.t.b]",
          "    Projection_2 input:[Group#6], test.t.a, test.t.b",
          "Group#6 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t",
          "Group#4 Schema:[Column#25,Column#26]",
          "    Projection_8 input:[Group#7], test.t.c->Column#25, test.t.d->Column#26",
          "Group#7 Schema:[test.t.c,test.t.d]",
          "    TableDual_11 rowcount:0"
        ]
      }
    ]
  },
  {
    "Name": "TestPostTransformationRules",
    "Cases": [
      {
        "SQL": "select b from (select b+10 as b from t) as t1 order by b + 10 limit 10",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_8 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13,Column#14]",
          "    TopN_10 input:[Group#2], Column#14, offset:0, count:10",
          "Group#2 Schema:[Column#13,Column#14]",
          "    Projection_11 input:[Group#3], plus(test.t.b, 10)->Column#13, plus(plus(test.t.b, 10), 10)->Column#14",
          "Group#3 Schema:[test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select * from (select a+1 as c, a+b as d from t) as t1 order by c+d limit 10",
        "Result": [
          "Group#0 Schema:[Column#13,Column#14]",
          "    Projection_8 input:[Group#1], Column#13, Column#14",
          "Group#1 Schema:[Column#13,Column#14,Column#15]",
          "    TopN_10 input:[Group#2], Column#15, offset:0, count:10",
          "Group#2 Schema:[Column#13,Column#14,Column#15]",
          "    Projection_11 input:[Group#3], plus(test.t.a, 1)->Column#13, plus(test.t.a, test.t.b)->Column#14, plus(plus(test.t.a, 1), plus(test.t.a, test.t.b))->Column#15",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a from (select a, b from t order by b limit 10) as t1",
        "Result": [
          "Group#0 Schema:[test.t.a]",
          "    TopN_6 input:[Group#1], test.t.b, offset:0, count:10",
          "Group#1 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t"
        ]
      }
    ]
  },
  {
    "Name": "TestPushLimitDownTiKVSingleGather",
    "Cases": [
      {
        "SQL": "select * from t limit 1",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Limit_3 input:[Group#1], offset:0, count:1",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_5 input:[Group#2], table:t",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Limit_6 input:[Group#3], offset:0, count:1",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_4 table:t, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select * from t as t1 left join (select * from t limit 2) as t2 on t1.a = t2.a;",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Join_5 input:[Group#1,Group#2], left outer join, equal:[eq(test.t.a, test.t.a)]",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_8 input:[Group#3], table:t1",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_7 table:t1, pk col:test.t.a",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Limit_4 input:[Group#4], offset:0, count:2",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TiKVSingleGather_10 input:[Group#5], table:t",
          "Group#5 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Limit_11 input:[Group#6], offset:0, count:2",
          "Group#6 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    TableScan_9 table:t, pk col:test.t.a"
        ]
      },
      {
        "SQL": "select a, b from ((select a, b from t) union all(select c as a, d as b from t limit 3)) as t1 where a > 1",
        "Result": [
          "Group#0 Schema:[Column#25,Column#26]",
          "    Selection_9 input:[Group#1], gt(Column#25, 1)",
          "Group#1 Schema:[Column#25,Column#26]",
          "    Union_6 input:[Group#2,Group#3]",
          "Group#2 Schema:[Column#25,Column#26]",
          "    Projection_7 input:[Group#4], test.t.a->Column#25, test.t.b->Column#26",
          "Group#4 Schema:[test.t.a,test.t.b]",
          "    TiKVSingleGather_12 input:[Group#5], table:t",
          "Group#5 Schema:[test.t.a,test.t.b]",
          "    TableScan_11 table:t, pk col:test.t.a",
          "Group#3 Schema:[Column#25,Column#26]",
          "    Projection_8 input:[Group#6], test.t.c->Column#25, test.t.d->Column#26",
          "Group#6 Schema:[test.t.c,test.t.d]",
          "    Limit_5 input:[Group#7], offset:0, count:3",
          "    Limit_5 input:[Group#8], offset:0, count:3",
          "Group#7 Schema:[test.t.c,test.t.d]",
          "    TiKVSingleGather_16 input:[Group#9], table:t, index:c_d_e",
          "Group#9 Schema:[test.t.c,test.t.d]",
          "    Limit_18 input:[Group#10], offset:0, count:3",
          "Group#10 Schema:[test.t.c,test.t.d]",
          "    IndexScan_15 table:t, index:c, d, e",
          "Group#8 Schema:[test.t.c,test.t.d]",
          "    TiKVSingleGather_14 input:[Group#11], table:t",
          "Group#11 Schema:[test.t.c,test.t.d]",
          "    Limit_17 input:[Group#12], offset:0, count:3",
          "Group#12 Schema:[test.t.c,test.t.d]",
          "    TableScan_13 table:t"
        ]
      }
    ]
  },
  {
    "Name": "TestEliminateOuterJoin",
    "Cases": [
      {
        "SQL": "select t1.a, max(t1.b) from t as t1 left join (select * from t) as t2 on t1.a = t2.a and t1.b = 3 group by t1.a;",
        "Result": [
          "Group#0 Schema:[test.t.a,Column#25]",
          "    Projection_6 input:[Group#1], test.t.a, Column#25",
          "Group#1 Schema:[Column#25,test.t.a]",
          "    Aggregation_5 input:[Group#2], group by:test.t.a, funcs:max(test.t.b), firstrow(test.t.a)",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t1"
        ]
      },
      {
        "SQL": "select t1.a, max(t1.b) from t as t1 left join (select * from t) as t2 on t1.a = t2.a group by t1.a;",
        "Result": [
          "Group#0 Schema:[test.t.a,Column#25]",
          "    Projection_6 input:[Group#1], test.t.a, Column#25",
          "Group#1 Schema:[Column#25,test.t.a]",
          "    Aggregation_5 input:[Group#2], group by:test.t.a, funcs:max(test.t.b), firstrow(test.t.a)",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t1"
        ]
      },
      {
        "SQL": "select t1.a, sum(t1.h) from t as t1 left join (select * from t) as t2 on t1.h = t2.h group by t1.a;",
        "Result": [
          "Group#0 Schema:[test.t.a,Column#25]",
          "    Projection_6 input:[Group#1], test.t.a, Column#25",
          "Group#1 Schema:[Column#25,test.t.a]",
          "    Aggregation_5 input:[Group#2], group by:test.t.a, funcs:sum(test.t.h), firstrow(test.t.a)",
          "Group#2 Schema:[test.t.a,test.t.h]",
          "    Join_4 input:[Group#3,Group#4], left outer join, equal:[eq(test.t.h, test.t.h)]",
          "Group#3 Schema:[test.t.a,test.t.h]",
          "    DataSource_1 table:t1",
          "Group#4 Schema:[test.t.h]",
          "    Projection_3 input:[Group#5], test.t.h",
          "Group#5 Schema:[test.t.h]",
          "    DataSource_2 table:t"
        ]
      },
      {
        "SQL": "select t1.a, sum(distinct t1.h) from t as t1 left join (select * from t) as t2 on t1.h = t2.h group by t1.a;",
        "Result": [
          "Group#0 Schema:[test.t.a,Column#25]",
          "    Projection_6 input:[Group#1], test.t.a, Column#25",
          "Group#1 Schema:[Column#25,test.t.a]",
          "    Aggregation_5 input:[Group#2], group by:test.t.a, funcs:sum(distinct test.t.h), firstrow(test.t.a)",
          "Group#2 Schema:[test.t.a,test.t.h]",
          "    DataSource_1 table:t1"
        ]
      },
      {
        "SQL": "select t1.a, max(t1.b) from t as t1 left join (select * from t) as t2 on t1.a = t2.a group by t2.a;",
        "Result": [
          "Group#0 Schema:[test.t.a,Column#25]",
          "    Projection_6 input:[Group#1], test.t.a, Column#25",
          "Group#1 Schema:[Column#25,test.t.a]",
          "    Aggregation_5 input:[Group#2], group by:test.t.a, funcs:max(test.t.b), firstrow(test.t.a)",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.a]",
          "    Join_4 input:[Group#3,Group#4], left outer join, equal:[eq(test.t.a, test.t.a)]",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t1",
          "Group#4 Schema:[test.t.a]",
          "    Projection_3 input:[Group#5], test.t.a",
          "Group#5 Schema:[test.t.a]",
          "    DataSource_2 table:t"
        ]
      },
      {
        "SQL": "select t1.a, max(t2.b) from t as t1 left join (select * from t) as t2 on t1.a = t2.a group by t1.a;",
        "Result": [
          "Group#0 Schema:[test.t.a,Column#25]",
          "    Projection_6 input:[Group#1], test.t.a, Column#25",
          "Group#1 Schema:[Column#25,test.t.a]",
          "    Aggregation_5 input:[Group#2], group by:test.t.a, funcs:max(test.t.b), firstrow(test.t.a)",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    Join_4 input:[Group#3,Group#4], left outer join, equal:[eq(test.t.a, test.t.a)]",
          "Group#3 Schema:[test.t.a]",
          "    DataSource_1 table:t1",
          "Group#4 Schema:[test.t.a,test.t.b]",
          "    Projection_3 input:[Group#5], test.t.a, test.t.b",
          "Group#5 Schema:[test.t.a,test.t.b]",
          "    DataSource_2 table:t"
        ]
      },
      {
        "SQL": "select t2.a, max(t2.b) from t as t1 right join (select * from t) as t2 on t1.a = t2.a group by t2.a;",
        "Result": [
          "Group#0 Schema:[test.t.a,Column#25]",
          "    Projection_6 input:[Group#1], test.t.a, Column#25",
          "Group#1 Schema:[Column#25,test.t.a]",
          "    Aggregation_5 input:[Group#2], group by:test.t.a, funcs:max(test.t.b), firstrow(test.t.a)",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    Projection_3 input:[Group#3], test.t.a, test.t.b",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    DataSource_2 table:t"
        ]
      },
      {
        "SQL": "select t2.a, max(t2.b) from t as t1 right join (select * from t) as t2 on t1.a = t2.a and t2.c = 3 group by t2.a;",
        "Result": [
          "Group#0 Schema:[test.t.a,Column#25]",
          "    Projection_6 input:[Group#1], test.t.a, Column#25",
          "Group#1 Schema:[Column#25,test.t.a]",
          "    Aggregation_5 input:[Group#2], group by:test.t.a, funcs:max(test.t.b), firstrow(test.t.a)",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c]",
          "    Projection_3 input:[Group#3], test.t.a, test.t.b, test.t.c",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c]",
          "    DataSource_2 table:t"
        ]
      },
      {
        "SQL": "select t2.a, sum(t2.h) from t as t1 right join (select * from t) as t2 on t1.h = t2.h group by t2.a;",
        "Result": [
          "Group#0 Schema:[test.t.a,Column#25]",
          "    Projection_6 input:[Group#1], test.t.a, Column#25",
          "Group#1 Schema:[Column#25,test.t.a]",
          "    Aggregation_5 input:[Group#2], group by:test.t.a, funcs:sum(test.t.h), firstrow(test.t.a)",
          "Group#2 Schema:[test.t.a,test.t.h]",
          "    Join_4 input:[Group#3,Group#4], right outer join, equal:[eq(test.t.h, test.t.h)]",
          "Group#3 Schema:[test.t.h]",
          "    DataSource_1 table:t1",
          "Group#4 Schema:[test.t.a,test.t.h]",
          "    Projection_3 input:[Group#5], test.t.a, test.t.h",
          "Group#5 Schema:[test.t.a,test.t.h]",
          "    DataSource_2 table:t"
        ]
      },
      {
        "SQL": "select t2.a, sum(distinct t2.h) from t as t1 right join (select * from t) as t2 on t1.h = t2.h group by t2.a;",
        "Result": [
          "Group#0 Schema:[test.t.a,Column#25]",
          "    Projection_6 input:[Group#1], test.t.a, Column#25",
          "Group#1 Schema:[Column#25,test.t.a]",
          "    Aggregation_5 input:[Group#2], group by:test.t.a, funcs:sum(distinct test.t.h), firstrow(test.t.a)",
          "Group#2 Schema:[test.t.a,test.t.h]",
          "    Projection_3 input:[Group#3], test.t.a, test.t.h",
          "Group#3 Schema:[test.t.a,test.t.h]",
          "    DataSource_2 table:t"
        ]
      },
      {
        "SQL": "select t2.a, max(t2.b) from t as t1 right join (select * from t) as t2 on t1.a = t2.a group by t1.a;",
        "Result": [
          "Group#0 Schema:[test.t.a,Column#25]",
          "    Projection_6 input:[Group#1], test.t.a, Column#25",
          "Group#1 Schema:[Column#25,test.t.a]",
          "    Aggregation_5 input:[Group#2], group by:test.t.a, funcs:max(test.t.b), firstrow(test.t.a)",
          "Group#2 Schema:[test.t.a,test.t.a,test.t.b]",
          "    Join_4 input:[Group#3,Group#4], right outer join, equal:[eq(test.t.a, test.t.a)]",
          "Group#3 Schema:[test.t.a]",
          "    DataSource_1 table:t1",
          "Group#4 Schema:[test.t.a,test.t.b]",
          "    Projection_3 input:[Group#5], test.t.a, test.t.b",
          "Group#5 Schema:[test.t.a,test.t.b]",
          "    DataSource_2 table:t"
        ]
      },
      {
        "SQL": "select t2.a, max(t1.b) from t as t1 right join (select * from t) as t2 on t1.a = t2.a group by t2.a;",
        "Result": [
          "Group#0 Schema:[test.t.a,Column#25]",
          "    Projection_6 input:[Group#1], test.t.a, Column#25",
          "Group#1 Schema:[Column#25,test.t.a]",
          "    Aggregation_5 input:[Group#2], group by:test.t.a, funcs:max(test.t.b), firstrow(test.t.a)",
          "Group#2 Schema:[test.t.b,test.t.a]",
          "    Join_4 input:[Group#3,Group#4], right outer join, equal:[eq(test.t.a, test.t.a)]",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t1",
          "Group#4 Schema:[test.t.a]",
          "    Projection_3 input:[Group#5], test.t.a",
          "Group#5 Schema:[test.t.a]",
          "    DataSource_2 table:t"
        ]
      },
      {
        "SQL": "select t1.a, t1.b from t as t1 left join t as t2 on t1.a = t2.a and t1.b = 3 and t2.b = 3;",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b",
          "Group#1 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t1"
        ]
      },
      {
        "SQL": "select t1.a, t1.b from t as t1 left join t as t2 on t1.b = t2.b and t1.a = 3 and t2.b = 3;",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b",
          "Group#1 Schema:[test.t.a,test.t.b]",
          "    Join_3 input:[Group#2,Group#3], left outer join, equal:[eq(test.t.b, test.t.b)], left cond:eq(test.t.a, 3), right cond:eq(test.t.b, 3)",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t1",
          "Group#3 Schema:[test.t.b]",
          "    DataSource_2 table:t2"
        ]
      },
      {
        "SQL": "select t2.a, t1.b from t as t1 left join t as t2 on t1.a = t2.a and t1.a = 3 and t2.b = 3;",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b",
          "Group#1 Schema:[test.t.b,test.t.a]",
          "    Join_3 input:[Group#2,Group#3], left outer join, equal:[eq(test.t.a, test.t.a)], left cond:eq(test.t.a, 3), right cond:eq(test.t.b, 3)",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t1",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    DataSource_2 table:t2"
        ]
      },
      {
        "SQL": "select t2.a, t2.b from t as t1 right join t as t2 on t1.a = t2.a and t1.b = 3 and t2.b = 3;",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b",
          "Group#1 Schema:[test.t.a,test.t.b]",
          "    DataSource_2 table:t2"
        ]
      },
      {
        "SQL": "select t2.a, t2.b from t as t1 right join t as t2 on t1.b = t2.b and t1.a = 3 and t2.b = 3;",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b",
          "Group#1 Schema:[test.t.a,test.t.b]",
          "    Join_3 input:[Group#2,Group#3], right outer join, equal:[eq(test.t.b, test.t.b)], left cond:eq(test.t.a, 3), right cond:eq(test.t.b, 3)",
          "Group#2 Schema:[test.t.a,test.t.b], UniqueKey:[test.t.a]",
          "    DataSource_1 table:t1",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    DataSource_2 table:t2"
        ]
      },
      {
        "SQL": "select t1.a, t2.b from t as t1 right join t as t2 on t1.a = t2.a and t1.a = 3 and t2.b = 3;",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b]",
          "    Projection_4 input:[Group#1], test.t.a, test.t.b",
          "Group#1 Schema:[test.t.a,test.t.b]",
          "    Join_3 input:[Group#2,Group#3], right outer join, equal:[eq(test.t.a, test.t.a)], left cond:eq(test.t.a, 3), right cond:eq(test.t.b, 3)",
          "Group#2 Schema:[test.t.a]",
          "    DataSource_1 table:t1",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    DataSource_2 table:t2"
        ]
      },
      {
        "SQL": "select t3.a, max(t3.b) from (select t1.a, t1.b from t as t1 left join t as t2 on t1.a = t2.a) t3 group by t3.a",
        "Result": [
          "Group#0 Schema:[test.t.a,Column#25]",
          "    Projection_6 input:[Group#1], test.t.a, Column#25",
          "Group#1 Schema:[Column#25,test.t.a]",
          "    Aggregation_5 input:[Group#2], group by:test.t.a, funcs:max(test.t.b), firstrow(test.t.a)",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    Projection_4 input:[Group#3], test.t.a, test.t.b",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t1"
        ]
      }
    ]
  },
  {
    "Name": "TestTransformAggregateCaseToSelection",
    "Cases": [
      {
        "SQL": "select count(case when a > 10 then b end) from t",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_5 input:[Group#2], funcs:count(test.t.b)",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    Selection_4 input:[Group#3], gt(test.t.a, 10)",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select count(case when a > 10 then b end) from t group by c",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_2 input:[Group#2], group by:test.t.c, funcs:count(case(gt(test.t.a, 10), test.t.b))",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select count(case when a > 10 then b end) from t group by 'a'",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_2 input:[Group#2], group by:1, funcs:count(case(gt(test.t.a, 10), test.t.b))",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select count(case when a > 10 then b end) from t group by concat(c, a)",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_2 input:[Group#2], group by:concat(cast(test.t.c, var_string(20)), cast(test.t.a, var_string(20))), funcs:count(case(gt(test.t.a, 10), test.t.b))",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select count(case when a > 10 then b end) from t group by concat(c, 'a')",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_2 input:[Group#2], group by:concat(cast(test.t.c, var_string(20)), \"a\"), funcs:count(case(gt(test.t.a, 10), test.t.b))",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select count(case when a > 10 then b end) from t group by concat('a', 'c')",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_2 input:[Group#2], group by:1, funcs:count(case(gt(test.t.a, 10), test.t.b))",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select count(case when a > 10 then b else null end) from t",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_5 input:[Group#2], funcs:count(test.t.b)",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    Selection_4 input:[Group#3], gt(test.t.a, 10)",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select count(case when a > 10 then null else b end) from t",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_5 input:[Group#2], funcs:count(test.t.b)",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    Selection_4 input:[Group#3], not(gt(test.t.a, 10))",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select count(case when a > 10 then c else b end) from t",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_2 input:[Group#2], funcs:count(case(gt(test.t.a, 10), test.t.c, test.t.b))",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select count(case when a > 10 then c else 0 end) from t",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_2 input:[Group#2], funcs:count(case(gt(test.t.a, 10), test.t.c, 0))",
          "Group#2 Schema:[test.t.a,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select sum(case when a > 10 then c else 0 end) from t",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_5 input:[Group#2], funcs:sum(test.t.c)",
          "Group#2 Schema:[test.t.a,test.t.c]",
          "    Selection_4 input:[Group#3], gt(test.t.a, 10)",
          "Group#3 Schema:[test.t.a,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select sum(case when a > 10 then c else 0.0 end) from t",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_5 input:[Group#2], funcs:sum(cast(test.t.c, decimal(12,1) BINARY))",
          "Group#2 Schema:[test.t.a,test.t.c]",
          "    Selection_4 input:[Group#3], gt(test.t.a, 10)",
          "Group#3 Schema:[test.t.a,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select sum(case when a > 10 then c else 1-1 end) from t",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_5 input:[Group#2], funcs:sum(test.t.c)",
          "Group#2 Schema:[test.t.a,test.t.c]",
          "    Selection_4 input:[Group#3], gt(test.t.a, 10)",
          "Group#3 Schema:[test.t.a,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select sum(case when a > 0 then (case when a <= 1000 then b end) else 0 end) from t",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_7 input:[Group#2], funcs:sum(test.t.b)",
          "Group#2 Schema:[test.t.a,test.t.b]",
          "    Selection_6 input:[Group#3], le(test.t.a, 1000)",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    Selection_4 input:[Group#4], gt(test.t.a, 0)",
          "Group#4 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select sum(case when a > 10 then 0 else c end) from t",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_5 input:[Group#2], funcs:sum(test.t.c)",
          "Group#2 Schema:[test.t.a,test.t.c]",
          "    Selection_4 input:[Group#3], not(gt(test.t.a, 10))",
          "Group#3 Schema:[test.t.a,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select sum(case when a > 10 then 2 else 1 end) from t",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_2 input:[Group#2], funcs:sum(case(gt(test.t.a, 10), 2, 1))",
          "Group#2 Schema:[test.t.a]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select count(DISTINCT case when a > 10 then null else c end) from t",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_5 input:[Group#2], funcs:count(distinct test.t.c)",
          "Group#2 Schema:[test.t.a,test.t.c]",
          "    Selection_4 input:[Group#3], not(gt(test.t.a, 10))",
          "Group#3 Schema:[test.t.a,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select approx_count_distinct(case when a > 10 then null else c end) from t",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_5 input:[Group#2], funcs:approx_count_distinct(test.t.c)",
          "Group#2 Schema:[test.t.a,test.t.c]",
          "    Selection_4 input:[Group#3], not(gt(test.t.a, 10))",
          "Group#3 Schema:[test.t.a,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select sum(DISTINCT case when a > 10 then c else 0 end) from t",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_2 input:[Group#2], funcs:sum(distinct case(gt(test.t.a, 10), test.t.c, 0))",
          "Group#2 Schema:[test.t.a,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select case when c > 10 then c end from t",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_2 input:[Group#1], case(gt(test.t.c, 10), test.t.c)->Column#13",
          "Group#1 Schema:[test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select count(case when a > 10 then c end), c from t",
        "Result": [
          "Group#0 Schema:[Column#13,test.t.c]",
          "    Projection_3 input:[Group#1], Column#13, test.t.c",
          "Group#1 Schema:[Column#13,test.t.c]",
          "    Aggregation_2 input:[Group#2], funcs:count(case(gt(test.t.a, 10), test.t.c)), firstrow(test.t.c)",
          "Group#2 Schema:[test.t.a,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select count(case when a > 10 and d < 5 then b end) from t",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_5 input:[Group#2], funcs:count(test.t.b)",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.d]",
          "    Selection_4 input:[Group#3], gt(test.t.a, 10), lt(test.t.d, 5)",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.d]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select count(case when a > 10 and d < 5 then null else b end) from t",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_5 input:[Group#2], funcs:count(test.t.b)",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.d]",
          "    Selection_4 input:[Group#3], not(and(gt(test.t.a, 10), lt(test.t.d, 5)))",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.d]",
          "    DataSource_1 table:t"
        ]
      }
    ]
  },
  {
    "Name": "TestTransformAggToProj",
    "Cases": [
      {
        "SQL": "select count(b) from t group by a",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_5 input:[Group#1], 1->Column#13",
          "Group#1 Schema:[test.t.a,test.t.b], UniqueKey:[test.t.a]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select count(b) from t group by b",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_2 input:[Group#2], group by:test.t.b, funcs:count(test.t.b)",
          "Group#2 Schema:[test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select count(b) from t",
        "Result": [
          "Group#0 Schema:[Column#13]",
          "    Projection_3 input:[Group#1], Column#13",
          "Group#1 Schema:[Column#13]",
          "    Aggregation_2 input:[Group#2], funcs:count(test.t.b)",
          "Group#2 Schema:[test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a from t group by a having sum(b) > 4",
        "Result": [
          "Group#0 Schema:[test.t.a]",
          "    Projection_5 input:[Group#1], test.t.a",
          "Group#1 Schema:[test.t.a,Column#13]",
          "    Selection_4 input:[Group#2], gt(Column#13, 4)",
          "Group#2 Schema:[test.t.a,Column#13]",
          "    Projection_7 input:[Group#3], test.t.a, cast(test.t.b, decimal(32,0) BINARY)->Column#13",
          "Group#3 Schema:[test.t.a,test.t.b], UniqueKey:[test.t.a]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select count(b), sum(b), avg(b), b, max(b), min(b), bit_and(b), bit_or(b), bit_xor(b) from t group by a having sum(b) >= 0 and count(b) >= 0 order by b",
        "Result": [
          "Group#0 Schema:[Column#21,Column#22,Column#23,test.t.b,Column#25,Column#26,Column#27,Column#28,Column#29]",
          "    Projection_6 input:[Group#1], Column#13->Column#21, Column#14->Column#22, Column#15->Column#23, test.t.b, Column#16->Column#25, Column#17->Column#26, Column#18->Column#27, Column#19->Column#28, Column#20->Column#29",
          "Group#1 Schema:[Column#13,Column#14,Column#15,test.t.b,Column#16,Column#17,Column#18,Column#19,Column#20,Column#14,Column#13]",
          "    Sort_5 input:[Group#2], test.t.b",
          "Group#2 Schema:[Column#13,Column#14,Column#15,test.t.b,Column#16,Column#17,Column#18,Column#19,Column#20,Column#14,Column#13]",
          "    Selection_4 input:[Group#3], ge(Column#13, 0), ge(Column#14, 0)",
          "Group#3 Schema:[Column#13,Column#14,Column#15,test.t.b,Column#16,Column#17,Column#18,Column#19,Column#20,Column#14,Column#13]",
          "    Projection_8 input:[Group#4], 1->Column#13, cast(test.t.b, decimal(32,0) BINARY)->Column#14, cast(test.t.b, decimal(15,4) BINARY)->Column#15, test.t.b, test.t.b->Column#16, test.t.b->Column#17, ifnull(cast(test.t.b, bigint(21) UNSIGNED BINARY), 18446744073709551615)->Column#18, ifnull(cast(test.t.b, bigint(21) UNSIGNED BINARY), 0)->Column#19, ifnull(cast(test.t.b, bigint(21) UNSIGNED BINARY), 0)->Column#20, cast(test.t.b, decimal(32,0) BINARY)->Column#14, 1->Column#13",
          "Group#4 Schema:[test.t.a,test.t.b], UniqueKey:[test.t.a]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select count(b), sum(b), avg(b), f, max(c), min(c), bit_and(c), bit_or(d), bit_xor(g) from t group by a",
        "Result": [
          "Group#0 Schema:[Column#13,Column#14,Column#15,test.t.f,Column#16,Column#17,Column#18,Column#19,Column#20]",
          "    Projection_5 input:[Group#1], 1->Column#13, cast(test.t.b, decimal(32,0) BINARY)->Column#14, cast(test.t.b, decimal(15,4) BINARY)->Column#15, test.t.f, test.t.c->Column#16, test.t.c->Column#17, ifnull(cast(test.t.c, bigint(21) UNSIGNED BINARY), 18446744073709551615)->Column#18, ifnull(cast(test.t.d, bigint(21) UNSIGNED BINARY), 0)->Column#19, ifnull(cast(test.t.g, bigint(21) UNSIGNED BINARY), 0)->Column#20",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.f,test.t.g], UniqueKey:[test.t.f,test.t.f,test.t.g,test.t.a]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select count(b), sum(b), avg(b), f, max(c), min(c), bit_and(c), bit_or(d), bit_xor(g), var_pop(b) from t group by a",
        "Result": [
          "Group#0 Schema:[Column#13,Column#14,Column#15,test.t.f,Column#16,Column#17,Column#18,Column#19,Column#20,Column#21]",
          "    Projection_3 input:[Group#1], Column#13, Column#14, Column#15, test.t.f, Column#16, Column#17, Column#18, Column#19, Column#20, Column#21",
          "Group#1 Schema:[Column#13,Column#14,Column#15,Column#16,Column#17,Column#18,Column#19,Column#20,Column#21,test.t.f]",
          "    Aggregation_2 input:[Group#2], group by:test.t.a, funcs:count(test.t.b), sum(test.t.b), avg(test.t.b), max(test.t.c), min(test.t.c), bit_and(test.t.c), bit_or(test.t.d), bit_xor(test.t.g), var_pop(test.t.b), firstrow(test.t.f)",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.f,test.t.g], UniqueKey:[test.t.f,test.t.f,test.t.g,test.t.a]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select count(b), sum(b), avg(b), f, max(c), min(c), bit_and(c), bit_or(d), bit_xor(g), group_concat(b, c, d, f) from t group by a",
        "Result": [
          "Group#0 Schema:[Column#13,Column#14,Column#15,test.t.f,Column#16,Column#17,Column#18,Column#19,Column#20,Column#21]",
          "    Projection_3 input:[Group#1], Column#13, Column#14, Column#15, test.t.f, Column#16, Column#17, Column#18, Column#19, Column#20, Column#21",
          "Group#1 Schema:[Column#13,Column#14,Column#15,Column#16,Column#17,Column#18,Column#19,Column#20,Column#21,test.t.f]",
          "    Aggregation_2 input:[Group#2], group by:test.t.a, funcs:count(test.t.b), sum(test.t.b), avg(test.t.b), max(test.t.c), min(test.t.c), bit_and(test.t.c), bit_or(test.t.d), bit_xor(test.t.g), group_concat(test.t.b, test.t.c, test.t.d, test.t.f separator \",\"), firstrow(test.t.f)",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.f,test.t.g]",
          "    DataSource_1 table:t"
        ]
      }
    ]
  },
  {
    "Name": "TestDecorrelate",
    "Cases": [
      {
        "SQL": "select a from t t1 where exists (select 1 from t t2 where t1.a = t2.b)",
        "Result": [
          "Group#0 Schema:[test.t.a]",
          "    Projection_7 input:[Group#1], test.t.a",
          "Group#1 Schema:[test.t.a]",
          "    Apply_6 input:[Group#2,Group#3], semi join",
          "    Join_10 input:[Group#2,Group#4], semi join, equal:[eq(test.t.a, test.t.b)]",
          "Group#2 Schema:[test.t.a]",
          "    DataSource_1 table:t1",
          "Group#3 Schema:[test.t.b]",
          "    Selection_4 input:[Group#4], eq(test.t.a, test.t.b)",
          "Group#4 Schema:[test.t.b]",
          "    DataSource_3 table:t2"
        ]
      }
    ]
  },
  {
    "Name": "TestInjectProj",
    "Cases": [
      {
        "SQL": "select * from t order by (a+b) limit 10",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Projection_6 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,Column#13]",
          "    TopN_8 input:[Group#2], Column#13, offset:0, count:10",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date,Column#13]",
          "    Projection_7 input:[Group#3], test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date, plus(test.t.a, test.t.b)->Column#13",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    Projection_2 input:[Group#4], test.t.a, test.t.b, test.t.c, test.t.d, test.t.e, test.t.c_str, test.t.d_str, test.t.e_str, test.t.f, test.t.g, test.t.h, test.t.i_date",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,test.t.e,test.t.c_str,test.t.d_str,test.t.e_str,test.t.f,test.t.g,test.t.h,test.t.i_date]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select max(a), min(b), avg(c) from t group by a+b",
        "Result": [
          "Group#0 Schema:[Column#13,Column#14,Column#15]",
          "    Projection_3 input:[Group#1], Column#13, Column#14, Column#15",
          "Group#1 Schema:[Column#13,Column#14,Column#15]",
          "    Aggregation_5 input:[Group#2], group by:Column#17, funcs:max(test.t.a), min(test.t.b), avg(Column#16)",
          "Group#2 Schema:[test.t.a,test.t.b,Column#16,Column#17]",
          "    Projection_4 input:[Group#3], test.t.a, test.t.b, cast(test.t.c, decimal(10,0) BINARY)->Column#16, plus(test.t.a, test.t.b)->Column#17",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select max(a), min(b), avg(a / b) from t group by a",
        "Result": [
          "Group#0 Schema:[Column#13,Column#14,Column#15]",
          "    Projection_3 input:[Group#1], Column#13, Column#14, Column#15",
          "Group#1 Schema:[Column#13,Column#14,Column#15]",
          "    Aggregation_5 input:[Group#2], group by:test.t.a, funcs:max(test.t.a), min(test.t.b), avg(Column#16)",
          "Group#2 Schema:[test.t.a,test.t.b,Column#16,test.t.a]",
          "    Projection_4 input:[Group#3], test.t.a, test.t.b, div(cast(test.t.a, decimal(10,0) BINARY), cast(test.t.b, decimal(10,0) BINARY))->Column#16, test.t.a",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select max(a), min(b), avg(a / b) from t group by (a+b)",
        "Result": [
          "Group#0 Schema:[Column#13,Column#14,Column#15]",
          "    Projection_3 input:[Group#1], Column#13, Column#14, Column#15",
          "Group#1 Schema:[Column#13,Column#14,Column#15]",
          "    Aggregation_5 input:[Group#2], group by:Column#17, funcs:max(test.t.a), min(test.t.b), avg(Column#16)",
          "Group#2 Schema:[test.t.a,test.t.b,Column#16,Column#17]",
          "    Projection_4 input:[Group#3], test.t.a, test.t.b, div(cast(test.t.a, decimal(10,0) BINARY), cast(test.t.b, decimal(10,0) BINARY))->Column#16, plus(test.t.a, test.t.b)->Column#17",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t"
        ]
      }
    ]
  },
  {
    "Name": "TestMergeAdjacentWindow",
    "Cases": [
      {
        "SQL": "select a, b, max(b) over (partition by c), sum(c) over (partition by c) from t",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,Column#19,Column#20]",
          "    Projection_10 input:[Group#1], test.t.a, test.t.b, Column#16->Column#19, Column#15->Column#20",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,Column#15,Column#16]",
          "    Window_9 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, b, max(b) over (partition by c), sum(c) over (partition by a) from t",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,Column#19,Column#20]",
          "    Projection_9 input:[Group#1], test.t.a, test.t.b, Column#15->Column#19, Column#16->Column#20",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,Column#15,Column#16]",
          "    Window_6 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,Column#15]",
          "    Window_4 input:[Group#3]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, max(b) over (partition by c, d), sum(c) over (partition by c, d) from t",
        "Result": [
          "Group#0 Schema:[test.t.a,Column#18,Column#19]",
          "    Projection_10 input:[Group#1], test.t.a, Column#16->Column#18, Column#15->Column#19",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#15,Column#16]",
          "    Window_9 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, max(b) over (partition by c, d), sum(c) over (partition by d, c) from t",
        "Result": [
          "Group#0 Schema:[test.t.a,Column#18,Column#19]",
          "    Projection_10 input:[Group#1], test.t.a, Column#16->Column#18, Column#15->Column#19",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#15,Column#16]",
          "    Window_9 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, b, c, d, max(b) over (partition by c order by d desc), sum(d) over (partition by c order by d desc) from t",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#16,Column#15]",
          "    Projection_7 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, Column#16, Column#15",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#15,Column#16]",
          "    Window_8 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, b, c, d, max(b) over (partition by c order by d desc), sum(d) over (partition by c order by d) from t",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#15,Column#16]",
          "    Window_6 input:[Group#1]",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#15]",
          "    Window_4 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, b, c, d, max(b) over (partition by c order by d desc), sum(d) over (partition by a order by b desc) from t",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#15,Column#16]",
          "    Window_6 input:[Group#1]",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#15]",
          "    Window_4 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, b, c, d, max(b) over (partition by c order by d desc rows 2 preceding), sum(d) over (partition by c order by d desc rows 2 preceding) from t",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#16,Column#15]",
          "    Projection_7 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, Column#16, Column#15",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#15,Column#16]",
          "    Window_8 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, b, c, d, max(b) over (partition by c order by d desc rows between 2 preceding and 2 following), sum(d) over (partition by c order by d desc rows between 2 preceding and 2 following) from t",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#16,Column#15]",
          "    Projection_7 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, Column#16, Column#15",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#15,Column#16]",
          "    Window_8 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, b, c, d, max(b) over (partition by c order by d desc rows between 2 preceding and 2 following), sum(d) over (partition by c order by d desc rows between 3 preceding and 2 following) from t",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#16,Column#15]",
          "    Projection_7 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, Column#16, Column#15",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#15,Column#16]",
          "    Window_6 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#15]",
          "    Window_4 input:[Group#3]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, b, c, d, max(b) over (partition by c order by d desc rows between 3 preceding and 2 following), sum(d) over (partition by c order by d desc rows between 2 preceding and 2 following) from t",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#16,Column#15]",
          "    Projection_7 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, Column#16, Column#15",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#15,Column#16]",
          "    Window_6 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#15]",
          "    Window_4 input:[Group#3]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, b, c, d, max(b) over (partition by c order by d desc rows between 2 preceding and 2 following), sum(d) over (partition by c order by d desc range between 2 preceding and 2 following) from t",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#16,Column#15]",
          "    Projection_7 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, Column#16, Column#15",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#15,Column#16]",
          "    Window_6 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#15]",
          "    Window_4 input:[Group#3]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, b, c, d, max(b) over (partition by c order by d desc rows 2 preceding), sum(d) over (partition by c order by d desc range between unbounded preceding and current row) from t",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#16,Column#15]",
          "    Projection_7 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, Column#16, Column#15",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#15,Column#16]",
          "    Window_6 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#15]",
          "    Window_4 input:[Group#3]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, b, c, d, max(b) over (partition by c order by d desc rows 2 preceding), sum(d) over (partition by c order by d desc rows 3 preceding) from t",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#16,Column#15]",
          "    Projection_7 input:[Group#1], test.t.a, test.t.b, test.t.c, test.t.d, Column#16, Column#15",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#15,Column#16]",
          "    Window_6 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#15]",
          "    Window_4 input:[Group#3]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, b, max(b) over (partition by c), c, d, dd from (select a, b, c, d, sum(d) over (partition by c) as dd from t) as tt",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,Column#16,test.t.c,test.t.d,Column#14]",
          "    Projection_9 input:[Group#1], test.t.a, test.t.b, Column#16, test.t.c, test.t.d, Column#14",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#14,Column#16]",
          "    Window_10 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, b, max(b) over (partition by c), c, d, dd from (select a, b, c, d, sum(d) over (partition by a) as dd from t) as tt",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,Column#16,test.t.c,test.t.d,Column#14]",
          "    Projection_9 input:[Group#1], test.t.a, test.t.b, Column#16, test.t.c, test.t.d, Column#14",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#14,Column#16]",
          "    Window_8 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#14]",
          "    Window_4 input:[Group#3]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, b, rank() over (), max(b) over (partition by c), c, d, dd from (select a, b, c, d, sum(d) over (partition by c) as dd from t) as tt",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,Column#18,Column#17,test.t.c,test.t.d,Column#14]",
          "    Projection_11 input:[Group#1], test.t.a, test.t.b, Column#18, Column#17, test.t.c, test.t.d, Column#14",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#14,Column#17,Column#18]",
          "    Window_10 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,test.t.d,Column#14,Column#17]",
          "    Window_12 input:[Group#3]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,test.t.d]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, b, sum(bb) over (partition by a) as 'sum_bb' from (select a, b, max(b) over (partition by a) as 'bb' from t) as tt",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,Column#19]",
          "    Projection_11 input:[Group#1], test.t.a, test.t.b, Column#16->Column#19",
          "Group#1 Schema:[test.t.a,test.t.b,Column#14,Column#16]",
          "    Window_8 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,Column#14]",
          "    Window_4 input:[Group#3]",
          "Group#3 Schema:[test.t.a,test.t.b]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, b, sum(bb) over (partition by a) as 'sum_bb', c from (select a, b, c, max(b) over (partition by a) as 'bb' from t) as tt",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,Column#19,test.t.c]",
          "    Projection_11 input:[Group#1], test.t.a, test.t.b, Column#16->Column#19, test.t.c",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,Column#14,Column#16]",
          "    Window_8 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,Column#14]",
          "    Window_4 input:[Group#3]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, b, rank() over (partition by a), sum(bb) over (partition by a) as 'sum_bb', c from (select a, b, c, max(b) over (partition by a) as 'bb' from t) as tt",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,Column#21,Column#22,test.t.c]",
          "    Projection_13 input:[Group#1], test.t.a, test.t.b, Column#18->Column#21, Column#17->Column#22, test.t.c",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,Column#17,Column#18]",
          "    Window_10 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,Column#17]",
          "    Projection_9 input:[Group#3], test.t.a, test.t.b, test.t.c, Column#17",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,Column#14,Column#17]",
          "    Window_8 input:[Group#4]",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c,Column#14]",
          "    Window_4 input:[Group#5]",
          "Group#5 Schema:[test.t.a,test.t.b,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, b, sum(bb) over (partition by a) as 'sum_bb', c, rank() over (partition by a) from (select a, b, c, max(b) over (partition by a) as 'bb' from t) as tt",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,Column#21,test.t.c,Column#23]",
          "    Projection_14 input:[Group#1], test.t.a, test.t.b, Column#18->Column#21, test.t.c, Column#17->Column#23",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,Column#14,Column#17,Column#18]",
          "    Window_10 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,Column#14,Column#17]",
          "    Window_13 input:[Group#3]",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c]",
          "    DataSource_1 table:t"
        ]
      },
      {
        "SQL": "select a, b, sum(bb) over (partition by a) as 'sum_bb', c, rank() over () from (select a, b, c, max(b) over (partition by a) as 'bb' from t) as tt",
        "Result": [
          "Group#0 Schema:[test.t.a,test.t.b,Column#21,test.t.c,Column#23]",
          "    Projection_13 input:[Group#1], test.t.a, test.t.b, Column#17->Column#21, test.t.c, Column#18->Column#23",
          "Group#1 Schema:[test.t.a,test.t.b,test.t.c,Column#17,Column#18]",
          "    Window_10 input:[Group#2]",
          "Group#2 Schema:[test.t.a,test.t.b,test.t.c,Column#17]",
          "    Projection_9 input:[Group#3], test.t.a, test.t.b, test.t.c, Column#17",
          "Group#3 Schema:[test.t.a,test.t.b,test.t.c,Column#14,Column#17]",
          "    Window_8 input:[Group#4]",
          "Group#4 Schema:[test.t.a,test.t.b,test.t.c,Column#14]",
          "    Window_4 input:[Group#5]",
          "Group#5 Schema:[test.t.a,test.t.b,test.t.c]",
          "    DataSource_1 table:t"
        ]
      }
    ]
  }
]
