Skip to content

Commit

Permalink
add ft
Browse files Browse the repository at this point in the history
  • Loading branch information
xzhangxian1008 committed May 8, 2023
1 parent 4d24724 commit 5c3d0b0
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion tests/fullstack-test/mpp/window.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 PingCAP, Ltd.
# Copyright 2023 PingCAP, Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,3 +55,55 @@ mysql> use test; set @@tidb_isolation_read_engines='tiflash'; select count(*) fr
+----------+
mysql> drop table if exists test.t1;
mysql> drop table if exists test.t2;

# Test first_value
mysql> drop table if exists test.first;
mysql> create table test.first(p int not null, o int not null, v varchar(30) null);
mysql> insert into first values (0, 0, "1"), (1, 1, "2"), (1, 2, "3"), (1, 3, "4"), (1, 4, "5"), (2, 5, "6"), (2, 6, "7"), (2, 7, "8"), (2, 8, "9"), (2, 9, "10"), (3, 10, "11"), (3, 11, "12"), (3, 12, "13");
mysql> alter table test.first set tiflash replica 1;

mysql> drop table if exists test.first1;
mysql> create table test.first1(p int not null, o int not null, v varchar(30) null);
mysql> insert into first1 values (0, 0, null), (1, 1, null), (1, 2, "3"), (1, 3, "4"), (1, 4, "5"), (2, 5, null), (2, 6, "7"), (2, 7, "8"), (2, 8, "9"), (2, 9, "10"), (3, 10, null), (3, 11, "12"), (3, 12, "13");
mysql> alter table test.first1 set tiflash replica 1;

func> wait_table test first
func> wait_table test first1

mysql> use test; set enforce_tidb_mpp=1; select *, first_value(v) over (partition by p order by o asc) as a from first;
+---+----+------+------+
| p | o | v | a |
+---+----+------+------+
| 0 | 0 | 1 | 1 |
| 1 | 1 | 2 | 2 |
| 1 | 2 | 3 | 2 |
| 1 | 3 | 4 | 2 |
| 1 | 4 | 5 | 2 |
| 3 | 10 | 11 | 11 |
| 3 | 11 | 12 | 11 |
| 3 | 12 | 13 | 11 |
| 2 | 5 | 6 | 6 |
| 2 | 6 | 7 | 6 |
| 2 | 7 | 8 | 6 |
| 2 | 8 | 9 | 6 |
| 2 | 9 | 10 | 6 |
+---+----+------+------+

mysql> use test; set enforce_tidb_mpp=1; select *, first_value(v) over (partition by p order by o asc) as a from first;
+---+----+------+------+
| p | o | v | a |
+---+----+------+------+
| 0 | 0 | NULL | NULL |
| 1 | 1 | NULL | NULL |
| 1 | 2 | 3 | NULL |
| 1 | 3 | 4 | NULL |
| 1 | 4 | 5 | NULL |
| 3 | 10 | NULL | NULL |
| 3 | 11 | 12 | NULL |
| 3 | 12 | 13 | NULL |
| 2 | 5 | NULL | NULL |
| 2 | 6 | 7 | NULL |
| 2 | 7 | 8 | NULL |
| 2 | 8 | 9 | NULL |
| 2 | 9 | 10 | NULL |
+---+----+------+------+

0 comments on commit 5c3d0b0

Please sign in to comment.