Skip to content

Commit cafba7a

Browse files
committed
Merge commit '8c5f58e8d18d14ce4c8bfab6d9b0c1ed575ba39c' into feat/add_disk_status_from_main
2 parents 40f20e3 + 8c5f58e commit cafba7a

File tree

72 files changed

+1610
-747
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1610
-747
lines changed

.github/workflows/sdk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ jobs:
294294
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
295295

296296
python-sdk-mac:
297-
runs-on: macos-latest
297+
runs-on: macos-12
298298
if: github.event_name == 'push'
299299
env:
300300
SQL_PYSDK_ENABLE: ON

cases/function/window/test_window_exclude_current_time.yaml

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ cases:
2020
- columns: [ "c1 string","c3 int","c4 double","c7 timestamp" ]
2121
indexs: [ "index1:c1:c7" ]
2222
rows:
23+
- [ "aa",-2, 1.0, 0 ]
24+
- [ "aa",-1, 1.0, 0 ]
25+
- [ "aa",0, 1.0, 0 ]
2326
- [ "aa",1, 1.0, 1590738990000 ]
2427
- [ "aa",2, 1.0, 1590738990000 ]
2528
- [ "aa",3, 1.0, 1590738992000 ]
@@ -38,6 +41,9 @@ cases:
3841
order: c3
3942
columns: [ "c1 string", "c3 int", "c7 timestamp", "w1_c4_sum double" ]
4043
rows:
44+
- [ "aa", -2, 0, 1.0 ]
45+
- [ "aa", -1, 0, 1.0 ]
46+
- [ "aa", 0, 0, 1.0 ]
4147
- [ "aa", 1, 1590738990000, 1.0 ]
4248
- [ "aa", 2, 1590738990000, 1.0 ]
4349
- [ "aa", 3, 1590738992000, 3.0 ]
@@ -86,15 +92,17 @@ cases:
8692
- columns: [ "c1 string","c3 int","c4 double","c7 timestamp" ]
8793
indexs: [ "index1:c1:c7" ]
8894
rows:
89-
- [ "aa",1, 1.0, 1590738990000 ]
90-
- [ "aa",2, 1.0, 1590738990000 ]
91-
- [ "aa",3, 1.0, 1590738992000 ]
92-
- [ "aa",4, 1.0, 1590738993000 ]
93-
- [ "aa",5, 1.0, 1590738994000 ]
94-
- [ "aa",6, 1.0, 1590738994000 ]
95-
- [ "aa",7, 1.0, 1590738999000 ]
96-
- [ "aa",8, 1.0, 1590739001000 ]
97-
- [ "aa",9, 1.0, 1590739002000 ]
95+
- [ "aa",-1, 1.0, 0 ]
96+
- [ "aa", 0, 1.0, 0 ]
97+
- [ "aa", 1, 1.0, 1590738990000 ]
98+
- [ "aa", 2, 1.0, 1590738990000 ]
99+
- [ "aa", 3, 1.0, 1590738992000 ]
100+
- [ "aa", 4, 1.0, 1590738993000 ]
101+
- [ "aa", 5, 1.0, 1590738994000 ]
102+
- [ "aa", 6, 1.0, 1590738994000 ]
103+
- [ "aa", 7, 1.0, 1590738999000 ]
104+
- [ "aa", 8, 1.0, 1590739001000 ]
105+
- [ "aa", 9, 1.0, 1590739002000 ]
98106
sql: |
99107
SELECT c1, c3, c7,
100108
sum(c4) OVER w1 as w1_c4_sum
@@ -104,6 +112,8 @@ cases:
104112
order: c3
105113
columns: [ "c1 string", "c3 int", "c7 timestamp", "w1_c4_sum double" ]
106114
rows:
115+
- [ "aa",-1, 0, 1.0 ]
116+
- [ "aa", 0, 0, 1.0 ]
107117
- [ "aa", 1, 1590738990000, 1.0 ]
108118
- [ "aa", 2, 1590738990000, 1.0 ]
109119
- [ "aa", 3, 1590738992000, 3.0 ]
@@ -119,15 +129,17 @@ cases:
119129
- columns: [ "c1 string","c3 int","c4 double","c7 timestamp" ]
120130
indexs: [ "index1:c1:c7" ]
121131
rows:
122-
- [ "aa",1, 1.0, 1590738990000 ]
123-
- [ "aa",2, 1.0, 1590738990000 ]
124-
- [ "aa",3, 1.0, 1590738992000 ]
125-
- [ "aa",4, 1.0, 1590738993000 ]
126-
- [ "aa",5, 1.0, 1590738994000 ]
127-
- [ "aa",6, 1.0, 1590738994000 ]
128-
- [ "aa",7, 1.0, 1590738999000 ]
129-
- [ "aa",8, 1.0, 1590739001000 ]
130-
- [ "aa",9, 1.0, 1590739002000 ]
132+
- [ "aa",-1, 1.0, 0]
133+
- [ "aa", 0, 1.0, 0]
134+
- [ "aa", 1, 1.0, 1590738990000 ]
135+
- [ "aa", 2, 1.0, 1590738990000 ]
136+
- [ "aa", 3, 1.0, 1590738992000 ]
137+
- [ "aa", 4, 1.0, 1590738993000 ]
138+
- [ "aa", 5, 1.0, 1590738994000 ]
139+
- [ "aa", 6, 1.0, 1590738994000 ]
140+
- [ "aa", 7, 1.0, 1590738999000 ]
141+
- [ "aa", 8, 1.0, 1590739001000 ]
142+
- [ "aa", 9, 1.0, 1590739002000 ]
131143
sql: |
132144
SELECT c1, c3, c7,
133145
sum(c4) OVER w1 as w1_c4_sum
@@ -137,12 +149,14 @@ cases:
137149
order: c3
138150
columns: [ "c1 string", "c3 int", "c7 timestamp", "w1_c4_sum double" ]
139151
rows:
140-
- [ "aa", 1, 1590738990000, 1.0 ]
141-
- [ "aa", 2, 1590738990000, 1.0 ]
142-
- [ "aa", 3, 1590738992000, 3.0 ]
143-
- [ "aa", 4, 1590738993000, 4.0 ]
144-
- [ "aa", 5, 1590738994000, 5.0 ]
145-
- [ "aa", 6, 1590738994000, 5.0 ]
152+
- [ "aa",-1, 0, 1.0 ]
153+
- [ "aa", 0, 0, 1.0 ]
154+
- [ "aa", 1, 1590738990000, 3.0 ]
155+
- [ "aa", 2, 1590738990000, 3.0 ]
156+
- [ "aa", 3, 1590738992000, 5.0 ]
157+
- [ "aa", 4, 1590738993000, 6.0 ]
158+
- [ "aa", 5, 1590738994000, 7.0 ]
159+
- [ "aa", 6, 1590738994000, 7.0 ]
146160
- [ "aa", 7, 1590738999000, 7.0 ]
147161
- [ "aa", 8, 1590739001000, 7.0 ]
148162
- [ "aa", 9, 1590739002000, 7.0 ]

