Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d2223ae5
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1191
Star
22018
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看板
提交
d2223ae5
编写于
7月 05, 2022
作者:
P
plum-lihui
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' into test3.0/lihui
上级
14deddb7
f3bf7572
变更
26
显示空白变更内容
内联
并排
Showing
26 changed file
with
637 addition
and
216 deletion
+637
-216
source/common/src/tmsg.c
source/common/src/tmsg.c
+6
-4
source/dnode/vnode/src/sma/smaCommit.c
source/dnode/vnode/src/sma/smaCommit.c
+6
-6
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
source/libs/planner/src/planSpliter.c
source/libs/planner/src/planSpliter.c
+1
-0
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+1
-0
tests/script/tmp/prepare.sim
tests/script/tmp/prepare.sim
+7
-7
tests/script/tsim/sma/rsmaPersistenceRecovery.sim
tests/script/tsim/sma/rsmaPersistenceRecovery.sim
+237
-0
tests/script/tsim/valgrind/basic.sim
tests/script/tsim/valgrind/basic.sim
+27
-2
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
浏览文件 @
d2223ae5
...
...
@@ -2687,11 +2687,13 @@ 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
;
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
)
{
SRetention
rentension
=
{
0
};
...
...
source/dnode/vnode/src/sma/smaCommit.c
浏览文件 @
d2223ae5
...
...
@@ -83,8 +83,8 @@ int32_t smaBegin(SSma *pSma) {
/**
* @brief pre-commit for rollup sma.
* 1) set trigger stat of rsma timer TASK_TRIGGER_STAT_PAUSED.
* 2)
perform persist task for qTaskInfo
* 3)
wait all triggered fetch tasks finished
* 2)
wait all triggered fetch tasks finished
* 3)
perform persist task for qTaskInfo
*
* @param pSma
* @return int32_t
...
...
@@ -102,10 +102,7 @@ static int32_t tdProcessRSmaPreCommitImpl(SSma *pSma) {
// step 1: set persistence task paused
atomic_store_8
(
RSMA_TRIGGER_STAT
(
pRSmaStat
),
TASK_TRIGGER_STAT_PAUSED
);
// step 2: perform persist task for qTaskInfo
tdRSmaPersistExecImpl
(
pRSmaStat
);
// step 3: wait all triggered fetch tasks finished
// step 2: wait all triggered fetch tasks finished
int32_t
nLoops
=
0
;
while
(
1
)
{
if
(
T_REF_VAL_GET
(
pStat
)
==
0
)
{
...
...
@@ -121,6 +118,9 @@ static int32_t tdProcessRSmaPreCommitImpl(SSma *pSma) {
}
}
// step 3: perform persist task for qTaskInfo
tdRSmaPersistExecImpl
(
pRSmaStat
);
smaDebug
(
"vgId:%d, rsma pre commit succeess"
,
SMA_VID
(
pSma
));
return
TSDB_CODE_SUCCESS
;
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
d2223ae5
...
...
@@ -784,29 +784,18 @@ static int32_t parseBoolFromValueNode(STranslateContext* pCxt, SValueNode* pVal)
}
}
static
EDealRes
translateValueImpl
(
STranslateContext
*
pCxt
,
SValueNode
*
pVal
,
SDataType
targetDt
)
{
uint8_t
precision
=
getPrecisionFromCurrStmt
(
pCxt
->
pCurrStmt
,
targetDt
.
precision
);
pVal
->
node
.
resType
.
precision
=
precision
;
if
(
pVal
->
placeholderNo
>
0
||
pVal
->
isNull
)
{
return
DEAL_RES_CONTINUE
;
}
if
(
TSDB_DATA_TYPE_NULL
==
pVal
->
node
.
resType
.
type
)
{
// TODO
// pVal->node.resType = targetDt;
pVal
->
translate
=
true
;
pVal
->
isNull
=
true
;
return
DEAL_RES_CONTINUE
;
}
if
(
pVal
->
isDuration
)
{
if
(
parseNatualDuration
(
pVal
->
literal
,
strlen
(
pVal
->
literal
),
&
pVal
->
datum
.
i
,
&
pVal
->
unit
,
precision
)
!=
TSDB_CODE_SUCCESS
)
{
static
EDealRes
translateDurationValue
(
STranslateContext
*
pCxt
,
SValueNode
*
pVal
)
{
if
(
parseNatualDuration
(
pVal
->
literal
,
strlen
(
pVal
->
literal
),
&
pVal
->
datum
.
i
,
&
pVal
->
unit
,
pVal
->
node
.
resType
.
precision
)
!=
TSDB_CODE_SUCCESS
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
}
*
(
int64_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
i
;
}
else
{
return
DEAL_RES_CONTINUE
;
}
static
EDealRes
translateNormalValue
(
STranslateContext
*
pCxt
,
SValueNode
*
pVal
,
SDataType
targetDt
,
bool
strict
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
switch
(
targetDt
.
type
)
{
case
TSDB_DATA_TYPE_NULL
:
break
;
case
TSDB_DATA_TYPE_BOOL
:
if
(
TSDB_CODE_SUCCESS
!=
parseBoolFromValueNode
(
pCxt
,
pVal
))
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
...
...
@@ -814,42 +803,66 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD
*
(
bool
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
b
;
break
;
case
TSDB_DATA_TYPE_TINYINT
:
{
pVal
->
datum
.
i
=
taosStr2Int64
(
pVal
->
literal
,
NULL
,
10
);
code
=
toInteger
(
pVal
->
literal
,
strlen
(
pVal
->
literal
),
10
,
&
pVal
->
datum
.
i
);
if
(
strict
&&
(
TSDB_CODE_SUCCESS
!=
code
||
!
IS_VALID_TINYINT
(
pVal
->
datum
.
i
)))
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
}
*
(
int8_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
i
;
break
;
}
case
TSDB_DATA_TYPE_SMALLINT
:
{
pVal
->
datum
.
i
=
taosStr2Int64
(
pVal
->
literal
,
NULL
,
10
);
code
=
toInteger
(
pVal
->
literal
,
strlen
(
pVal
->
literal
),
10
,
&
pVal
->
datum
.
i
);
if
(
strict
&&
(
TSDB_CODE_SUCCESS
!=
code
||
!
IS_VALID_SMALLINT
(
pVal
->
datum
.
i
)))
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
}
*
(
int16_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
i
;
break
;
}
case
TSDB_DATA_TYPE_INT
:
{
pVal
->
datum
.
i
=
taosStr2Int64
(
pVal
->
literal
,
NULL
,
10
);
code
=
toInteger
(
pVal
->
literal
,
strlen
(
pVal
->
literal
),
10
,
&
pVal
->
datum
.
i
);
if
(
strict
&&
(
TSDB_CODE_SUCCESS
!=
code
||
!
IS_VALID_INT
(
pVal
->
datum
.
i
)))
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
}
*
(
int32_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
i
;
break
;
}
case
TSDB_DATA_TYPE_BIGINT
:
{
pVal
->
datum
.
i
=
taosStr2Int64
(
pVal
->
literal
,
NULL
,
10
);
code
=
toInteger
(
pVal
->
literal
,
strlen
(
pVal
->
literal
),
10
,
&
pVal
->
datum
.
i
);
if
(
strict
&&
(
TSDB_CODE_SUCCESS
!=
code
||
!
IS_VALID_BIGINT
(
pVal
->
datum
.
i
)))
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
}
*
(
int64_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
i
;
break
;
}
case
TSDB_DATA_TYPE_UTINYINT
:
{
pVal
->
datum
.
u
=
taosStr2UInt64
(
pVal
->
literal
,
NULL
,
10
);
code
=
toUInteger
(
pVal
->
literal
,
strlen
(
pVal
->
literal
),
10
,
&
pVal
->
datum
.
u
);
if
(
strict
&&
(
TSDB_CODE_SUCCESS
!=
code
||
!
IS_VALID_UTINYINT
(
pVal
->
datum
.
i
)))
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
}
*
(
uint8_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
u
;
break
;
}
case
TSDB_DATA_TYPE_USMALLINT
:
{
pVal
->
datum
.
u
=
taosStr2UInt64
(
pVal
->
literal
,
NULL
,
10
);
code
=
toUInteger
(
pVal
->
literal
,
strlen
(
pVal
->
literal
),
10
,
&
pVal
->
datum
.
u
);
if
(
strict
&&
(
TSDB_CODE_SUCCESS
!=
code
||
!
IS_VALID_USMALLINT
(
pVal
->
datum
.
i
)))
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
}
*
(
uint16_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
u
;
break
;
}
case
TSDB_DATA_TYPE_UINT
:
{
pVal
->
datum
.
u
=
taosStr2UInt64
(
pVal
->
literal
,
NULL
,
10
);
code
=
toUInteger
(
pVal
->
literal
,
strlen
(
pVal
->
literal
),
10
,
&
pVal
->
datum
.
u
);
if
(
strict
&&
(
TSDB_CODE_SUCCESS
!=
code
||
!
IS_VALID_UINT
(
pVal
->
datum
.
i
)))
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
}
*
(
uint32_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
u
;
break
;
}
case
TSDB_DATA_TYPE_UBIGINT
:
{
pVal
->
datum
.
u
=
taosStr2UInt64
(
pVal
->
literal
,
NULL
,
10
);
code
=
toUInteger
(
pVal
->
literal
,
strlen
(
pVal
->
literal
),
10
,
&
pVal
->
datum
.
u
);
if
(
strict
&&
(
TSDB_CODE_SUCCESS
!=
code
||
!
IS_VALID_UBIGINT
(
pVal
->
datum
.
i
)))
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
}
*
(
uint64_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
u
;
break
;
}
...
...
@@ -901,10 +914,33 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD
default:
break
;
}
return
DEAL_RES_CONTINUE
;
}
static
EDealRes
translateValueImpl
(
STranslateContext
*
pCxt
,
SValueNode
*
pVal
,
SDataType
targetDt
,
bool
strict
)
{
if
(
pVal
->
placeholderNo
>
0
||
pVal
->
isNull
)
{
return
DEAL_RES_CONTINUE
;
}
pVal
->
node
.
resType
=
targetDt
;
if
(
TSDB_DATA_TYPE_NULL
==
pVal
->
node
.
resType
.
type
)
{
// TODO
// pVal->node.resType = targetDt;
pVal
->
translate
=
true
;
pVal
->
isNull
=
true
;
return
DEAL_RES_CONTINUE
;
}
pVal
->
node
.
resType
.
precision
=
getPrecisionFromCurrStmt
(
pCxt
->
pCurrStmt
,
targetDt
.
precision
);
EDealRes
res
=
DEAL_RES_CONTINUE
;
if
(
pVal
->
isDuration
)
{
res
=
translateDurationValue
(
pCxt
,
pVal
);
}
else
{
res
=
translateNormalValue
(
pCxt
,
pVal
,
targetDt
,
strict
);
}
pVal
->
node
.
resType
=
targetDt
;
pVal
->
translate
=
true
;
return
res
;
}
static
int32_t
calcTypeBytes
(
SDataType
dt
)
{
...
...
@@ -920,7 +956,7 @@ static int32_t calcTypeBytes(SDataType dt) {
static
EDealRes
translateValue
(
STranslateContext
*
pCxt
,
SValueNode
*
pVal
)
{
SDataType
dt
=
pVal
->
node
.
resType
;
dt
.
bytes
=
calcTypeBytes
(
dt
);
return
translateValueImpl
(
pCxt
,
pVal
,
dt
);
return
translateValueImpl
(
pCxt
,
pVal
,
dt
,
false
);
}
static
bool
isMultiResFunc
(
SNode
*
pNode
)
{
...
...
@@ -3216,13 +3252,30 @@ static bool validRollupFunc(const char* pFunc) {
return
false
;
}
static
int32_t
checkTableRollupOption
(
STranslateContext
*
pCxt
,
SNodeList
*
pFuncs
)
{
static
int32_t
checkTableRollupOption
(
STranslateContext
*
pCxt
,
SNodeList
*
pFuncs
,
bool
createStable
,
SDbCfgInfo
*
pDbCfg
)
{
if
(
NULL
==
pFuncs
)
{
if
(
NULL
!=
pDbCfg
->
pRetensions
)
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_TABLE_OPTION
,
"To create a super table in a database with the retensions parameter configured, "
"the 'ROLLUP' option must be present"
);
}
return
TSDB_CODE_SUCCESS
;
}
if
(
1
!=
LIST_LENGTH
(
pFuncs
)
||
!
validRollupFunc
(((
SFunctionNode
*
)
nodesListGetNode
(
pFuncs
,
0
))
->
functionName
))
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_ROLLUP_OPTION
);
if
(
!
createStable
||
NULL
==
pDbCfg
->
pRetensions
)
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_TABLE_OPTION
,
"Invalid option rollup: Only supported for create super table in databases "
"configured with the 'RETENTIONS' option"
);
}
if
(
1
!=
LIST_LENGTH
(
pFuncs
))
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_ROLLUP_OPTION
,
"Invalid option rollup: only one function is allowed"
);
}
const
char
*
pFunc
=
((
SFunctionNode
*
)
nodesListGetNode
(
pFuncs
,
0
))
->
functionName
;
if
(
!
validRollupFunc
(
pFunc
))
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_ROLLUP_OPTION
,
"Invalid option rollup: %s function is not supported"
,
pFunc
);
}
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -3248,8 +3301,8 @@ static int32_t checkTableTagsSchema(STranslateContext* pCxt, SHashObj* pHash, SN
code
=
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_ONLY_ONE_JSON_TAG
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
((
TSDB_DATA_TYPE_VARCHAR
==
pTag
->
dataType
.
type
&&
pTag
->
dataType
.
bytes
>
TSDB_MAX_BINARY_LEN
)
||
(
TSDB_DATA_TYPE_NCHAR
==
pTag
->
dataType
.
type
&&
pTag
->
dataType
.
bytes
>
TSDB_MAX_NCHAR_LEN
))
{
if
((
TSDB_DATA_TYPE_VARCHAR
==
pTag
->
dataType
.
type
&&
calcTypeBytes
(
pTag
->
dataType
)
>
TSDB_MAX_BINARY_LEN
)
||
(
TSDB_DATA_TYPE_NCHAR
==
pTag
->
dataType
.
type
&&
calcTypeBytes
(
pTag
->
dataType
)
>
TSDB_MAX_NCHAR_LEN
))
{
code
=
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN
);
}
}
...
...
@@ -3270,11 +3323,11 @@ static int32_t checkTableTagsSchema(STranslateContext* pCxt, SHashObj* pHash, SN
return
code
;
}
static
int32_t
checkTableColsSchema
(
STranslateContext
*
pCxt
,
SHashObj
*
pHash
,
SNodeList
*
pCols
)
{
static
int32_t
checkTableColsSchema
(
STranslateContext
*
pCxt
,
SHashObj
*
pHash
,
int32_t
ntags
,
SNodeList
*
pCols
)
{
int32_t
ncols
=
LIST_LENGTH
(
pCols
);
if
(
ncols
<
TSDB_MIN_COLUMNS
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_COLUMNS_NUM
);
}
else
if
(
ncols
>
TSDB_MAX_COLUMNS
)
{
}
else
if
(
ncols
+
ntags
>
TSDB_MAX_COLUMNS
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_TOO_MANY_COLUMNS
);
}
...
...
@@ -3330,7 +3383,7 @@ static int32_t checkTableSchema(STranslateContext* pCxt, SCreateTableStmt* pStmt
int32_t
code
=
checkTableTagsSchema
(
pCxt
,
pHash
,
pStmt
->
pTags
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkTableColsSchema
(
pCxt
,
pHash
,
pStmt
->
pCols
);
code
=
checkTableColsSchema
(
pCxt
,
pHash
,
LIST_LENGTH
(
pStmt
->
pTags
),
pStmt
->
pCols
);
}
taosHashCleanup
(
pHash
);
...
...
@@ -3359,11 +3412,18 @@ static int32_t getTableMaxDelayOption(STranslateContext* pCxt, SValueNode* pVal,
pMaxDelay
);
}
static
int32_t
checkTableMaxDelayOption
(
STranslateContext
*
pCxt
,
STableOptions
*
pOptions
)
{
static
int32_t
checkTableMaxDelayOption
(
STranslateContext
*
pCxt
,
STableOptions
*
pOptions
,
bool
createStable
,
SDbCfgInfo
*
pDbCfg
)
{
if
(
NULL
==
pOptions
->
pMaxDelay
)
{
return
TSDB_CODE_SUCCESS
;
}
if
(
!
createStable
||
NULL
==
pDbCfg
->
pRetensions
)
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_TABLE_OPTION
,
"Invalid option maxdelay: Only supported for create super table in databases "
"configured with the 'RETENTIONS' option"
);
}
if
(
LIST_LENGTH
(
pOptions
->
pMaxDelay
)
>
2
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_TABLE_OPTION
,
"maxdelay"
);
}
...
...
@@ -3382,11 +3442,18 @@ static int32_t getTableWatermarkOption(STranslateContext* pCxt, SValueNode* pVal
pMaxDelay
);
}
static
int32_t
checkTableWatermarkOption
(
STranslateContext
*
pCxt
,
STableOptions
*
pOptions
)
{
static
int32_t
checkTableWatermarkOption
(
STranslateContext
*
pCxt
,
STableOptions
*
pOptions
,
bool
createStable
,
SDbCfgInfo
*
pDbCfg
)
{
if
(
NULL
==
pOptions
->
pWatermark
)
{
return
TSDB_CODE_SUCCESS
;
}
if
(
!
createStable
||
NULL
==
pDbCfg
->
pRetensions
)
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_TABLE_OPTION
,
"Invalid option watermark: Only supported for create super table in databases "
"configured with the 'RETENTIONS' option"
);
}
if
(
LIST_LENGTH
(
pOptions
->
pWatermark
)
>
2
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_TABLE_OPTION
,
"watermark"
);
}
...
...
@@ -3400,13 +3467,20 @@ static int32_t checkTableWatermarkOption(STranslateContext* pCxt, STableOptions*
return
code
;
}
static
int32_t
checkCreateTable
(
STranslateContext
*
pCxt
,
SCreateTableStmt
*
pStmt
)
{
int32_t
code
=
checkTableMaxDelayOption
(
pCxt
,
pStmt
->
pOptions
);
static
int32_t
checkCreateTable
(
STranslateContext
*
pCxt
,
SCreateTableStmt
*
pStmt
,
bool
createStable
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
SDbCfgInfo
dbCfg
=
{
0
};
if
(
createStable
)
{
code
=
getDBCfg
(
pCxt
,
pStmt
->
dbName
,
&
dbCfg
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkTable
WatermarkOption
(
pCxt
,
pStmt
->
pOptions
);
code
=
checkTable
MaxDelayOption
(
pCxt
,
pStmt
->
pOptions
,
createStable
,
&
dbCfg
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkTableRollupOption
(
pCxt
,
pStmt
->
pOptions
->
pRollupFuncs
);
code
=
checkTableWatermarkOption
(
pCxt
,
pStmt
->
pOptions
,
createStable
,
&
dbCfg
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkTableRollupOption
(
pCxt
,
pStmt
->
pOptions
->
pRollupFuncs
,
createStable
,
&
dbCfg
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkTableSmaOption
(
pCxt
,
pStmt
);
...
...
@@ -3685,7 +3759,7 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm
static
int32_t
translateCreateSuperTable
(
STranslateContext
*
pCxt
,
SCreateTableStmt
*
pStmt
)
{
SMCreateStbReq
createReq
=
{
0
};
int32_t
code
=
checkCreateTable
(
pCxt
,
pStmt
);
int32_t
code
=
checkCreateTable
(
pCxt
,
pStmt
,
true
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
buildCreateStbReq
(
pCxt
,
pStmt
,
&
createReq
);
}
...
...
@@ -4265,6 +4339,39 @@ static void getSourceDatabase(SNode* pStmt, int32_t acctId, char* pDbFName) {
tNameGetFullDbName
(
&
name
,
pDbFName
);
}
static
int32_t
addWstartTsToCreateStreamQuery
(
SNode
*
pStmt
)
{
SSelectStmt
*
pSelect
=
(
SSelectStmt
*
)
pStmt
;
SNode
*
pProj
=
nodesListGetNode
(
pSelect
->
pProjectionList
,
0
);
if
(
NULL
==
pSelect
->
pWindow
||
(
QUERY_NODE_FUNCTION
==
nodeType
(
pProj
)
&&
0
==
strcmp
(
"_wstartts"
,
((
SFunctionNode
*
)
pProj
)
->
functionName
)))
{
return
TSDB_CODE_SUCCESS
;
}
SFunctionNode
*
pFunc
=
(
SFunctionNode
*
)
nodesMakeNode
(
QUERY_NODE_FUNCTION
);
if
(
NULL
==
pFunc
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
strcpy
(
pFunc
->
functionName
,
"_wstartts"
);
strcpy
(
pFunc
->
node
.
aliasName
,
pFunc
->
functionName
);
int32_t
code
=
nodesListPushFront
(
pSelect
->
pProjectionList
,
(
SNode
*
)
pFunc
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
nodesDestroyNode
((
SNode
*
)
pFunc
);
}
return
code
;
}
static
int32_t
buildCreateStreamQuery
(
STranslateContext
*
pCxt
,
SNode
*
pStmt
,
SCMCreateStreamReq
*
pReq
)
{
pCxt
->
createStream
=
true
;
int32_t
code
=
addWstartTsToCreateStreamQuery
(
pStmt
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateQuery
(
pCxt
,
pStmt
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
getSourceDatabase
(
pStmt
,
pCxt
->
pParseCxt
->
acctId
,
pReq
->
sourceDB
);
code
=
nodesNodeToString
(
pStmt
,
false
,
&
pReq
->
ast
,
NULL
);
}
return
code
;
}
static
int32_t
buildCreateStreamReq
(
STranslateContext
*
pCxt
,
SCreateStreamStmt
*
pStmt
,
SCMCreateStreamReq
*
pReq
)
{
pReq
->
igExists
=
pStmt
->
ignoreExists
;
...
...
@@ -4278,13 +4385,7 @@ static int32_t buildCreateStreamReq(STranslateContext* pCxt, SCreateStreamStmt*
tNameExtractFullName
(
&
name
,
pReq
->
targetStbFullName
);
}
pCxt
->
createStream
=
true
;
int32_t
code
=
translateQuery
(
pCxt
,
pStmt
->
pQuery
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
getSourceDatabase
(
pStmt
->
pQuery
,
pCxt
->
pParseCxt
->
acctId
,
pReq
->
sourceDB
);
code
=
nodesNodeToString
(
pStmt
->
pQuery
,
false
,
&
pReq
->
ast
,
NULL
);
}
int32_t
code
=
buildCreateStreamQuery
(
pCxt
,
pStmt
->
pQuery
,
pReq
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
pReq
->
sql
=
strdup
(
pCxt
->
pParseCxt
->
pSql
);
if
(
NULL
==
pReq
->
sql
)
{
...
...
@@ -5233,7 +5334,7 @@ static int32_t buildCreateTableDataBlock(int32_t acctId, const SCreateTableStmt*
static
int32_t
rewriteCreateTable
(
STranslateContext
*
pCxt
,
SQuery
*
pQuery
)
{
SCreateTableStmt
*
pStmt
=
(
SCreateTableStmt
*
)
pQuery
->
pRoot
;
int32_t
code
=
checkCreateTable
(
pCxt
,
pStmt
);
int32_t
code
=
checkCreateTable
(
pCxt
,
pStmt
,
false
);
SVgroupInfo
info
=
{
0
};
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
getTableHashVgroup
(
pCxt
,
pStmt
->
dbName
,
pStmt
->
tableName
,
&
info
);
...
...
@@ -5337,7 +5438,7 @@ static int32_t createTagValFromVal(STranslateContext* pCxt, SDataType targetDt,
if
(
NULL
==
*
pVal
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
return
DEAL_RES_ERROR
==
translateValueImpl
(
pCxt
,
*
pVal
,
targetDt
)
?
pCxt
->
errCode
:
TSDB_CODE_SUCCESS
;
return
DEAL_RES_ERROR
==
translateValueImpl
(
pCxt
,
*
pVal
,
targetDt
,
true
)
?
pCxt
->
errCode
:
TSDB_CODE_SUCCESS
;
}
static
int32_t
createTagVal
(
STranslateContext
*
pCxt
,
uint8_t
precision
,
SSchema
*
pSchema
,
SNode
*
pNode
,
...
...
@@ -5721,7 +5822,7 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS
}
SDataType
targetDt
=
schemaToDataType
(
pTableMeta
->
tableInfo
.
precision
,
pSchema
);
if
(
DEAL_RES_ERROR
==
translateValueImpl
(
pCxt
,
pStmt
->
pVal
,
targetDt
))
{
if
(
DEAL_RES_ERROR
==
translateValueImpl
(
pCxt
,
pStmt
->
pVal
,
targetDt
,
true
))
{
return
pCxt
->
errCode
;
}
...
...
source/libs/parser/test/mockCatalog.cpp
浏览文件 @
d2223ae5
...
...
@@ -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,8 +183,18 @@ void generateTestT1(MockCatalogService* mcs) {
* tag2 | tag | VARCHAR | 20 |
* tag3 | tag | TIMESTAMP | 8 |
* Child Table: st1s1, st1s2
*
* Super Table: st2
* Field | Type | DataType | Bytes |
* ==========================================================================
* ts | column | TIMESTAMP | 8 |
* c1 | column | INT | 4 |
* c2 | column | VARCHAR | 20 |
* jtag | tag | json | -- |
* Child Table: st2s1, st2s2
*/
void
generateTestST1
(
MockCatalogService
*
mcs
)
{
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
)
...
...
@@ -197,19 +207,8 @@ void generateTestST1(MockCatalogService* mcs) {
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 |
* ==========================================================================
* ts | column | TIMESTAMP | 8 |
* c1 | column | INT | 4 |
* c2 | column | VARCHAR | 20 |
* 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
)
...
...
@@ -219,6 +218,7 @@ void generateTestST2(MockCatalogService* mcs) {
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
浏览文件 @
d2223ae5
...
...
@@ -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
浏览文件 @
d2223ae5
...
...
@@ -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
浏览文件 @
d2223ae5
...
...
@@ -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
浏览文件 @
d2223ae5
...
...
@@ -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"
);
...
...
source/libs/planner/src/planSpliter.c
浏览文件 @
d2223ae5
...
...
@@ -1220,6 +1220,7 @@ static int32_t qnodeSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan) {
if
(
!
splMatch
(
pCxt
,
pSubplan
,
0
,
(
FSplFindSplitNode
)
qndSplFindSplitNode
,
&
info
))
{
return
TSDB_CODE_SUCCESS
;
}
((
SScanLogicNode
*
)
info
.
pSplitNode
)
->
dataRequired
=
FUNC_DATA_REQUIRED_DATA_LOAD
;
int32_t
code
=
splCreateExchangeNodeForSubplan
(
pCxt
,
info
.
pSubplan
,
info
.
pSplitNode
,
info
.
pSubplan
->
subplanType
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
SLogicSubplan
*
pScanSubplan
=
splCreateScanSubplan
(
pCxt
,
info
.
pSplitNode
,
0
);
...
...
tests/script/jenkins/basic.txt
浏览文件 @
d2223ae5
...
...
@@ -164,6 +164,7 @@
./test.sh -f tsim/sma/drop_sma.sim
./test.sh -f tsim/sma/tsmaCreateInsertQuery.sim
./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim
./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim
# --- valgrind
./test.sh -f tsim/valgrind/checkError.sim -v
...
...
tests/script/tmp/prepare.sim
浏览文件 @
d2223ae5
...
...
@@ -30,10 +30,10 @@ endw
return
create database db vgroups 1024 buffer 3;
use db;
create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned);
create table ct1 using stb tags(1000);
create table ct2 using stb tags(1000) ;
show db.tables;
insert into ct1 values(now+0s, 10, 2.0, 3.0);
\ No newline at end of file
sql create database db vgroups 1024 buffer 3;
sql use db;
sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned);
sql create table ct1 using stb tags(1000);
sql create table ct2 using stb tags(1000) ;
sql show db.tables;
sql insert into ct1 values(now+0s, 10, 2.0, 3.0);
\ No newline at end of file
tests/script/tsim/sma/rsmaPersistenceRecovery.sim
0 → 100644
浏览文件 @
d2223ae5
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sleep 50
sql connect
print =============== create database with retentions
sql create database d0 retentions 5s:7d,5m:21d,15m:365d;
sql use d0
print =============== create super table and register rsma
sql create table if not exists stb (ts timestamp, c1 int, c2 float) tags (city binary(20),district binary(20)) rollup(max) max_delay 5s,5s watermark 2s,3s;
sql show stables
if $rows != 1 then
return -1
endi
print =============== create child table
sql create table ct1 using stb tags("BeiJing", "ChaoYang");
sql show tables
if $rows != 1 then
return -1
endi
print =============== insert data and trigger rollup
sql insert into ct1 values(now, 10, 10.0);
sql insert into ct1 values(now+1s, 1, 1.0);
sql insert into ct1 values(now+2s, 100, 100.0);
print =============== wait maxdelay 5+1 seconds for results
sleep 6000
print =============== select * from retention level 2 from memory
sql select * from ct1;
print $data00 $data01 $data02
if $rows > 2 then
print retention level 2 file rows $rows > 2
return -1
endi
if $data01 != 100 then
if $data01 != 10 then
print retention level 2 file result $data01 != 100 or 10
return -1
endi
endi
print =============== select * from retention level 1 from memory
sql select * from ct1 where ts > now-8d;
print $data00 $data01 $data02
if $rows > 2 then
print retention level 1 file rows $rows > 2
return -1
endi
if $data01 != 100 then
if $data01 != 10 then
print retention level 1 file result $data01 != 100 or 10
return -1
endi
endi
print =============== select * from retention level 0 from memory
sql select * from ct1 where ts > now-3d;
print $data00 $data01 $data02
print $data10 $data11 $data12
print $data20 $data21 $data22
if $rows < 1 then
print retention level 0 file rows $rows < 1
return -1
endi
if $data01 != 10 then
print retention level 0 file result $data01 != 10
return -1
endi
#===================================================================
#==================== reboot to trigger commit data to file
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
print =============== select * from retention level 2 from file
sql select * from ct1;
print $data00 $data01 $data02
if $rows > 2 then
print retention level 2 file rows $rows > 2
return -1
endi
if $data01 != 100 then
if $data01 != 10 then
print retention level 2 file result $data01 != 100 or 10
return -1
endi
endi
print =============== select * from retention level 1 from file
sql select * from ct1 where ts > now-8d;
print $data00 $data01 $data02
if $rows > 2 then
print retention level 1 file rows $rows > 2
return -1
endi
if $data01 != 100 then
if $data01 != 10 then
print retention level 1 file result $data01 != 100 or 10
return -1
endi
endi
print =============== select * from retention level 0 from file
sql select * from ct1 where ts > now-3d;
print $data00 $data01 $data02
print $data10 $data11 $data12
print $data20 $data21 $data22
if $rows < 1 then
print retention level 0 file rows $rows < 1
return -1
endi
if $data01 != 10 then
print retention level 0 file result $data01 != 10
return -1
endi
print =============== insert after rsma qtaskinfo recovery
sql insert into ct1 values(now, 50, 500.0);
sql insert into ct1 values(now+1s, 40, 40.0);
print =============== wait maxdelay 5+1 seconds for results
sleep 6000
print =============== select * from retention level 2 from file and memory after rsma qtaskinfo recovery
sql select * from ct1;
print $data00 $data01 $data02
if $rows > 2 then
print retention level 2 file/mem rows $rows > 2
return -1
endi
if $data01 != 100 then
if $data01 != 10 then
print retention level 2 file/mem result $data01 != 100 or 10
return -1
endi
endi
if $data02 != 500.00000 then
if $data02 != 100.00000 then
print retention level 1 file/mem result $data02 != 500.00000 or 100.00000
return -1
endi
endi
print =============== select * from retention level 1 from file and memory after rsma qtaskinfo recovery
sql select * from ct1 where ts > now-8d;
print $data00 $data01 $data02
if $rows > 2 then
print retention level 1 file/mem rows $rows > 2
return -1
endi
if $data01 != 100 then
if $data01 != 10 then
print retention level 1 file/mem result $data01 != 100 or 10
return -1
endi
endi
if $data02 != 500.00000 then
if $data02 != 100.00000 then
print retention level 1 file/mem result $data02 != 500.00000 or 100.00000
return -1
endi
endi
print =============== select * from retention level 0 from file and memory after rsma qtaskinfo recovery
sql select * from ct1 where ts > now-3d;
print $data00 $data01 $data02
print $data10 $data11 $data12
print $data20 $data21 $data22
print $data30 $data31 $data32
print $data40 $data41 $data42
if $rows < 1 then
print retention level 0 file/mem rows $rows < 1
return -1
endi
if $data01 != 10 then
print retention level 0 file/mem result $data01 != 10
return -1
endi
if $data11 != 1 then
print retention level 0 file/mem result $data11 != 1
return -1
endi
if $data21 != 100 then
print retention level 0 file/mem result $data21 != 100
return -1
endi
if $data31 != 50 then
print retention level 0 file/mem result $data31 != 50
return -1
endi
if $data32 != 500.00000 then
print retention level 0 file/mem result $data32 != 500.00000
return -1
endi
if $data41 != 40 then
print retention level 0 file/mem result $data41 != 40
return -1
endi
if $data42 != 40.00000 then
print retention level 0 file/mem result $data42 != 40.00000
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
tests/script/tsim/valgrind/basic.sim
浏览文件 @
d2223ae5
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
-v
sql connect
sql create database d0 vgroups 1;
print =============== step1: create drop show dnodes
$x = 0
step1:
$x = $x + 1
sleep 1000
if $x == 10 then
print ====> dnode not ready!
return -1
endi
sql show dnodes
print ===> $data00 $data01 $data02 $data03 $data04 $data05
if $rows != 1 then
return -1
endi
goto _OVER
print =============== step2: create alter drop show user
sql create user u1 pass 'taosdata'
sql show users
sql alter user u1 sysinfo 1
sql alter user u1 enable 1
sql alter user u1 pass 'taosdata'
sql alter user u2 sysinfo 0
sql drop user u1
_OVER:
system sh/exec.sh -n dnode1 -s stop -x SIGINT
tests/system-test/2-query/abs.py
浏览文件 @
d2223ae5
...
...
@@ -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
浏览文件 @
d2223ae5
...
...
@@ -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
浏览文件 @
d2223ae5
...
...
@@ -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
浏览文件 @
d2223ae5
...
...
@@ -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
浏览文件 @
d2223ae5
...
...
@@ -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
浏览文件 @
d2223ae5
...
...
@@ -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
浏览文件 @
d2223ae5
...
...
@@ -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
浏览文件 @
d2223ae5
...
...
@@ -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
浏览文件 @
d2223ae5
...
...
@@ -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
浏览文件 @
d2223ae5
...
...
@@ -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
浏览文件 @
d2223ae5
...
...
@@ -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
浏览文件 @
d2223ae5
...
...
@@ -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
浏览文件 @
d2223ae5
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录