Skip to content

Commit

Permalink
update case (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
wuyou10206 authored Aug 19, 2021
1 parent be815c8 commit 237fa28
Show file tree
Hide file tree
Showing 5 changed files with 309 additions and 5 deletions.
25 changes: 24 additions & 1 deletion cases/function/ddl/test_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,30 @@ cases:
options:
partitionNum: 4
replicaNum: 1

-
id: 22
desc: test-case
inputs:
-
columns : ["c1 string","c2 smallint","c3 int","c4 bigint","c5 float","c6 double","c7 timestamp","c8 date","c9 bool"]
indexs: ["index1:c1:c7"]
replicaNum: 3
partitionNum: 1
distribution:
- leader: "{tb_endpoint_1}"
followers: [ "{tb_endpoint_0}","{tb_endpoint_2}" ]
rows:
- ["aa",1,2,3,1.1,2.1,1590738989000,"2020-05-01",true]
sql: select * from {0};
expect:
name: "{0}"
success: true
columns : ["c1 string","c2 smallint","c3 int","c4 bigint","c5 float","c6 double","c7 timestamp","c8 date","c9 bool"]
rows:
- ["aa",1,2,3,1.1,2.1,1590738989000,"2020-05-01",true]
options:
partitionNum: 1
replicaNum: 3



Expand Down
1 change: 1 addition & 0 deletions cases/function/ddl/test_ttl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ cases:
-
id: 6
desc: ttl_type=absolute-ttl=(3650m)
tags: ["TODO","bug:https://github.com/4paradigm/OpenMLDB/issues/189"]
sql: create table {auto} (c1 string NOT NULL,c2 int,c3 timestamp, c4 timestamp,index(key=(c1),ts=c4,ttl=(3650m),ttl_type=absolute));
expect:
success: false
Expand Down
278 changes: 278 additions & 0 deletions cases/function/dml/test_insert_prepared.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,278 @@
# Copyright 2021 4Paradigm
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

db: test_zw
debugs: []
cases:
-
id: 0
desc: 插入所有类型的数据
inputs:
-
columns : ["c1 string","c2 smallint","c3 int","c4 bigint","c5 float","c6 double","c7 timestamp","c8 date"]
indexs: ["index1:c1:c7"]
rows:
- ["aa",1,2,3,1.1,2.1,1590738989000,"2020-05-01"]
sql: select * from {0};
expect:
columns : ["c1 string","c2 smallint","c3 int","c4 bigint","c5 float","c6 double","c7 timestamp","c8 date"]
rows:
- ["aa",1,2,3,1.1,2.1,1590738989000,"2020-05-01"]
-
id: 1
desc: 插入所有列的数据
sqlDialect: ["HybridSQL"]
inputs:
-
create: |
create table {0} (c1 string, c3 int, c4 bigint, c5 float, c6 double, c7 timestamp, c8 date,
index(key=(c1), ts=c7));
insert: insert into {0} values(?,?,?,?,?,?,?);
rows:
- ["aa",2,3,1.1,2.1,1590738989000,"2020-05-01"]
sql: select * from {0};
expect:
columns : ["c1 string", "c3 int","c4 bigint","c5 float","c6 double","c7 timestamp","c8 date"]
rows:
- ["aa",2,3,1.1,2.1,1590738989000,"2020-05-01"]
-
id: 2
desc: 插入部分列数据
sqlDialect: ["HybridSQL"]
inputs:
-
create: |
create table {0} (c1 string, c3 int, c4 bigint, c5 float, c6 double, c7 timestamp, c8 date,
index(key=(c1), ts=c7));
insert: insert into {0} (c1,c4,c7) values(?,?,?);
rows:
- ["aa",2,1590738989000]
sql: select * from {0};
expect:
columns : ["c1 string","c3 int","c4 bigint","c5 float","c6 double","c7 timestamp","c8 date"]
rows:
- ["aa",null,2,null,null,1590738989000,null]
-
id: 3
desc: 没有指定NotNull的列插入null
sqlDialect: ["HybridSQL"]
inputs:
-
create: |
create table {0} (c1 string, c3 int, c4 bigint, c5 float, c6 double, c7 timestamp, c8 date,
index(key=(c1), ts=c7));
insert: insert into {0} (c1,c3,c4,c5,c6,c7,c8) values(?,?,?,?,?,?,?);
rows:
- ["aa",2,null,null,null,1590738989000,null]
sql: select * from {0};
expect:
columns : ["c1 string","c3 int","c4 bigint","c5 float","c6 double","c7 timestamp","c8 date"]
rows:
- ["aa",2,null,null,null,1590738989000,null]
-
id: 4
desc: 字符串类型插入空串
sqlDialect: ["HybridSQL"]
inputs:
-
create: |
create table {0} ( c1 string NOT NULL, c2 timestamp,
index(key=(c1), ts=c2));
insert: insert into {0} (c1,c2) values(?,?);
rows:
- ["",1590738989000]
sql: select * from {0};
expect:
columns : ["c1 string","c2 timestamp"]
rows:
- ["",1590738989000]
-
id: 5
desc: 相同时间戳数据
inputs:
-
columns : ["c1 string","c2 smallint","c3 int","c4 bigint","c5 float","c6 double","c7 timestamp","c8 date"]
indexs: ["index1:c1:c7"]
rows:
- ["aa",1,2,3,1.1,2.1,1590738989000,"2020-05-01"]
- ["aa",2,2,3,1.1,2.1,1590738989000,"2020-05-01"]
- ["aa",3,2,3,1.1,2.1,1590738989000,"2020-05-01"]
- ["aa",4,2,3,1.1,2.1,1590738989000,"2020-05-01"]
- ["aa",5,2,3,1.1,2.1,1590738989000,"2020-05-01"]
- ["aa",6,2,3,1.1,2.1,1590738989000,"2020-05-01"]
- ["aa",7,2,3,1.1,2.1,1590738989000,"2020-05-01"]
- ["aa",8,2,3,1.1,2.1,1590738989000,"2020-05-01"]
- ["aa",9,2,3,1.1,2.1,1590738989000,"2020-05-01"]
- ["aa",10,2,3,1.1,2.1,1590738989000,"2020-05-01"]
- ["aa",11,2,3,1.1,2.1,1590738989000,"2020-05-01"]
- ["aa",12,2,3,1.1,2.1,1590738989000,"2020-05-01"]
- ["aa",13,2,3,1.1,2.1,1590738989000,"2020-05-01"]
- ["aa",14,2,3,1.1,2.1,1590738989000,"2020-05-01"]
- ["aa",15,2,3,1.1,2.1,1590738989000,"2020-05-01"]
- ["aa",16,2,3,1.1,2.1,1590738989000,"2020-05-01"]
- ["aa",17,2,3,1.1,2.1,1590738989000,"2020-05-01"]
- ["aa",18,2,3,1.1,2.1,1590738989000,"2020-05-01"]
- ["aa",19,2,3,1.1,2.1,1590738989000,"2020-05-01"]
- ["aa",20,2,3,1.1,2.1,1590738989000,"2020-05-01"]
sql: select * from {0};
expect:
columns : ["c1 string","c2 smallint","c3 int","c4 bigint","c5 float","c6 double","c7 timestamp","c8 date"]
order: c2
rows:
- [ "aa",1,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
- [ "aa",2,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
- [ "aa",3,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
- [ "aa",4,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
- [ "aa",5,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
- [ "aa",6,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
- [ "aa",7,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
- [ "aa",8,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
- [ "aa",9,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
- [ "aa",10,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
- [ "aa",11,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
- [ "aa",12,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
- [ "aa",13,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
- [ "aa",14,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
- [ "aa",15,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
- [ "aa",16,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
- [ "aa",17,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
- [ "aa",18,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
- [ "aa",19,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
- [ "aa",20,2,3,1.1,2.1,1590738989000,"2020-05-01" ]
-
id: 6
desc: 时间年初
inputs:
-
columns : ["c1 string","c2 smallint","c3 int","c7 timestamp","c8 date"]
indexs: ["index1:c1:c7"]
rows:
- ["aa",1,2,1590738989000,"2020-01-01"]
sql: select * from {0};
expect:
columns : ["c1 string","c2 smallint","c3 int","c7 timestamp","c8 date"]
rows:
- ["aa",1,2,1590738989000,"2020-01-01"]
-
id: 7
desc: 时间年末
inputs:
-
columns : ["c1 string","c2 smallint","c3 int","c7 timestamp","c8 date"]
indexs: ["index1:c1:c7"]
rows:
- ["aa",1,2,1590738989000,"2020-12-31"]
sql: select * from {0};
expect:
columns : ["c1 string","c2 smallint","c3 int","c7 timestamp","c8 date"]
rows:
- ["aa",1,2,1590738989000,"2020-12-31"]
-
id: 8
desc: 时间月初
inputs:
-
columns : ["c1 string","c2 smallint","c3 int","c7 timestamp","c8 date"]
indexs: ["index1:c1:c7"]
rows:
- ["aa",1,2,1590738989000,"2020-12-01"]
sql: select * from {0};
expect:
columns : ["c1 string","c2 smallint","c3 int","c7 timestamp","c8 date"]
rows:
- ["aa",1,2,1590738989000,"2020-12-01"]
-
id: 9
desc: 时间月末
inputs:
-
columns : ["c1 string","c2 smallint","c3 int","c7 timestamp","c8 date"]
indexs: ["index1:c1:c7"]
rows:
- ["aa",1,2,1590738989000,"2020-11-30"]
sql: select * from {0};
expect:
columns : ["c1 string","c2 smallint","c3 int","c7 timestamp","c8 date"]
rows:
- ["aa",1,2,1590738989000,"2020-11-30"]
-
id: 10
desc: 时间2月末
inputs:
-
columns : ["c1 string","c2 smallint","c3 int","c7 timestamp","c8 date"]
indexs: ["index1:c1:c7"]
rows:
- ["aa",1,2,1590738989000,"2020-02-28"]
sql: select * from {0};
expect:
columns : ["c1 string","c2 smallint","c3 int","c7 timestamp","c8 date"]
rows:
- ["aa",1,2,1590738989000,"2020-02-28"]
-
id: 11
desc: 时间3月初
inputs:
-
columns : ["c1 string","c2 smallint","c3 int","c7 timestamp","c8 date"]
indexs: ["index1:c1:c7"]
rows:
- ["aa",1,2,1590738989000,"2020-03-01"]
sql: select * from {0};
expect:
columns : ["c1 string","c2 smallint","c3 int","c7 timestamp","c8 date"]
rows:
- ["aa",1,2,1590738989000,"2020-03-01"]
-
id: 12
desc: 时间1970-01-01
inputs:
-
columns : ["c1 string","c2 smallint","c3 int","c7 timestamp","c8 date"]
indexs: ["index1:c1:c7"]
rows:
- ["aa",1,2,1590738989000,"1970-01-01"]
sql: select * from {0};
expect:
columns : ["c1 string","c2 smallint","c3 int","c7 timestamp","c8 date"]
rows:
- ["aa",1,2,1590738989000,"1970-01-01"]
-
id: 13
desc: 时间1969-12-31
inputs:
-
columns : ["c1 string","c2 smallint","c3 int","c7 timestamp","c8 date"]
indexs: ["index1:c1:c7"]
rows:
- ["aa",1,2,1590738989000,"1969-12-31"]
sql: select * from {0};
expect:
columns : ["c1 string","c2 smallint","c3 int","c7 timestamp","c8 date"]
rows:
- ["aa",1,2,1590738989000,"1969-12-31"]
-
id: 14
desc: 时间-0330
inputs:
-
columns : ["c1 string","c2 smallint","c3 int","c7 timestamp","c8 date"]
indexs: ["index1:c1:c7"]
rows:
- ["aa",1,2,1590738989000,"2020-03-30"]
sql: select * from {0};
expect:
columns : ["c1 string","c2 smallint","c3 int","c7 timestamp","c8 date"]
rows:
- ["aa",1,2,1590738989000,"2020-03-30"]
9 changes: 6 additions & 3 deletions cases/function/expression/test_arithmetic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -608,11 +608,14 @@ cases:
expect:
columns: [ 'r11 int16', 'r12 int32', 'r13 bigint', 'r22 int32', 'r23 bigint', 'r33 bigint' ]
expectProvider:
- rows:
0:
rows:
- [ 3, 2, 0, 6, 4, 12 ]
- rows:
1:
rows:
- [ 3, 7, 15, 6, 14, 12 ]
- rows:
2:
rows:
- [ 0, 5, 15, 0, 10, 0 ]
- id: bitwise_operators_fail
desc: bitwise and/or/xor, fail on non-integral operands
Expand Down
1 change: 0 additions & 1 deletion cases/function/expression/test_type.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,6 @@ cases:
expect:
columns: [ "id int64", "int16_c6 int16", "int32_c6 int32", "int64_c6 int64",
"float_c6 float", "double_c6 double", "bool_c6 bool" ]

rows:
- [ 1, NULL, NULL, NULL, NULL, NULL, NULL]
- id: 33
Expand Down

0 comments on commit 237fa28

Please sign in to comment.