Skip to content

Commit

Permalink
Merge commit '8c5f58e8d18d14ce4c8bfab6d9b0c1ed575ba39c' into feat/add…
Browse files Browse the repository at this point in the history
…_disk_status_from_main
  • Loading branch information
Leowner committed Jul 21, 2022
2 parents 40f20e3 + 8c5f58e commit cafba7a
Show file tree
Hide file tree
Showing 72 changed files with 1,610 additions and 747 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ jobs:
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

python-sdk-mac:
runs-on: macos-latest
runs-on: macos-12
if: github.event_name == 'push'
env:
SQL_PYSDK_ENABLE: ON
Expand Down
62 changes: 38 additions & 24 deletions cases/function/window/test_window_exclude_current_time.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ cases:
- columns: [ "c1 string","c3 int","c4 double","c7 timestamp" ]
indexs: [ "index1:c1:c7" ]
rows:
- [ "aa",-2, 1.0, 0 ]
- [ "aa",-1, 1.0, 0 ]
- [ "aa",0, 1.0, 0 ]
- [ "aa",1, 1.0, 1590738990000 ]
- [ "aa",2, 1.0, 1590738990000 ]
- [ "aa",3, 1.0, 1590738992000 ]
Expand All @@ -38,6 +41,9 @@ cases:
order: c3
columns: [ "c1 string", "c3 int", "c7 timestamp", "w1_c4_sum double" ]
rows:
- [ "aa", -2, 0, 1.0 ]
- [ "aa", -1, 0, 1.0 ]
- [ "aa", 0, 0, 1.0 ]
- [ "aa", 1, 1590738990000, 1.0 ]
- [ "aa", 2, 1590738990000, 1.0 ]
- [ "aa", 3, 1590738992000, 3.0 ]
Expand Down Expand Up @@ -86,15 +92,17 @@ cases:
- columns: [ "c1 string","c3 int","c4 double","c7 timestamp" ]
indexs: [ "index1:c1:c7" ]
rows:
- [ "aa",1, 1.0, 1590738990000 ]
- [ "aa",2, 1.0, 1590738990000 ]
- [ "aa",3, 1.0, 1590738992000 ]
- [ "aa",4, 1.0, 1590738993000 ]
- [ "aa",5, 1.0, 1590738994000 ]
- [ "aa",6, 1.0, 1590738994000 ]
- [ "aa",7, 1.0, 1590738999000 ]
- [ "aa",8, 1.0, 1590739001000 ]
- [ "aa",9, 1.0, 1590739002000 ]
- [ "aa",-1, 1.0, 0 ]
- [ "aa", 0, 1.0, 0 ]
- [ "aa", 1, 1.0, 1590738990000 ]
- [ "aa", 2, 1.0, 1590738990000 ]
- [ "aa", 3, 1.0, 1590738992000 ]
- [ "aa", 4, 1.0, 1590738993000 ]
- [ "aa", 5, 1.0, 1590738994000 ]
- [ "aa", 6, 1.0, 1590738994000 ]
- [ "aa", 7, 1.0, 1590738999000 ]
- [ "aa", 8, 1.0, 1590739001000 ]
- [ "aa", 9, 1.0, 1590739002000 ]
sql: |
SELECT c1, c3, c7,
sum(c4) OVER w1 as w1_c4_sum
Expand All @@ -104,6 +112,8 @@ cases:
order: c3
columns: [ "c1 string", "c3 int", "c7 timestamp", "w1_c4_sum double" ]
rows:
- [ "aa",-1, 0, 1.0 ]
- [ "aa", 0, 0, 1.0 ]
- [ "aa", 1, 1590738990000, 1.0 ]
- [ "aa", 2, 1590738990000, 1.0 ]
- [ "aa", 3, 1590738992000, 3.0 ]
Expand All @@ -119,15 +129,17 @@ cases:
- columns: [ "c1 string","c3 int","c4 double","c7 timestamp" ]
indexs: [ "index1:c1:c7" ]
rows:
- [ "aa",1, 1.0, 1590738990000 ]
- [ "aa",2, 1.0, 1590738990000 ]
- [ "aa",3, 1.0, 1590738992000 ]
- [ "aa",4, 1.0, 1590738993000 ]
- [ "aa",5, 1.0, 1590738994000 ]
- [ "aa",6, 1.0, 1590738994000 ]
- [ "aa",7, 1.0, 1590738999000 ]
- [ "aa",8, 1.0, 1590739001000 ]
- [ "aa",9, 1.0, 1590739002000 ]
- [ "aa",-1, 1.0, 0]
- [ "aa", 0, 1.0, 0]
- [ "aa", 1, 1.0, 1590738990000 ]
- [ "aa", 2, 1.0, 1590738990000 ]
- [ "aa", 3, 1.0, 1590738992000 ]
- [ "aa", 4, 1.0, 1590738993000 ]
- [ "aa", 5, 1.0, 1590738994000 ]
- [ "aa", 6, 1.0, 1590738994000 ]
- [ "aa", 7, 1.0, 1590738999000 ]
- [ "aa", 8, 1.0, 1590739001000 ]
- [ "aa", 9, 1.0, 1590739002000 ]
sql: |
SELECT c1, c3, c7,
sum(c4) OVER w1 as w1_c4_sum
Expand All @@ -137,12 +149,14 @@ cases:
order: c3
columns: [ "c1 string", "c3 int", "c7 timestamp", "w1_c4_sum double" ]
rows:
- [ "aa", 1, 1590738990000, 1.0 ]
- [ "aa", 2, 1590738990000, 1.0 ]
- [ "aa", 3, 1590738992000, 3.0 ]
- [ "aa", 4, 1590738993000, 4.0 ]
- [ "aa", 5, 1590738994000, 5.0 ]
- [ "aa", 6, 1590738994000, 5.0 ]
- [ "aa",-1, 0, 1.0 ]
- [ "aa", 0, 0, 1.0 ]
- [ "aa", 1, 1590738990000, 3.0 ]
- [ "aa", 2, 1590738990000, 3.0 ]
- [ "aa", 3, 1590738992000, 5.0 ]
- [ "aa", 4, 1590738993000, 6.0 ]
- [ "aa", 5, 1590738994000, 7.0 ]
- [ "aa", 6, 1590738994000, 7.0 ]
- [ "aa", 7, 1590738999000, 7.0 ]
- [ "aa", 8, 1590739001000, 7.0 ]
- [ "aa", 9, 1590739002000, 7.0 ]
Expand Down
39 changes: 34 additions & 5 deletions cases/function/window/test_window_union.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -733,8 +733,11 @@ cases:
indexs:
- idx:g:ts
data: |
1, 100, 111, 21
2, 100, 111, 5
0, 0, 111, 19
1, 0, 111, 18
2, 100, 111, 21
3, 100, 111, 5
4, 101, 111, 100
- name: t2
columns:
- id int
Expand All @@ -747,6 +750,15 @@ cases:
1, 99, 111, 233
1, 100, 111, 200
1, 101, 111, 17
# raw union window (before filter)
# 0, 0, 111, 19
# 1, 0, 111, 18
# 1, 99, 111, 233 (t2)
# 1, 100, 111, 200 (t2)
# 2, 100, 111, 21
# 3, 100, 111, 5
# 1, 101, 111, 17 (t2)
# 4, 101, 111, 100
sql: |
select
id, count(val) over w as cnt,
Expand All @@ -766,8 +778,11 @@ cases:
- l1 int
order: id
data: |
1, 2, 233, 21, 233
2, 2, 233, 5, 233
0, 1, 19, 19, NULL
1, 1, 18, 18, NULL
2, 4, 233, 18, 233
3, 4, 233, 5, 233
4, 7, 233, 5, 5
- id: 18-5
desc: |
Expand Down Expand Up @@ -1230,7 +1245,7 @@ cases:
3, 2, 233, 200, 200
4, 3, 233, 17, 17
# rows_range union window with exclude current_row, single window
# rows_range union window with exclude current_row, single window
- id: 24
desc: |
rows_range union window with exclude_current_row
Expand Down Expand Up @@ -1314,6 +1329,9 @@ cases:
2, 100, 111, 5
3, 101, 111, 0
4, 102, 111, 0
5, 0, 114, 7
6, 0, 114, 8
7, 100, 114, 9
- name: t2
columns:
- id int
Expand Down Expand Up @@ -1363,6 +1381,9 @@ cases:
2, 1, 233, 233
3, 4, 233, 5
4, 6, 233, 0
5, 0, NULL, NULL
6, 0, NULL, NULL
7, 2, 8, 7
- id: 26
desc: |
rows_range union window with exclude_current_row and instance_not_in_window
Expand Down Expand Up @@ -1647,6 +1668,10 @@ cases:
2, 100, 111, 5
3, 101, 111, 0
4, 102, 111, 0
5, 0, 114, 9
6, 0, 114, 17
7, 100, 114, 11
8, 101, 114, 14
- name: t2
columns:
- id int
Expand Down Expand Up @@ -1697,3 +1722,7 @@ cases:
2, 1, 233, 233
3, 2, 21, 5
4, 2, 17, 0
5, 0, NULL, NULL
6, 0, NULL, NULL
7, 2, 17, 9
8, 2, 17, 11
71 changes: 62 additions & 9 deletions cases/function/window/window_attributes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ cases:
indexs:
- idx:g:ts
data: |
1, 99000, 111, 21
2, 100000, 111, 22
3, 101000, 111, 23
4, 100000, 114, 56
0, 0, 111, 0
1, 0, 111, 0
2, 99000, 111, 21
3, 100000, 111, 22
4, 101000, 111, 23
5, 100000, 114, 56
sql: |
select
id,
Expand Down Expand Up @@ -58,10 +60,12 @@ cases:
- l1 int
order: id
data: |
1, 0, NULL, NULL, NULL
2, 1, 21, 21, 21
3, 2, 22, 21, 22
4, 0, NULL, NULL, NULL
0, 0, NULL, NULL, NULL
1, 1, 0, 0, 0
2, 0, NULL, NULL, 0
3, 1, 21, 21, 21
4, 2, 22, 21, 22
5, 0, NULL, NULL, NULL
- id: 1
desc: |
ROWS window with exclude_current_row, '0 PRECEDING EXCLUDE CURRENT_ROW' actually is the same as '0 OPEN PRECEDING'
Expand Down Expand Up @@ -89,7 +93,6 @@ cases:
from t1 window w as(
partition by `g` order by `ts`
ROWS between 2 PRECEDING and 0 preceding EXCLUDE CURRENT_ROW);
# batch_plan: |
expect:
columns:
- id int
Expand Down Expand Up @@ -478,3 +481,53 @@ cases:
4, 3, 23, 21, 23
5, 0, NULL, NULL, NULL
6, 1, 56, 56, 56
- id: 9
desc: |
ROWS Window with exclude current_time and exclude current_row
inputs:
- name: t1
columns:
- id int
- ts timestamp
- g int
- val int
indexs:
- idx:g:ts
data: |
1, 99000, 111, 21
2, 100000, 111, 22
3, 101000, 111, 23
4, 102000, 111, 44
5, 0, 114, 0
6, 0, 114, 99
7, 100000, 114, 56
8, 102000, 114, 52
9, 104000, 114, 33
sql: |
select
id,
count(val) over w as cnt,
max(val) over w as mv,
min(val) over w as mi,
lag(val, 1) over w as l1
FROM t1 WINDOW w as(
PARTITION by `g` ORDER by `ts`
ROWS BETWEEN 3 PRECEDING AND CURRENT ROW EXCLUDE CURRENT_TIME EXCLUDE CURRENT_ROW);
expect:
columns:
- id int
- cnt int64
- mv int
- mi int
- l1 int
order: id
data: |
1, 0, NULL, NULL, NULL
2, 1, 21, 21, 21
3, 2, 22, 21, 22
4, 3, 23, 21, 23
5, 0, NULL, NULL, NULL
6, 0, NULL, NULL, NULL
7, 2, 99, 0, 99
8, 3, 99, 0, 56
9, 3, 99, 52, 52
4 changes: 2 additions & 2 deletions demo/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ set +e
pkill python3
set -e

rm -rf /tmp/*
rm -rf /tmp/openmldb_offline_storage/*
rm -rf /work/openmldb/logs*
rm -rf /work/openmldb/db*
sleep 2
Expand All @@ -36,7 +36,7 @@ if [[ "$MODE" = "standalone" ]]; then
cd /work/openmldb && ./bin/stop-standalone.sh && ./bin/start-standalone.sh
sleep 1
else
cd /work/zookeeper-3.4.14 && ./bin/zkServer.sh restart
cd /work/zookeeper-3.4.14 && ./bin/zkServer.sh stop && rm -rf /tmp/zookeeper && ./bin/zkServer.sh start
sleep 1
cd /work/openmldb && ./bin/stop-all.sh && ./bin/start-all.sh
fi
Expand Down
Loading

0 comments on commit cafba7a

Please sign in to comment.