cases/function/window/test_window_union.yaml

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,11 @@ cases:
733733
indexs:
734734
- idx:g:ts
735735
data: |
736-
1, 100, 111, 21
737-
2, 100, 111, 5
736+
0, 0, 111, 19
737+
1, 0, 111, 18
738+
2, 100, 111, 21
739+
3, 100, 111, 5
740+
4, 101, 111, 100
738741
- name: t2
739742
columns:
740743
- id int
@@ -747,6 +750,15 @@ cases:
747750
1, 99, 111, 233
748751
1, 100, 111, 200
749752
1, 101, 111, 17
753+
# raw union window (before filter)
754+
# 0, 0, 111, 19
755+
# 1, 0, 111, 18
756+
# 1, 99, 111, 233 (t2)
757+
# 1, 100, 111, 200 (t2)
758+
# 2, 100, 111, 21
759+
# 3, 100, 111, 5
760+
# 1, 101, 111, 17 (t2)
761+
# 4, 101, 111, 100
750762
sql: |
751763
select
752764
id, count(val) over w as cnt,
@@ -766,8 +778,11 @@ cases:
766778
- l1 int
767779
order: id
768780
data: |
769-
1, 2, 233, 21, 233
770-
2, 2, 233, 5, 233
781+
0, 1, 19, 19, NULL
782+
1, 1, 18, 18, NULL
783+
2, 4, 233, 18, 233
784+
3, 4, 233, 5, 233
785+
4, 7, 233, 5, 5
771786
772787
- id: 18-5
773788
desc: |
@@ -1230,7 +1245,7 @@ cases:
12301245
3, 2, 233, 200, 200
12311246
4, 3, 233, 17, 17
12321247
1233-
# rows_range union window with exclude current_row, single window
1248+
# rows_range union window with exclude current_row, single window
12341249
- id: 24
12351250
desc: |
12361251
rows_range union window with exclude_current_row
@@ -1314,6 +1329,9 @@ cases:
13141329
2, 100, 111, 5
13151330
3, 101, 111, 0
13161331
4, 102, 111, 0
1332+
5, 0, 114, 7
1333+
6, 0, 114, 8
1334+
7, 100, 114, 9
13171335
- name: t2
13181336
columns:
13191337
- id int
@@ -1363,6 +1381,9 @@ cases:
13631381
2, 1, 233, 233
13641382
3, 4, 233, 5
13651383
4, 6, 233, 0
1384+
5, 0, NULL, NULL
1385+
6, 0, NULL, NULL
1386+
7, 2, 8, 7
13661387
- id: 26
13671388
desc: |
13681389
rows_range union window with exclude_current_row and instance_not_in_window
@@ -1647,6 +1668,10 @@ cases:
16471668
2, 100, 111, 5
16481669
3, 101, 111, 0
16491670
4, 102, 111, 0
1671+
5, 0, 114, 9
1672+
6, 0, 114, 17
1673+
7, 100, 114, 11
1674+
8, 101, 114, 14
16501675
- name: t2
16511676
columns:
16521677
- id int
@@ -1697,3 +1722,7 @@ cases:
16971722
2, 1, 233, 233
16981723
3, 2, 21, 5
16991724
4, 2, 17, 0
1725+
5, 0, NULL, NULL
1726+
6, 0, NULL, NULL
1727+
7, 2, 17, 9
1728+
8, 2, 17, 11

