Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ba056f7f
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
ba056f7f
编写于
7月 05, 2022
作者:
X
Xiaoyu Wang
提交者:
GitHub
7月 05, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14508 from taosdata/feature/3.0_debug_wxy
fix: automatically supplement primary key columns when creating stream
上级
04848095
7c5419b4
变更
20
展开全部
隐藏空白更改
内联
并排
Showing
20 changed file
with
358 addition
and
201 deletion
+358
-201
source/common/src/tmsg.c
source/common/src/tmsg.c
+6
-4
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+229
-128
source/libs/parser/test/mockCatalog.cpp
source/libs/parser/test/mockCatalog.cpp
+37
-32
source/libs/parser/test/mockCatalogService.cpp
source/libs/parser/test/mockCatalogService.cpp
+28
-0
source/libs/parser/test/mockCatalogService.h
source/libs/parser/test/mockCatalogService.h
+2
-0
source/libs/parser/test/parInitialATest.cpp
source/libs/parser/test/parInitialATest.cpp
+2
-2
source/libs/parser/test/parInitialCTest.cpp
source/libs/parser/test/parInitialCTest.cpp
+41
-22
tests/system-test/2-query/abs.py
tests/system-test/2-query/abs.py
+1
-1
tests/system-test/2-query/distribute_agg_apercentile.py
tests/system-test/2-query/distribute_agg_apercentile.py
+1
-1
tests/system-test/2-query/distribute_agg_avg.py
tests/system-test/2-query/distribute_agg_avg.py
+1
-1
tests/system-test/2-query/distribute_agg_count.py
tests/system-test/2-query/distribute_agg_count.py
+1
-1
tests/system-test/2-query/distribute_agg_max.py
tests/system-test/2-query/distribute_agg_max.py
+1
-1
tests/system-test/2-query/distribute_agg_min.py
tests/system-test/2-query/distribute_agg_min.py
+1
-1
tests/system-test/2-query/distribute_agg_spread.py
tests/system-test/2-query/distribute_agg_spread.py
+1
-1
tests/system-test/2-query/distribute_agg_stddev.py
tests/system-test/2-query/distribute_agg_stddev.py
+1
-1
tests/system-test/2-query/distribute_agg_sum.py
tests/system-test/2-query/distribute_agg_sum.py
+1
-1
tests/system-test/2-query/function_null.py
tests/system-test/2-query/function_null.py
+1
-1
tests/system-test/2-query/irate.py
tests/system-test/2-query/irate.py
+1
-1
tests/system-test/2-query/max.py
tests/system-test/2-query/max.py
+1
-1
tests/system-test/2-query/twa.py
tests/system-test/2-query/twa.py
+1
-1
未找到文件。
source/common/src/tmsg.c
浏览文件 @
ba056f7f
...
...
@@ -2687,10 +2687,12 @@ int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) {
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
strict
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
numOfRetensions
)
<
0
)
return
-
1
;
pRsp
->
pRetensions
=
taosArrayInit
(
pRsp
->
numOfRetensions
,
sizeof
(
SRetention
));
if
(
pRsp
->
pRetensions
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
if
(
pRsp
->
numOfRetensions
>
0
)
{
pRsp
->
pRetensions
=
taosArrayInit
(
pRsp
->
numOfRetensions
,
sizeof
(
SRetention
));
if
(
pRsp
->
pRetensions
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
}
for
(
int32_t
i
=
0
;
i
<
pRsp
->
numOfRetensions
;
++
i
)
{
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
ba056f7f
此差异已折叠。
点击以展开。
source/libs/parser/test/mockCatalog.cpp
浏览文件 @
ba056f7f
...
...
@@ -159,7 +159,7 @@ void generatePerformanceSchema(MockCatalogService* mcs) {
* c4 | column | DOUBLE | 8 |
* c5 | column | DOUBLE | 8 |
*/
void
generateTestT
1
(
MockCatalogService
*
mcs
)
{
void
generateTestT
ables
(
MockCatalogService
*
mcs
)
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
"test"
,
"t1"
,
TSDB_NORMAL_TABLE
,
6
)
.
setPrecision
(
TSDB_TIME_PRECISION_MILLI
)
.
setVgid
(
1
)
...
...
@@ -183,23 +183,7 @@ void generateTestT1(MockCatalogService* mcs) {
* tag2 | tag | VARCHAR | 20 |
* tag3 | tag | TIMESTAMP | 8 |
* Child Table: st1s1, st1s2
*/
void
generateTestST1
(
MockCatalogService
*
mcs
)
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
"test"
,
"st1"
,
TSDB_SUPER_TABLE
,
3
,
3
)
.
setPrecision
(
TSDB_TIME_PRECISION_MILLI
)
.
addColumn
(
"ts"
,
TSDB_DATA_TYPE_TIMESTAMP
)
.
addColumn
(
"c1"
,
TSDB_DATA_TYPE_INT
)
.
addColumn
(
"c2"
,
TSDB_DATA_TYPE_BINARY
,
20
)
.
addTag
(
"tag1"
,
TSDB_DATA_TYPE_INT
)
.
addTag
(
"tag2"
,
TSDB_DATA_TYPE_BINARY
,
20
)
.
addTag
(
"tag3"
,
TSDB_DATA_TYPE_TIMESTAMP
);
builder
.
done
();
mcs
->
createSubTable
(
"test"
,
"st1"
,
"st1s1"
,
1
);
mcs
->
createSubTable
(
"test"
,
"st1"
,
"st1s2"
,
2
);
mcs
->
createSubTable
(
"test"
,
"st1"
,
"st1s3"
,
1
);
}
/*
*
* Super Table: st2
* Field | Type | DataType | Bytes |
* ==========================================================================
...
...
@@ -209,16 +193,32 @@ void generateTestST1(MockCatalogService* mcs) {
* jtag | tag | json | -- |
* Child Table: st2s1, st2s2
*/
void
generateTestST2
(
MockCatalogService
*
mcs
)
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
"test"
,
"st2"
,
TSDB_SUPER_TABLE
,
3
,
1
)
.
setPrecision
(
TSDB_TIME_PRECISION_MILLI
)
.
addColumn
(
"ts"
,
TSDB_DATA_TYPE_TIMESTAMP
)
.
addColumn
(
"c1"
,
TSDB_DATA_TYPE_INT
)
.
addColumn
(
"c2"
,
TSDB_DATA_TYPE_BINARY
,
20
)
.
addTag
(
"jtag"
,
TSDB_DATA_TYPE_JSON
);
builder
.
done
();
mcs
->
createSubTable
(
"test"
,
"st2"
,
"st2s1"
,
1
);
mcs
->
createSubTable
(
"test"
,
"st2"
,
"st2s2"
,
2
);
void
generateTestStables
(
MockCatalogService
*
mcs
)
{
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
"test"
,
"st1"
,
TSDB_SUPER_TABLE
,
3
,
3
)
.
setPrecision
(
TSDB_TIME_PRECISION_MILLI
)
.
addColumn
(
"ts"
,
TSDB_DATA_TYPE_TIMESTAMP
)
.
addColumn
(
"c1"
,
TSDB_DATA_TYPE_INT
)
.
addColumn
(
"c2"
,
TSDB_DATA_TYPE_BINARY
,
20
)
.
addTag
(
"tag1"
,
TSDB_DATA_TYPE_INT
)
.
addTag
(
"tag2"
,
TSDB_DATA_TYPE_BINARY
,
20
)
.
addTag
(
"tag3"
,
TSDB_DATA_TYPE_TIMESTAMP
);
builder
.
done
();
mcs
->
createSubTable
(
"test"
,
"st1"
,
"st1s1"
,
1
);
mcs
->
createSubTable
(
"test"
,
"st1"
,
"st1s2"
,
2
);
mcs
->
createSubTable
(
"test"
,
"st1"
,
"st1s3"
,
1
);
}
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
"test"
,
"st2"
,
TSDB_SUPER_TABLE
,
3
,
1
)
.
setPrecision
(
TSDB_TIME_PRECISION_MILLI
)
.
addColumn
(
"ts"
,
TSDB_DATA_TYPE_TIMESTAMP
)
.
addColumn
(
"c1"
,
TSDB_DATA_TYPE_INT
)
.
addColumn
(
"c2"
,
TSDB_DATA_TYPE_BINARY
,
20
)
.
addTag
(
"jtag"
,
TSDB_DATA_TYPE_JSON
);
builder
.
done
();
mcs
->
createSubTable
(
"test"
,
"st2"
,
"st2s1"
,
1
);
mcs
->
createSubTable
(
"test"
,
"st2"
,
"st2s2"
,
2
);
}
}
void
generateFunctions
(
MockCatalogService
*
mcs
)
{
...
...
@@ -233,6 +233,11 @@ void generateDnodes(MockCatalogService* mcs) {
mcs
->
createDnode
(
3
,
"host3"
,
7030
);
}
void
generateDatabases
(
MockCatalogService
*
mcs
)
{
mcs
->
createDatabase
(
"test"
);
mcs
->
createDatabase
(
"rollup_db"
,
true
);
}
}
// namespace
int32_t
__catalogGetHandle
(
const
char
*
clusterId
,
struct
SCatalog
**
catalogHandle
)
{
return
0
;
}
...
...
@@ -262,7 +267,7 @@ int32_t __catalogGetDBVgInfo(SCatalog* pCtg, SRequestConnInfo* pConn, const char
}
int32_t
__catalogGetDBCfg
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
char
*
dbFName
,
SDbCfgInfo
*
pDbCfg
)
{
return
0
;
return
g_mockCatalogService
->
catalogGetDBCfg
(
dbFName
,
pDbCfg
)
;
}
int32_t
__catalogChkAuth
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
char
*
user
,
const
char
*
dbFName
,
AUTH_TYPE
type
,
...
...
@@ -359,11 +364,11 @@ void initMetaDataEnv() {
}
void
generateMetaData
()
{
generateDatabases
(
g_mockCatalogService
.
get
());
generateInformationSchema
(
g_mockCatalogService
.
get
());
generatePerformanceSchema
(
g_mockCatalogService
.
get
());
generateTestT1
(
g_mockCatalogService
.
get
());
generateTestST1
(
g_mockCatalogService
.
get
());
generateTestST2
(
g_mockCatalogService
.
get
());
generateTestTables
(
g_mockCatalogService
.
get
());
generateTestStables
(
g_mockCatalogService
.
get
());
generateFunctions
(
g_mockCatalogService
.
get
());
generateDnodes
(
g_mockCatalogService
.
get
());
g_mockCatalogService
->
showTables
();
...
...
source/libs/parser/test/mockCatalogService.cpp
浏览文件 @
ba056f7f
...
...
@@ -140,6 +140,17 @@ class MockCatalogServiceImpl {
return
TSDB_CODE_SUCCESS
;
}
int32_t
catalogGetDBCfg
(
const
char
*
pDbFName
,
SDbCfgInfo
*
pDbCfg
)
const
{
std
::
string
dbFName
(
pDbFName
);
DbCfgCache
::
const_iterator
it
=
dbCfg_
.
find
(
dbFName
.
substr
(
std
::
string
(
pDbFName
).
find_last_of
(
'.'
)
+
1
));
if
(
dbCfg_
.
end
()
==
it
)
{
return
TSDB_CODE_FAILED
;
}
memcpy
(
pDbCfg
,
&
(
it
->
second
),
sizeof
(
SDbCfgInfo
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
catalogGetUdfInfo
(
const
std
::
string
&
funcName
,
SFuncInfo
*
pInfo
)
const
{
auto
it
=
udf_
.
find
(
funcName
);
if
(
udf_
.
end
()
==
it
)
{
...
...
@@ -323,12 +334,21 @@ class MockCatalogServiceImpl {
dnode_
.
insert
(
std
::
make_pair
(
dnodeId
,
epSet
));
}
void
createDatabase
(
const
std
::
string
&
db
,
bool
rollup
)
{
SDbCfgInfo
cfg
=
{
0
};
if
(
rollup
)
{
cfg
.
pRetensions
=
taosArrayInit
(
TARRAY_MIN_SIZE
,
sizeof
(
SRetention
));
}
dbCfg_
.
insert
(
std
::
make_pair
(
db
,
cfg
));
}
private:
typedef
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
MockTableMeta
>>
TableMetaCache
;
typedef
std
::
map
<
std
::
string
,
TableMetaCache
>
DbMetaCache
;
typedef
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
SFuncInfo
>>
UdfMetaCache
;
typedef
std
::
map
<
std
::
string
,
std
::
vector
<
STableIndexInfo
>>
IndexMetaCache
;
typedef
std
::
map
<
int32_t
,
SEpSet
>
DnodeCache
;
typedef
std
::
map
<
std
::
string
,
SDbCfgInfo
>
DbCfgCache
;
uint64_t
getNextId
()
{
return
id_
++
;
}
...
...
@@ -486,6 +506,7 @@ class MockCatalogServiceImpl {
for
(
int32_t
i
=
0
;
i
<
ndbs
;
++
i
)
{
SMetaRes
res
=
{
0
};
res
.
pRes
=
taosMemoryCalloc
(
1
,
sizeof
(
SDbCfgInfo
));
res
.
code
=
catalogGetDBCfg
((
const
char
*
)
taosArrayGet
(
pDbCfgReq
,
i
),
(
SDbCfgInfo
*
)
res
.
pRes
);
taosArrayPush
(
*
pDbCfgData
,
&
res
);
}
}
...
...
@@ -576,6 +597,7 @@ class MockCatalogServiceImpl {
UdfMetaCache
udf_
;
IndexMetaCache
index_
;
DnodeCache
dnode_
;
DbCfgCache
dbCfg_
;
};
MockCatalogService
::
MockCatalogService
()
:
impl_
(
new
MockCatalogServiceImpl
())
{}
...
...
@@ -605,6 +627,8 @@ void MockCatalogService::createDnode(int32_t dnodeId, const std::string& host, i
impl_
->
createDnode
(
dnodeId
,
host
,
port
);
}
void
MockCatalogService
::
createDatabase
(
const
std
::
string
&
db
,
bool
rollup
)
{
impl_
->
createDatabase
(
db
,
rollup
);
}
int32_t
MockCatalogService
::
catalogGetTableMeta
(
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
)
const
{
return
impl_
->
catalogGetTableMeta
(
pTableName
,
pTableMeta
);
}
...
...
@@ -621,6 +645,10 @@ int32_t MockCatalogService::catalogGetDBVgInfo(const char* pDbFName, SArray** pV
return
impl_
->
catalogGetDBVgInfo
(
pDbFName
,
pVgList
);
}
int32_t
MockCatalogService
::
catalogGetDBCfg
(
const
char
*
pDbFName
,
SDbCfgInfo
*
pDbCfg
)
const
{
return
impl_
->
catalogGetDBCfg
(
pDbFName
,
pDbCfg
);
}
int32_t
MockCatalogService
::
catalogGetUdfInfo
(
const
std
::
string
&
funcName
,
SFuncInfo
*
pInfo
)
const
{
return
impl_
->
catalogGetUdfInfo
(
funcName
,
pInfo
);
}
...
...
source/libs/parser/test/mockCatalogService.h
浏览文件 @
ba056f7f
...
...
@@ -63,11 +63,13 @@ class MockCatalogService {
void
createFunction
(
const
std
::
string
&
func
,
int8_t
funcType
,
int8_t
outputType
,
int32_t
outputLen
,
int32_t
bufSize
);
void
createSmaIndex
(
const
SMCreateSmaReq
*
pReq
);
void
createDnode
(
int32_t
dnodeId
,
const
std
::
string
&
host
,
int16_t
port
);
void
createDatabase
(
const
std
::
string
&
db
,
bool
rollup
=
false
);
int32_t
catalogGetTableMeta
(
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
)
const
;
int32_t
catalogGetTableHashVgroup
(
const
SName
*
pTableName
,
SVgroupInfo
*
vgInfo
)
const
;
int32_t
catalogGetTableDistVgInfo
(
const
SName
*
pTableName
,
SArray
**
pVgList
)
const
;
int32_t
catalogGetDBVgInfo
(
const
char
*
pDbFName
,
SArray
**
pVgList
)
const
;
int32_t
catalogGetDBCfg
(
const
char
*
pDbFName
,
SDbCfgInfo
*
pDbCfg
)
const
;
int32_t
catalogGetUdfInfo
(
const
std
::
string
&
funcName
,
SFuncInfo
*
pInfo
)
const
;
int32_t
catalogGetTableIndex
(
const
SName
*
pTableName
,
SArray
**
pIndexes
)
const
;
int32_t
catalogGetDnodeList
(
SArray
**
pDnodes
)
const
;
...
...
source/libs/parser/test/parInitialATest.cpp
浏览文件 @
ba056f7f
...
...
@@ -38,9 +38,9 @@ TEST_F(ParserInitialATest, alterDnode) {
TEST_F
(
ParserInitialATest
,
alterDatabase
)
{
useDb
(
"root"
,
"test"
);
run
(
"ALTER DATABASE
wxy_db
CACHELAST 1 FSYNC 200 WAL 1"
);
run
(
"ALTER DATABASE
test
CACHELAST 1 FSYNC 200 WAL 1"
);
run
(
"ALTER DATABASE
wxy_db
KEEP 2400"
);
run
(
"ALTER DATABASE
test
KEEP 2400"
);
}
TEST_F
(
ParserInitialATest
,
alterLocal
)
{
...
...
source/libs/parser/test/parInitialCTest.cpp
浏览文件 @
ba056f7f
...
...
@@ -359,11 +359,11 @@ TEST_F(ParserInitialCTest, createStable) {
memset
(
&
expect
,
0
,
sizeof
(
SMCreateStbReq
));
};
auto
setCreateStbReqFunc
=
[
&
](
const
char
*
p
Tbname
,
int8_t
igExists
=
0
,
int64_t
delay1
=
-
1
,
int64_t
delay2
=
-
1
,
int64_t
watermark1
=
TSDB_DEFAULT_ROLLUP_WATERMARK
,
auto
setCreateStbReqFunc
=
[
&
](
const
char
*
p
DbName
,
const
char
*
pTbName
,
int8_t
igExists
=
0
,
int64_t
delay1
=
-
1
,
int64_t
delay2
=
-
1
,
int64_t
watermark1
=
TSDB_DEFAULT_ROLLUP_WATERMARK
,
int64_t
watermark2
=
TSDB_DEFAULT_ROLLUP_WATERMARK
,
int32_t
ttl
=
TSDB_DEFAULT_TABLE_TTL
,
const
char
*
pComment
=
nullptr
)
{
int32_t
len
=
snprintf
(
expect
.
name
,
sizeof
(
expect
.
name
),
"0.
test.%s"
,
pTbn
ame
);
int32_t
len
=
snprintf
(
expect
.
name
,
sizeof
(
expect
.
name
),
"0.
%s.%s"
,
pDbName
,
pTbN
ame
);
expect
.
name
[
len
]
=
'\0'
;
expect
.
igExists
=
igExists
;
expect
.
delay1
=
delay1
;
...
...
@@ -454,14 +454,14 @@ TEST_F(ParserInitialCTest, createStable) {
tFreeSMCreateStbReq
(
&
req
);
});
setCreateStbReqFunc
(
"t1"
);
setCreateStbReqFunc
(
"t
est"
,
"t
1"
);
addFieldToCreateStbReqFunc
(
true
,
"ts"
,
TSDB_DATA_TYPE_TIMESTAMP
);
addFieldToCreateStbReqFunc
(
true
,
"c1"
,
TSDB_DATA_TYPE_INT
);
addFieldToCreateStbReqFunc
(
false
,
"id"
,
TSDB_DATA_TYPE_INT
);
run
(
"CREATE STABLE t1(ts TIMESTAMP, c1 INT) TAGS(id INT)"
);
clearCreateStbReq
();
setCreateStbReqFunc
(
"t1"
,
1
,
100
*
MILLISECOND_PER_SECOND
,
10
*
MILLISECOND_PER_MINUTE
,
10
,
setCreateStbReqFunc
(
"
rollup_db"
,
"
t1"
,
1
,
100
*
MILLISECOND_PER_SECOND
,
10
*
MILLISECOND_PER_MINUTE
,
10
,
1
*
MILLISECOND_PER_MINUTE
,
100
,
"test create table"
);
addFieldToCreateStbReqFunc
(
true
,
"ts"
,
TSDB_DATA_TYPE_TIMESTAMP
,
0
,
0
);
addFieldToCreateStbReqFunc
(
true
,
"c1"
,
TSDB_DATA_TYPE_INT
);
...
...
@@ -493,7 +493,7 @@ TEST_F(ParserInitialCTest, createStable) {
addFieldToCreateStbReqFunc
(
false
,
"a13"
,
TSDB_DATA_TYPE_BOOL
);
addFieldToCreateStbReqFunc
(
false
,
"a14"
,
TSDB_DATA_TYPE_NCHAR
,
30
*
TSDB_NCHAR_SIZE
+
VARSTR_HEADER_SIZE
);
addFieldToCreateStbReqFunc
(
false
,
"a15"
,
TSDB_DATA_TYPE_VARCHAR
,
50
+
VARSTR_HEADER_SIZE
);
run
(
"CREATE STABLE IF NOT EXISTS
test
.t1("
run
(
"CREATE STABLE IF NOT EXISTS
rollup_db
.t1("
"ts TIMESTAMP, c1 INT, c2 INT UNSIGNED, c3 BIGINT, c4 BIGINT UNSIGNED, c5 FLOAT, c6 DOUBLE, c7 BINARY(20), "
"c8 SMALLINT, c9 SMALLINT UNSIGNED COMMENT 'test column comment', c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, "
"c13 NCHAR(30), c14 VARCHAR(50)) "
...
...
@@ -507,12 +507,13 @@ TEST_F(ParserInitialCTest, createStable) {
TEST_F
(
ParserInitialCTest
,
createStableSemanticCheck
)
{
useDb
(
"root"
,
"test"
);
run
(
"CREATE STABLE stb2 (ts TIMESTAMP, c1 INT) TAGS (tag1 INT) ROLLUP(CEIL)"
,
TSDB_CODE_PAR_INVALID_ROLLUP_OPTION
);
run
(
"CREATE STABLE rollup_db.stb2 (ts TIMESTAMP, c1 INT) TAGS (tag1 INT) ROLLUP(CEIL)"
,
TSDB_CODE_PAR_INVALID_ROLLUP_OPTION
);
run
(
"CREATE STABLE stb2 (ts TIMESTAMP, c1 INT) TAGS (tag1 INT) ROLLUP(MAX) MAX_DELAY 0s WATERMARK 1m"
,
run
(
"CREATE STABLE
rollup_db.
stb2 (ts TIMESTAMP, c1 INT) TAGS (tag1 INT) ROLLUP(MAX) MAX_DELAY 0s WATERMARK 1m"
,
TSDB_CODE_PAR_INVALID_RANGE_OPTION
);
run
(
"CREATE STABLE stb2 (ts TIMESTAMP, c1 INT) TAGS (tag1 INT) ROLLUP(MAX) MAX_DELAY 10s WATERMARK 18m"
,
run
(
"CREATE STABLE
rollup_db.
stb2 (ts TIMESTAMP, c1 INT) TAGS (tag1 INT) ROLLUP(MAX) MAX_DELAY 10s WATERMARK 18m"
,
TSDB_CODE_PAR_INVALID_RANGE_OPTION
);
}
...
...
@@ -561,30 +562,33 @@ TEST_F(ParserInitialCTest, createStream) {
tFreeSCMCreateStreamReq
(
&
req
);
});
setCreateStreamReqFunc
(
"s1"
,
"test"
,
"create stream s1 as select
* from t1
"
);
run
(
"CREATE STREAM s1 AS SELECT
* FROM t1
"
);
setCreateStreamReqFunc
(
"s1"
,
"test"
,
"create stream s1 as select
count(*) from t1 interval(10s)
"
);
run
(
"CREATE STREAM s1 AS SELECT
COUNT(*) FROM t1 INTERVAL(10S)
"
);
clearCreateStreamReq
();
setCreateStreamReqFunc
(
"s1"
,
"test"
,
"create stream if not exists s1 as select * from t1"
,
nullptr
,
1
);
run
(
"CREATE STREAM IF NOT EXISTS s1 AS SELECT * FROM t1"
);
setCreateStreamReqFunc
(
"s1"
,
"test"
,
"create stream if not exists s1 as select count(*) from t1 interval(10s)"
,
nullptr
,
1
);
run
(
"CREATE STREAM IF NOT EXISTS s1 AS SELECT COUNT(*) FROM t1 INTERVAL(10S)"
);
clearCreateStreamReq
();
setCreateStreamReqFunc
(
"s1"
,
"test"
,
"create stream s1 into st1 as select
* from t1
"
,
"st1"
);
run
(
"CREATE STREAM s1 INTO st1 AS SELECT
* FROM t1
"
);
setCreateStreamReqFunc
(
"s1"
,
"test"
,
"create stream s1 into st1 as select
count(*) from t1 interval(10s)
"
,
"st1"
);
run
(
"CREATE STREAM s1 INTO st1 AS SELECT
COUNT(*) FROM t1 INTERVAL(10S)
"
);
clearCreateStreamReq
();
setCreateStreamReqFunc
(
"s1"
,
"test"
,
"create stream if not exists s1 trigger max_delay 20s watermark 10s ignore expired into st1 as select * from t1"
,
"st1"
,
1
,
STREAM_TRIGGER_MAX_DELAY
,
20
*
MILLISECOND_PER_SECOND
,
10
*
MILLISECOND_PER_SECOND
,
1
);
run
(
"CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s IGNORE EXPIRED INTO st1 AS SELECT * FROM t1"
);
setCreateStreamReqFunc
(
"s1"
,
"test"
,
"create stream if not exists s1 trigger max_delay 20s watermark 10s ignore expired into st1 "
"as select count(*) from t1 interval(10s)"
,
"st1"
,
1
,
STREAM_TRIGGER_MAX_DELAY
,
20
*
MILLISECOND_PER_SECOND
,
10
*
MILLISECOND_PER_SECOND
,
1
);
run
(
"CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s IGNORE EXPIRED INTO st1 AS SELECT COUNT(*) "
"FROM t1 INTERVAL(10S)"
);
clearCreateStreamReq
();
}
TEST_F
(
ParserInitialCTest
,
createStreamSemanticCheck
)
{
useDb
(
"root"
,
"test"
);
run
(
"CREATE STREAM s1 AS SELECT PERCENTILE(c1, 30) FROM t1"
,
TSDB_CODE_PAR_STREAM_NOT_ALLOWED_FUNC
);
run
(
"CREATE STREAM s1 AS SELECT PERCENTILE(c1, 30) FROM t1
INTERVAL(10S)
"
,
TSDB_CODE_PAR_STREAM_NOT_ALLOWED_FUNC
);
}
TEST_F
(
ParserInitialCTest
,
createTable
)
{
...
...
@@ -598,7 +602,7 @@ TEST_F(ParserInitialCTest, createTable) {
"c13 NCHAR(30), c15 VARCHAR(50)) "
"TTL 100 COMMENT 'test create table' SMA(c1, c2, c3)"
);
run
(
"CREATE TABLE IF NOT EXISTS
test
.t1("
run
(
"CREATE TABLE IF NOT EXISTS
rollup_db
.t1("
"ts TIMESTAMP, c1 INT, c2 INT UNSIGNED, c3 BIGINT, c4 BIGINT UNSIGNED, c5 FLOAT, c6 DOUBLE, c7 BINARY(20), "
"c8 SMALLINT, c9 SMALLINT UNSIGNED COMMENT 'test column comment', c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, "
"c13 NCHAR(30), c14 VARCHAR(50)) "
...
...
@@ -617,6 +621,21 @@ TEST_F(ParserInitialCTest, createTable) {
// run("CREATE TABLE IF NOT EXISTS t1 USING st1 TAGS(1, 'wxy', NOW + 1S)");
}
TEST_F
(
ParserInitialCTest
,
createTableSemanticCheck
)
{
useDb
(
"root"
,
"test"
);
string
sql
=
"CREATE TABLE st1(ts TIMESTAMP, "
;
for
(
int32_t
i
=
1
;
i
<
4096
;
++
i
)
{
if
(
i
>
1
)
{
sql
.
append
(
", "
);
}
sql
.
append
(
"c"
+
to_string
(
i
)
+
" INT"
);
}
sql
.
append
(
") TAGS (t1 int)"
);
run
(
sql
,
TSDB_CODE_PAR_TOO_MANY_COLUMNS
);
}
TEST_F
(
ParserInitialCTest
,
createTopic
)
{
useDb
(
"root"
,
"test"
);
...
...
tests/system-test/2-query/abs.py
浏览文件 @
ba056f7f
...
...
@@ -139,7 +139,7 @@ class TDTestCase:
)
for
i
in
range
(
4
):
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
for
i
in
range
(
9
):
tdSql
.
execute
(
...
...
tests/system-test/2-query/distribute_agg_apercentile.py
浏览文件 @
ba056f7f
...
...
@@ -36,7 +36,7 @@ class TDTestCase:
'''
)
for
i
in
range
(
20
):
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
for
i
in
range
(
9
):
tdSql
.
execute
(
...
...
tests/system-test/2-query/distribute_agg_avg.py
浏览文件 @
ba056f7f
...
...
@@ -53,7 +53,7 @@ class TDTestCase:
'''
)
for
i
in
range
(
20
):
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
for
i
in
range
(
9
):
tdSql
.
execute
(
...
...
tests/system-test/2-query/distribute_agg_count.py
浏览文件 @
ba056f7f
...
...
@@ -55,7 +55,7 @@ class TDTestCase:
'''
)
for
i
in
range
(
20
):
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
for
i
in
range
(
9
):
tdSql
.
execute
(
...
...
tests/system-test/2-query/distribute_agg_max.py
浏览文件 @
ba056f7f
...
...
@@ -55,7 +55,7 @@ class TDTestCase:
'''
)
for
i
in
range
(
20
):
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
for
i
in
range
(
9
):
tdSql
.
execute
(
...
...
tests/system-test/2-query/distribute_agg_min.py
浏览文件 @
ba056f7f
...
...
@@ -55,7 +55,7 @@ class TDTestCase:
'''
)
for
i
in
range
(
20
):
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
for
i
in
range
(
9
):
tdSql
.
execute
(
...
...
tests/system-test/2-query/distribute_agg_spread.py
浏览文件 @
ba056f7f
...
...
@@ -55,7 +55,7 @@ class TDTestCase:
'''
)
for
i
in
range
(
20
):
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
for
i
in
range
(
9
):
tdSql
.
execute
(
...
...
tests/system-test/2-query/distribute_agg_stddev.py
浏览文件 @
ba056f7f
...
...
@@ -64,7 +64,7 @@ class TDTestCase:
'''
)
for
i
in
range
(
20
):
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
for
i
in
range
(
9
):
tdSql
.
execute
(
...
...
tests/system-test/2-query/distribute_agg_sum.py
浏览文件 @
ba056f7f
...
...
@@ -53,7 +53,7 @@ class TDTestCase:
'''
)
for
i
in
range
(
20
):
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
for
i
in
range
(
9
):
tdSql
.
execute
(
...
...
tests/system-test/2-query/function_null.py
浏览文件 @
ba056f7f
...
...
@@ -42,7 +42,7 @@ class TDTestCase:
)
for
i
in
range
(
4
):
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
for
i
in
range
(
9
):
tdSql
.
execute
(
...
...
tests/system-test/2-query/irate.py
浏览文件 @
ba056f7f
...
...
@@ -97,7 +97,7 @@ class TDTestCase:
)
for
i
in
range
(
4
):
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
for
i
in
range
(
9
):
tdSql
.
execute
(
...
...
tests/system-test/2-query/max.py
浏览文件 @
ba056f7f
...
...
@@ -109,7 +109,7 @@ class TDTestCase:
'''
)
for
i
in
range
(
20
):
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
for
i
in
range
(
9
):
tdSql
.
execute
(
...
...
tests/system-test/2-query/twa.py
浏览文件 @
ba056f7f
...
...
@@ -34,7 +34,7 @@ class TDTestCase:
)
for
i
in
range
(
self
.
tb_nums
):
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags ( now(),
{
1
*
i
}
,
{
11111
*
i
}
,
{
111
*
i
}
,
{
1
*
i
}
,
{
1.11
*
i
}
,
{
11.11
*
i
}
,
{
i
%
2
}
, "binary
{
i
}
", "nchar
{
i
}
" )'
)
ts
=
self
.
ts
for
j
in
range
(
self
.
row_nums
):
ts
+=
j
*
self
.
time_step
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录