use test;
drop table if exists t;
create table t (a int, b int, c timestamp, index idx(a));
set @@tidb_enable_window_function = 1;
explain select sum(a) over() from t;
id	count	task	operator info
Projection_7	10000.00	root	sum(a) over()
└─Window_8	10000.00	root	sum(cast(test.t.a)) over()
  └─TableReader_10	10000.00	root	data:TableScan_9
    └─TableScan_9	10000.00	cop	table:t, range:[-inf,+inf], keep order:false, stats:pseudo
explain select sum(a) over(partition by a) from t;
id	count	task	operator info
Projection_7	10000.00	root	sum(a) over(partition by a)
└─Window_8	10000.00	root	sum(cast(test.t.a)) over(partition by test.t.a)
  └─IndexReader_10	10000.00	root	index:IndexScan_9
    └─IndexScan_9	10000.00	cop	table:t, index:a, range:[NULL,+inf], keep order:true, stats:pseudo
explain select sum(a) over(partition by a order by b) from t;
id	count	task	operator info
Projection_7	10000.00	root	sum(a) over(partition by a order by b)
└─Window_8	10000.00	root	sum(cast(test.t.a)) over(partition by test.t.a order by test.t.b asc range between unbounded preceding and current row)
  └─Sort_11	10000.00	root	test.t.a:asc, test.t.b:asc
    └─TableReader_10	10000.00	root	data:TableScan_9
      └─TableScan_9	10000.00	cop	table:t, range:[-inf,+inf], keep order:false, stats:pseudo
explain select sum(a) over(partition by a order by b rows unbounded preceding) from t;
id	count	task	operator info
Projection_7	10000.00	root	sum(a) over(partition by a order by b rows unbounded preceding)
└─Window_8	10000.00	root	sum(cast(test.t.a)) over(partition by test.t.a order by test.t.b asc rows between unbounded preceding and current row)
  └─Sort_11	10000.00	root	test.t.a:asc, test.t.b:asc
    └─TableReader_10	10000.00	root	data:TableScan_9
      └─TableScan_9	10000.00	cop	table:t, range:[-inf,+inf], keep order:false, stats:pseudo
explain select sum(a) over(partition by a order by b rows between 1 preceding and 1 following) from t;
id	count	task	operator info
Projection_7	10000.00	root	sum(a) over(partition by a order by b rows between 1 preceding and 1 following)
└─Window_8	10000.00	root	sum(cast(test.t.a)) over(partition by test.t.a order by test.t.b asc rows between 1 preceding and 1 following)
  └─Sort_11	10000.00	root	test.t.a:asc, test.t.b:asc
    └─TableReader_10	10000.00	root	data:TableScan_9
      └─TableScan_9	10000.00	cop	table:t, range:[-inf,+inf], keep order:false, stats:pseudo
explain select sum(a) over(partition by a order by b range between 1 preceding and 1 following) from t;
id	count	task	operator info
Projection_7	10000.00	root	sum(a) over(partition by a order by b range between 1 preceding and 1 following)
└─Window_8	10000.00	root	sum(cast(test.t.a)) over(partition by test.t.a order by test.t.b asc range between 1 preceding and 1 following)
  └─Sort_11	10000.00	root	test.t.a:asc, test.t.b:asc
    └─TableReader_10	10000.00	root	data:TableScan_9
      └─TableScan_9	10000.00	cop	table:t, range:[-inf,+inf], keep order:false, stats:pseudo
explain select sum(a) over(partition by a order by c range between interval '2:30' minute_second preceding and interval '2:30' minute_second following) from t;
id	count	task	operator info
Projection_7	10000.00	root	sum(a) over(partition by a order by c range between interval '2:30' minute_second preceding and interval '2:30' minute_second following)
└─Window_8	10000.00	root	sum(cast(test.t.a)) over(partition by test.t.a order by test.t.c asc range between interval "2:30" "MINUTE_SECOND" preceding and interval "2:30" "MINUTE_SECOND" following)
  └─Sort_11	10000.00	root	test.t.a:asc, test.t.c:asc
    └─TableReader_10	10000.00	root	data:TableScan_9
      └─TableScan_9	10000.00	cop	table:t, range:[-inf,+inf], keep order:false, stats:pseudo