cases/function/window/window_attributes.yaml

Lines changed: 62 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ cases:
1818
indexs:
1919
- idx:g:ts
2020
data: |
21-
1, 99000, 111, 21
22-
2, 100000, 111, 22
23-
3, 101000, 111, 23
24-
4, 100000, 114, 56
21+
0, 0, 111, 0
22+
1, 0, 111, 0
23+
2, 99000, 111, 21
24+
3, 100000, 111, 22
25+
4, 101000, 111, 23
26+
5, 100000, 114, 56
2527
sql: |
2628
select
2729
id,
@@ -58,10 +60,12 @@ cases:
5860
- l1 int
5961
order: id
6062
data: |
61-
1, 0, NULL, NULL, NULL
62-
2, 1, 21, 21, 21
63-
3, 2, 22, 21, 22
64-
4, 0, NULL, NULL, NULL
63+
0, 0, NULL, NULL, NULL
64+
1, 1, 0, 0, 0
65+
2, 0, NULL, NULL, 0
66+
3, 1, 21, 21, 21
67+
4, 2, 22, 21, 22
68+
5, 0, NULL, NULL, NULL
6569
- id: 1
6670
desc: |
6771
ROWS window with exclude_current_row, '0 PRECEDING EXCLUDE CURRENT_ROW' actually is the same as '0 OPEN PRECEDING'
@@ -89,7 +93,6 @@ cases:
8993
from t1 window w as(
9094
partition by `g` order by `ts`
9195
ROWS between 2 PRECEDING and 0 preceding EXCLUDE CURRENT_ROW);
92-
# batch_plan: |
9396
expect:
9497
columns:
9598
- id int
@@ -478,3 +481,53 @@ cases:
478481
4, 3, 23, 21, 23
479482
5, 0, NULL, NULL, NULL
480483
6, 1, 56, 56, 56
484+
- id: 9
485+
desc: |
486+
ROWS Window with exclude current_time and exclude current_row
487+
inputs:
488+
- name: t1
489+
columns:
490+
- id int
491+
- ts timestamp
492+
- g int
493+
- val int
494+
indexs:
495+
- idx:g:ts
496+
data: |
497+
1, 99000, 111, 21
498+
2, 100000, 111, 22
499+
3, 101000, 111, 23
500+
4, 102000, 111, 44
501+
5, 0, 114, 0
502+
6, 0, 114, 99
503+
7, 100000, 114, 56
504+
8, 102000, 114, 52
505+
9, 104000, 114, 33
506+
sql: |
507+
select
508+
id,
509+
count(val) over w as cnt,
510+
max(val) over w as mv,
511+
min(val) over w as mi,
512+
lag(val, 1) over w as l1
513+
FROM t1 WINDOW w as(
514+
PARTITION by `g` ORDER by `ts`
515+
ROWS BETWEEN 3 PRECEDING AND CURRENT ROW EXCLUDE CURRENT_TIME EXCLUDE CURRENT_ROW);
516+
expect:
517+
columns:
518+
- id int
519+
- cnt int64
520+
- mv int
521+
- mi int
522+
- l1 int
523+
order: id
524+
data: |
525+
1, 0, NULL, NULL, NULL
526+
2, 1, 21, 21, 21
527+
3, 2, 22, 21, 22
528+
4, 3, 23, 21, 23
529+
5, 0, NULL, NULL, NULL
530+
6, 0, NULL, NULL, NULL
531+
7, 2, 99, 0, 99
532+
8, 3, 99, 0, 56
533+
9, 3, 99, 52, 52

demo/init.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ set +e
2626
pkill python3
2727
set -e
2828

29-
rm -rf /tmp/*
29+
rm -rf /tmp/openmldb_offline_storage/*
3030
rm -rf /work/openmldb/logs*
3131
rm -rf /work/openmldb/db*
3232
sleep 2
@@ -36,7 +36,7 @@ if [[ "$MODE" = "standalone" ]]; then
3636
cd /work/openmldb && ./bin/stop-standalone.sh && ./bin/start-standalone.sh
3737
sleep 1
3838
else
39-
cd /work/zookeeper-3.4.14 && ./bin/zkServer.sh restart
39+
cd /work/zookeeper-3.4.14 && ./bin/zkServer.sh stop && rm -rf /tmp/zookeeper && ./bin/zkServer.sh start
4040
sleep 1
4141
cd /work/openmldb && ./bin/stop-all.sh && ./bin/start-all.sh
4242
fi

0 commit comments

Comments
 (0)