Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
拾光师
TDengine
提交
4867add6
T
TDengine
项目概览
拾光师
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4867add6
编写于
1月 28, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-2555]<feature>: super table query support stddev query.
上级
3163eff6
变更
29
展开全部
隐藏空白更改
内联
并排
Showing
29 changed file
with
1723 addition
and
705 deletion
+1723
-705
src/client/inc/tscSubquery.h
src/client/inc/tscSubquery.h
+1
-0
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+3
-1
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+5
-4
src/client/src/tscLocalMerge.c
src/client/src/tscLocalMerge.c
+22
-19
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+41
-70
src/client/src/tscServer.c
src/client/src/tscServer.c
+6
-0
src/client/src/tscSql.c
src/client/src/tscSql.c
+0
-18
src/client/src/tscStream.c
src/client/src/tscStream.c
+1
-1
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+267
-13
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+36
-10
src/common/inc/tname.h
src/common/inc/tname.h
+7
-2
src/common/src/texpr.c
src/common/src/texpr.c
+1
-1
src/common/src/tname.c
src/common/src/tname.c
+10
-16
src/common/src/tvariant.c
src/common/src/tvariant.c
+11
-0
src/inc/taosmsg.h
src/inc/taosmsg.h
+1
-0
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+12
-12
src/query/inc/qAggMain.h
src/query/inc/qAggMain.h
+35
-37
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+19
-6
src/query/inc/qFill.h
src/query/inc/qFill.h
+2
-2
src/query/inc/qUtil.h
src/query/inc/qUtil.h
+10
-0
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+386
-196
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+310
-209
src/query/src/qFill.c
src/query/src/qFill.c
+2
-2
src/query/src/qUtil.c
src/query/src/qUtil.c
+94
-0
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+1
-1
src/util/inc/tarray.h
src/util/inc/tarray.h
+1
-1
src/util/src/tarray.c
src/util/src/tarray.c
+1
-1
tests/script/general/parser/function.sim
tests/script/general/parser/function.sim
+356
-1
tests/script/general/parser/testSuite.sim
tests/script/general/parser/testSuite.sim
+82
-82
未找到文件。
src/client/inc/tscSubquery.h
浏览文件 @
4867add6
...
...
@@ -33,6 +33,7 @@ SJoinSupporter* tscCreateJoinSupporter(SSqlObj* pSql, int32_t index);
void
tscHandleMasterJoinQuery
(
SSqlObj
*
pSql
);
int32_t
tscHandleMasterSTableQuery
(
SSqlObj
*
pSql
);
int32_t
tscHandleFirstRoundStableQuery
(
SSqlObj
*
pSql
);
int32_t
tscHandleMultivnodeInsert
(
SSqlObj
*
pSql
);
...
...
src/client/inc/tscUtil.h
浏览文件 @
4867add6
...
...
@@ -132,8 +132,9 @@ bool tscIsProjectionQuery(SQueryInfo* pQueryInfo);
bool
tscIsTwoStageSTableQuery
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
);
bool
tscQueryTags
(
SQueryInfo
*
pQueryInfo
);
bool
tscMultiRoundQuery
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
);
SSqlExpr
*
tscAdd
SpecialColumnForSelect
(
SQueryInfo
*
pQueryInfo
,
int32_t
outputColIndex
,
int16_t
functionId
,
SSqlExpr
*
tscAdd
FuncInSelectClause
(
SQueryInfo
*
pQueryInfo
,
int32_t
outputColIndex
,
int16_t
functionId
,
SColumnIndex
*
pIndex
,
SSchema
*
pColSchema
,
int16_t
colType
);
int32_t
tscSetTableFullName
(
STableMetaInfo
*
pTableMetaInfo
,
SStrToken
*
pzTableName
,
SSqlObj
*
pSql
);
...
...
@@ -174,6 +175,7 @@ SSqlExpr* tscSqlExprAppend(SQueryInfo* pQueryInfo, int16_t functionId, SColumnIn
SSqlExpr
*
tscSqlExprUpdate
(
SQueryInfo
*
pQueryInfo
,
int32_t
index
,
int16_t
functionId
,
int16_t
srcColumnIndex
,
int16_t
type
,
int16_t
size
);
size_t
tscSqlExprNumOfExprs
(
SQueryInfo
*
pQueryInfo
);
void
tscInsertPrimaryTsSourceColumn
(
SQueryInfo
*
pQueryInfo
,
SColumnIndex
*
pIndex
);
SSqlExpr
*
tscSqlExprGet
(
SQueryInfo
*
pQueryInfo
,
int32_t
index
);
int32_t
tscSqlExprCopy
(
SArray
*
dst
,
const
SArray
*
src
,
uint64_t
uid
,
bool
deepcopy
);
...
...
src/client/inc/tsclient.h
浏览文件 @
4867add6
...
...
@@ -224,7 +224,9 @@ typedef struct SQueryInfo {
int32_t
udColumnId
;
// current user-defined constant output field column id, monotonically decreases from TSDB_UD_COLUMN_INDEX
int16_t
resColumnId
;
// result column id
bool
distinctTag
;
// distinct tag or not
int32_t
round
;
// 0/1/....
int32_t
bufLen
;
char
*
buf
;
}
SQueryInfo
;
typedef
struct
{
...
...
@@ -405,10 +407,9 @@ void tscQueueAsyncError(void(*fp), void *param, int32_t code);
int
tscProcessLocalCmd
(
SSqlObj
*
pSql
);
int
tscCfgDynamicOptions
(
char
*
msg
);
int
taos_retrieve
(
TAOS_RES
*
res
);
int32_t
tscTansform
SQL
FuncForSTableQuery
(
SQueryInfo
*
pQueryInfo
);
void
tscRestore
SQL
FuncForSTableQuery
(
SQueryInfo
*
pQueryInfo
);
int32_t
tscTansformFuncForSTableQuery
(
SQueryInfo
*
pQueryInfo
);
void
tscRestoreFuncForSTableQuery
(
SQueryInfo
*
pQueryInfo
);
int32_t
tscCreateResPointerInfo
(
SSqlRes
*
pRes
,
SQueryInfo
*
pQueryInfo
);
void
tscSetResRawPtr
(
SSqlRes
*
pRes
,
SQueryInfo
*
pQueryInfo
);
...
...
src/client/src/tscLocalMerge.c
浏览文件 @
4867add6
...
...
@@ -68,7 +68,7 @@ static void tscInitSqlContext(SSqlCmd *pCmd, SLocalMerger *pReducer, tOrderDescr
SQLFunctionCtx
*
pCtx
=
&
pReducer
->
pCtx
[
i
];
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
pQueryInfo
,
i
);
pCtx
->
aOutputBuf
=
pReducer
->
pResultBuf
->
data
+
pExpr
->
offset
*
pReducer
->
resColModel
->
capacity
;
pCtx
->
pOutput
=
pReducer
->
pResultBuf
->
data
+
pExpr
->
offset
*
pReducer
->
resColModel
->
capacity
;
pCtx
->
order
=
pQueryInfo
->
order
.
order
;
pCtx
->
functionId
=
pExpr
->
functionId
;
...
...
@@ -76,7 +76,7 @@ static void tscInitSqlContext(SSqlCmd *pCmd, SLocalMerger *pReducer, tOrderDescr
int16_t
offset
=
getColumnModelOffset
(
pDesc
->
pColumnModel
,
i
);
SSchema
*
pSchema
=
getColumnModelSchema
(
pDesc
->
pColumnModel
,
i
);
pCtx
->
aInputElemBuf
=
pReducer
->
pTempBuffer
->
data
+
offset
;
pCtx
->
pInput
=
pReducer
->
pTempBuffer
->
data
+
offset
;
// input data format comes from pModel
pCtx
->
inputType
=
pSchema
->
type
;
...
...
@@ -94,7 +94,7 @@ static void tscInitSqlContext(SSqlCmd *pCmd, SLocalMerger *pReducer, tOrderDescr
// for top/bottom function, the output of timestamp is the first column
int32_t
functionId
=
pExpr
->
functionId
;
if
(
functionId
==
TSDB_FUNC_TOP
||
functionId
==
TSDB_FUNC_BOTTOM
||
functionId
==
TSDB_FUNC_DIFF
)
{
pCtx
->
ptsOutputBuf
=
pReducer
->
pCtx
[
0
].
aOutputBuf
;
pCtx
->
ptsOutputBuf
=
pReducer
->
pCtx
[
0
].
pOutput
;
pCtx
->
param
[
2
].
i64
=
pQueryInfo
->
order
.
order
;
pCtx
->
param
[
2
].
nType
=
TSDB_DATA_TYPE_BIGINT
;
pCtx
->
param
[
1
].
i64
=
pQueryInfo
->
order
.
orderColId
;
...
...
@@ -118,7 +118,7 @@ static void tscInitSqlContext(SSqlCmd *pCmd, SLocalMerger *pReducer, tOrderDescr
if
(
pExpr
->
functionId
==
TSDB_FUNC_TAG_DUMMY
||
pExpr
->
functionId
==
TSDB_FUNC_TS_DUMMY
)
{
tagLen
+=
pExpr
->
resBytes
;
pTagCtx
[
n
++
]
=
&
pReducer
->
pCtx
[
i
];
}
else
if
((
aAggs
[
pExpr
->
functionId
].
nS
tatus
&
TSDB_FUNCSTATE_SELECTIVITY
)
!=
0
)
{
}
else
if
((
aAggs
[
pExpr
->
functionId
].
s
tatus
&
TSDB_FUNCSTATE_SELECTIVITY
)
!=
0
)
{
pCtx
=
&
pReducer
->
pCtx
[
i
];
}
}
...
...
@@ -311,7 +311,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
pReducer
->
pCtx
=
(
SQLFunctionCtx
*
)
calloc
(
tscSqlExprNumOfExprs
(
pQueryInfo
),
sizeof
(
SQLFunctionCtx
));
pReducer
->
rowSize
=
pMemBuffer
[
0
]
->
nElemSize
;
tscRestore
SQL
FuncForSTableQuery
(
pQueryInfo
);
tscRestoreFuncForSTableQuery
(
pQueryInfo
);
tscFieldInfoUpdateOffset
(
pQueryInfo
);
if
(
pReducer
->
rowSize
>
pMemBuffer
[
0
]
->
pageSize
)
{
...
...
@@ -383,7 +383,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
if
(
pQueryInfo
->
fillType
!=
TSDB_FILL_NONE
)
{
SFillColInfo
*
pFillCol
=
createFillColInfo
(
pQueryInfo
);
pReducer
->
pFillInfo
=
taos
Init
FillInfo
(
pQueryInfo
->
order
.
order
,
revisedSTime
,
pQueryInfo
->
groupbyExpr
.
numOfGroupCols
,
pReducer
->
pFillInfo
=
taos
Create
FillInfo
(
pQueryInfo
->
order
.
order
,
revisedSTime
,
pQueryInfo
->
groupbyExpr
.
numOfGroupCols
,
4096
,
(
int32_t
)
pQueryInfo
->
fieldsInfo
.
numOfOutput
,
pQueryInfo
->
interval
.
sliding
,
pQueryInfo
->
interval
.
slidingUnit
,
tinfo
.
precision
,
pQueryInfo
->
fillType
,
pFillCol
,
pSql
);
}
...
...
@@ -720,7 +720,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
SSchema
p1
=
{
0
};
if
(
pExpr
->
colInfo
.
colIndex
==
TSDB_TBNAME_COLUMN_INDEX
)
{
p1
=
tGetTableN
ameColumnSchema
();
p1
=
*
tGetTbn
ameColumnSchema
();
}
else
if
(
TSDB_COL_IS_UD_COL
(
pExpr
->
colInfo
.
flag
))
{
p1
.
bytes
=
pExpr
->
resBytes
;
p1
.
type
=
(
uint8_t
)
pExpr
->
resType
;
...
...
@@ -744,6 +744,8 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
functionId
=
TSDB_FUNC_FIRST
;
}
else
if
(
functionId
==
TSDB_FUNC_LAST_DST
)
{
functionId
=
TSDB_FUNC_LAST
;
}
else
if
(
functionId
==
TSDB_FUNC_STDDEV_DST
)
{
functionId
=
TSDB_FUNC_STDDEV
;
}
int32_t
ret
=
getResultDataInfo
(
p1
.
type
,
p1
.
bytes
,
functionId
,
0
,
&
type
,
&
bytes
,
&
inter
,
0
,
false
);
...
...
@@ -1041,7 +1043,7 @@ static void savePreviousRow(SLocalMerger *pLocalMerge, tFilePage *tmpBuffer) {
pLocalMerge
->
hasPrevRow
=
true
;
}
static
void
doExecute
Secondary
Merge
(
SSqlCmd
*
pCmd
,
SLocalMerger
*
pLocalMerge
,
bool
needInit
)
{
static
void
doExecute
Final
Merge
(
SSqlCmd
*
pCmd
,
SLocalMerger
*
pLocalMerge
,
bool
needInit
)
{
// the tag columns need to be set before all functions execution
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
...
...
@@ -1053,7 +1055,7 @@ static void doExecuteSecondaryMerge(SSqlCmd *pCmd, SLocalMerger *pLocalMerge, bo
int32_t
functionId
=
pCtx
->
functionId
;
if
(
functionId
==
TSDB_FUNC_TAG_DUMMY
||
functionId
==
TSDB_FUNC_TAG
||
functionId
==
TSDB_FUNC_TS_DUMMY
)
{
tVariantDestroy
(
&
pCtx
->
tag
);
char
*
input
=
pCtx
->
aInputElemBuf
;
char
*
input
=
pCtx
->
pInput
;
if
(
pCtx
->
inputType
==
TSDB_DATA_TYPE_BINARY
||
pCtx
->
inputType
==
TSDB_DATA_TYPE_NCHAR
)
{
assert
(
varDataLen
(
input
)
<=
pCtx
->
inputBytes
);
...
...
@@ -1061,6 +1063,7 @@ static void doExecuteSecondaryMerge(SSqlCmd *pCmd, SLocalMerger *pLocalMerge, bo
}
else
{
tVariantCreateFromBinary
(
&
pCtx
->
tag
,
input
,
pCtx
->
inputBytes
,
pCtx
->
inputType
);
}
}
else
if
(
functionId
==
TSDB_FUNC_TOP
||
functionId
==
TSDB_FUNC_BOTTOM
)
{
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
pQueryInfo
,
j
);
pCtx
->
param
[
0
].
i64
=
pExpr
->
param
[
0
].
i64
;
...
...
@@ -1086,7 +1089,7 @@ static void doExecuteSecondaryMerge(SSqlCmd *pCmd, SLocalMerger *pLocalMerge, bo
static
void
handleUnprocessedRow
(
SSqlCmd
*
pCmd
,
SLocalMerger
*
pLocalMerge
,
tFilePage
*
tmpBuffer
)
{
if
(
pLocalMerge
->
hasUnprocessedRow
)
{
pLocalMerge
->
hasUnprocessedRow
=
false
;
doExecute
Secondary
Merge
(
pCmd
,
pLocalMerge
,
true
);
doExecute
Final
Merge
(
pCmd
,
pLocalMerge
,
true
);
savePreviousRow
(
pLocalMerge
,
tmpBuffer
);
}
}
...
...
@@ -1142,11 +1145,11 @@ static void fillMultiRowsOfTagsVal(SQueryInfo *pQueryInfo, int32_t numOfRes, SLo
int32_t
inc
=
numOfRes
-
1
;
// tsdb_func_tag function only produce one row of result
memset
(
buf
,
0
,
(
size_t
)
maxBufSize
);
memcpy
(
buf
,
pCtx
->
aOutputBuf
,
(
size_t
)
pCtx
->
outputBytes
);
memcpy
(
buf
,
pCtx
->
pOutput
,
(
size_t
)
pCtx
->
outputBytes
);
for
(
int32_t
i
=
0
;
i
<
inc
;
++
i
)
{
pCtx
->
aOutputBuf
+=
pCtx
->
outputBytes
;
memcpy
(
pCtx
->
aOutputBuf
,
buf
,
(
size_t
)
pCtx
->
outputBytes
);
pCtx
->
pOutput
+=
pCtx
->
outputBytes
;
memcpy
(
pCtx
->
pOutput
,
buf
,
(
size_t
)
pCtx
->
outputBytes
);
}
}
...
...
@@ -1289,10 +1292,10 @@ void resetOutputBuf(SQueryInfo *pQueryInfo, SLocalMerger *pLocalMerge) {// reset
size_t
t
=
tscSqlExprNumOfExprs
(
pQueryInfo
);
for
(
int32_t
i
=
0
;
i
<
t
;
++
i
)
{
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
pQueryInfo
,
i
);
pLocalMerge
->
pCtx
[
i
].
aOutputBuf
=
pLocalMerge
->
pResultBuf
->
data
+
pExpr
->
offset
*
pLocalMerge
->
resColModel
->
capacity
;
pLocalMerge
->
pCtx
[
i
].
pOutput
=
pLocalMerge
->
pResultBuf
->
data
+
pExpr
->
offset
*
pLocalMerge
->
resColModel
->
capacity
;
if
(
pExpr
->
functionId
==
TSDB_FUNC_TOP
||
pExpr
->
functionId
==
TSDB_FUNC_BOTTOM
||
pExpr
->
functionId
==
TSDB_FUNC_DIFF
)
{
pLocalMerge
->
pCtx
[
i
].
ptsOutputBuf
=
pLocalMerge
->
pCtx
[
0
].
aOutputBuf
;
pLocalMerge
->
pCtx
[
i
].
ptsOutputBuf
=
pLocalMerge
->
pCtx
[
0
].
pOutput
;
}
}
...
...
@@ -1404,7 +1407,7 @@ static void doProcessResultInNextWindow(SSqlObj *pSql, int32_t numOfRes) {
for
(
int32_t
k
=
0
;
k
<
size
;
++
k
)
{
SQLFunctionCtx
*
pCtx
=
&
pLocalMerge
->
pCtx
[
k
];
pCtx
->
aOutputBuf
+=
pCtx
->
outputBytes
*
numOfRes
;
pCtx
->
pOutput
+=
pCtx
->
outputBytes
*
numOfRes
;
// set the correct output timestamp column position
if
(
pCtx
->
functionId
==
TSDB_FUNC_TOP
||
pCtx
->
functionId
==
TSDB_FUNC_BOTTOM
)
{
...
...
@@ -1412,7 +1415,7 @@ static void doProcessResultInNextWindow(SSqlObj *pSql, int32_t numOfRes) {
}
}
doExecute
Secondary
Merge
(
pCmd
,
pLocalMerge
,
true
);
doExecute
Final
Merge
(
pCmd
,
pLocalMerge
,
true
);
}
int32_t
tscDoLocalMerge
(
SSqlObj
*
pSql
)
{
...
...
@@ -1504,7 +1507,7 @@ int32_t tscDoLocalMerge(SSqlObj *pSql) {
if
(
pLocalMerge
->
hasPrevRow
)
{
if
(
needToMerge
(
pQueryInfo
,
pLocalMerge
,
tmpBuffer
))
{
// belong to the group of the previous row, continue process it
doExecute
Secondary
Merge
(
pCmd
,
pLocalMerge
,
false
);
doExecute
Final
Merge
(
pCmd
,
pLocalMerge
,
false
);
// copy to buffer
savePreviousRow
(
pLocalMerge
,
tmpBuffer
);
...
...
@@ -1576,7 +1579,7 @@ int32_t tscDoLocalMerge(SSqlObj *pSql) {
}
}
}
else
{
doExecute
Secondary
Merge
(
pCmd
,
pLocalMerge
,
true
);
doExecute
Final
Merge
(
pCmd
,
pLocalMerge
,
true
);
savePreviousRow
(
pLocalMerge
,
tmpBuffer
);
// copy the processed row to buffer
}
...
...
src/client/src/tscSQLParser.c
浏览文件 @
4867add6
...
...
@@ -787,10 +787,10 @@ int32_t parseIntervalClause(SSqlObj* pSql, SQueryInfo* pQueryInfo, SQuerySQL* pQ
}
SSchema
s
=
{.
bytes
=
TSDB_KEYSIZE
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
,
.
colId
=
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
tstrncpy
(
s
.
name
,
aAggs
[
TSDB_FUNC_TS
].
aN
ame
,
sizeof
(
s
.
name
));
tstrncpy
(
s
.
name
,
aAggs
[
TSDB_FUNC_TS
].
n
ame
,
sizeof
(
s
.
name
));
SColumnIndex
index
=
{
tableIndex
,
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
tscAdd
SpecialColumnForSelect
(
pQueryInfo
,
0
,
TSDB_FUNC_TS
,
&
index
,
&
s
,
TSDB_COL_NORMAL
);
tscAdd
FuncInSelectClause
(
pQueryInfo
,
0
,
TSDB_FUNC_TS
,
&
index
,
&
s
,
TSDB_COL_NORMAL
);
if
(
parseOffsetClause
(
pCmd
,
pQueryInfo
,
pQuerySql
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
...
...
@@ -1319,7 +1319,7 @@ int32_t setObjFullName(char* fullName, const char* account, SStrToken* pDB, SStr
return
(
totalLen
<
TSDB_TABLE_FNAME_LEN
)
?
TSDB_CODE_SUCCESS
:
TSDB_CODE_TSC_INVALID_SQL
;
}
static
void
tscInsertPrimaryTS
SourceColumn
(
SQueryInfo
*
pQueryInfo
,
SColumnIndex
*
pIndex
)
{
void
tscInsertPrimaryTs
SourceColumn
(
SQueryInfo
*
pQueryInfo
,
SColumnIndex
*
pIndex
)
{
SColumnIndex
tsCol
=
{.
tableIndex
=
pIndex
->
tableIndex
,
.
columnIndex
=
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
tscColumnListInsert
(
pQueryInfo
->
colList
,
&
tsCol
);
}
...
...
@@ -1401,7 +1401,7 @@ static int32_t handleArithmeticExpr(SSqlCmd* pCmd, int32_t clauseIndex, int32_t
insertResultField
(
pQueryInfo
,
exprIndex
,
&
columnList
,
sizeof
(
double
),
TSDB_DATA_TYPE_DOUBLE
,
pExpr
->
aliasName
,
pExpr
);
// add ts column
tscInsertPrimaryT
S
SourceColumn
(
pQueryInfo
,
&
index
);
tscInsertPrimaryT
s
SourceColumn
(
pQueryInfo
,
&
index
);
tbufCloseWriter
(
&
bw
);
taosArrayDestroy
(
colList
);
...
...
@@ -1506,7 +1506,7 @@ static void addPrimaryTsColIntoResult(SQueryInfo* pQueryInfo) {
// add the timestamp column into the output columns
SColumnIndex
index
=
{
0
};
// primary timestamp column info
int32_t
numOfCols
=
(
int32_t
)
tscSqlExprNumOfExprs
(
pQueryInfo
);
tscAdd
SpecialColumnForSelect
(
pQueryInfo
,
numOfCols
,
TSDB_FUNC_PRJ
,
&
index
,
pSchema
,
TSDB_COL_NORMAL
);
tscAdd
FuncInSelectClause
(
pQueryInfo
,
numOfCols
,
TSDB_FUNC_PRJ
,
&
index
,
pSchema
,
TSDB_COL_NORMAL
);
SInternalField
*
pSupInfo
=
tscFieldInfoGetInternalField
(
&
pQueryInfo
->
fieldsInfo
,
numOfCols
);
pSupInfo
->
visible
=
false
;
...
...
@@ -1602,7 +1602,7 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, tSQLExprList* pSel
* in dealing with super table queries such as: count/first/last
*/
if
(
isSTable
)
{
tscTansform
SQL
FuncForSTableQuery
(
pQueryInfo
);
tscTansformFuncForSTableQuery
(
pQueryInfo
);
if
(
hasUnsupportFunctionsForSTableQuery
(
pCmd
,
pQueryInfo
))
{
return
TSDB_CODE_TSC_INVALID_SQL
;
...
...
@@ -1656,7 +1656,7 @@ SSqlExpr* doAddProjectCol(SQueryInfo* pQueryInfo, int32_t colIndex, int32_t tabl
(
functionId
==
TSDB_FUNC_TAGPRJ
));
}
SSqlExpr
*
tscAdd
SpecialColumnForSelect
(
SQueryInfo
*
pQueryInfo
,
int32_t
outputColIndex
,
int16_t
functionId
,
SSqlExpr
*
tscAdd
FuncInSelectClause
(
SQueryInfo
*
pQueryInfo
,
int32_t
outputColIndex
,
int16_t
functionId
,
SColumnIndex
*
pIndex
,
SSchema
*
pColSchema
,
int16_t
flag
)
{
int16_t
colId
=
getNewResColId
(
pQueryInfo
);
...
...
@@ -1738,7 +1738,7 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
}
// add the primary timestamp column even though it is not required by user
tscInsertPrimaryT
S
SourceColumn
(
pQueryInfo
,
&
index
);
tscInsertPrimaryT
s
SourceColumn
(
pQueryInfo
,
&
index
);
}
else
if
(
optr
==
TK_STRING
||
optr
==
TK_INTEGER
||
optr
==
TK_FLOAT
)
{
// simple column projection query
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
...
...
@@ -1748,7 +1748,7 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
SSchema
colSchema
=
tGetUserSpecifiedColumnSchema
(
&
pItem
->
pNode
->
val
,
&
pItem
->
pNode
->
token
,
pItem
->
aliasName
);
SSqlExpr
*
pExpr
=
tscAdd
SpecialColumnForSelect
(
pQueryInfo
,
startPos
,
TSDB_FUNC_PRJ
,
&
index
,
&
colSchema
,
TSDB_COL_UDC
);
tscAdd
FuncInSelectClause
(
pQueryInfo
,
startPos
,
TSDB_FUNC_PRJ
,
&
index
,
&
colSchema
,
TSDB_COL_UDC
);
// NOTE: the first parameter is reserved for the tag column id during join query process.
pExpr
->
numOfParams
=
2
;
...
...
@@ -1761,11 +1761,11 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
}
if
(
index
.
columnIndex
==
TSDB_TBNAME_COLUMN_INDEX
)
{
SSchema
colSchema
=
tGetTableN
ameColumnSchema
();
tscAdd
SpecialColumnForSelect
(
pQueryInfo
,
startPos
,
TSDB_FUNC_TAGPRJ
,
&
index
,
&
colSchema
,
TSDB_COL_TAG
);
SSchema
*
colSchema
=
tGetTbn
ameColumnSchema
();
tscAdd
FuncInSelectClause
(
pQueryInfo
,
startPos
,
TSDB_FUNC_TAGPRJ
,
&
index
,
colSchema
,
TSDB_COL_TAG
);
}
else
if
(
index
.
columnIndex
==
TSDB_BLOCK_DIST_COLUMN_INDEX
)
{
SSchema
colSchema
=
tGetBlockDistColumnSchema
();
tscAdd
SpecialColumnForSelect
(
pQueryInfo
,
startPos
,
TSDB_FUNC_PRJ
,
&
index
,
&
colSchema
,
TSDB_COL_TAG
);
tscAdd
FuncInSelectClause
(
pQueryInfo
,
startPos
,
TSDB_FUNC_PRJ
,
&
index
,
&
colSchema
,
TSDB_COL_TAG
);
}
else
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
index
.
tableIndex
);
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
...
...
@@ -1779,7 +1779,7 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
}
// add the primary timestamp column even though it is not required by user
tscInsertPrimaryT
S
SourceColumn
(
pQueryInfo
,
&
index
);
tscInsertPrimaryT
s
SourceColumn
(
pQueryInfo
,
&
index
);
}
else
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
...
...
@@ -1849,9 +1849,9 @@ void setResultColName(char* name, tSqlExprItem* pItem, int32_t functionId, SStrT
if
(
tsKeepOriginalColumnName
)
{
// keep the original column name
tstrncpy
(
name
,
uname
,
TSDB_COL_NAME_LEN
);
}
else
{
int32_t
size
=
TSDB_COL_NAME_LEN
+
tListLen
(
aAggs
[
functionId
].
aN
ame
)
+
2
+
1
;
char
tmp
[
TSDB_COL_NAME_LEN
+
tListLen
(
aAggs
[
functionId
].
aN
ame
)
+
2
+
1
]
=
{
0
};
snprintf
(
tmp
,
size
,
"%s(%s)"
,
aAggs
[
functionId
].
aN
ame
,
uname
);
int32_t
size
=
TSDB_COL_NAME_LEN
+
tListLen
(
aAggs
[
functionId
].
n
ame
)
+
2
+
1
;
char
tmp
[
TSDB_COL_NAME_LEN
+
tListLen
(
aAggs
[
functionId
].
n
ame
)
+
2
+
1
]
=
{
0
};
snprintf
(
tmp
,
size
,
"%s(%s)"
,
aAggs
[
functionId
].
n
ame
,
uname
);
tstrncpy
(
name
,
tmp
,
TSDB_COL_NAME_LEN
);
}
...
...
@@ -1966,7 +1966,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
// the time stamp may be always needed
if
(
index
.
tableIndex
<
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
))
{
tscInsertPrimaryT
S
SourceColumn
(
pQueryInfo
,
&
index
);
tscInsertPrimaryT
s
SourceColumn
(
pQueryInfo
,
&
index
);
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -2036,7 +2036,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
getNewResColId
(
pQueryInfo
),
TSDB_KEYSIZE
,
false
);
SColumnList
ids
=
getColumnList
(
1
,
0
,
0
);
insertResultField
(
pQueryInfo
,
0
,
&
ids
,
TSDB_KEYSIZE
,
TSDB_DATA_TYPE_TIMESTAMP
,
aAggs
[
TSDB_FUNC_TS_DUMMY
].
aN
ame
,
pExpr
);
insertResultField
(
pQueryInfo
,
0
,
&
ids
,
TSDB_KEYSIZE
,
TSDB_DATA_TYPE_TIMESTAMP
,
aAggs
[
TSDB_FUNC_TS_DUMMY
].
n
ame
,
pExpr
);
}
// functions can not be applied to tags
...
...
@@ -2079,7 +2079,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
}
}
tscInsertPrimaryT
S
SourceColumn
(
pQueryInfo
,
&
index
);
tscInsertPrimaryT
s
SourceColumn
(
pQueryInfo
,
&
index
);
return
TSDB_CODE_SUCCESS
;
}
case
TK_FIRST
:
...
...
@@ -2285,7 +2285,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
if
(
convertFunctionId
(
optr
,
&
functionId
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
tscInsertPrimaryT
S
SourceColumn
(
pQueryInfo
,
&
index
);
tscInsertPrimaryT
s
SourceColumn
(
pQueryInfo
,
&
index
);
colIndex
+=
1
;
// the first column is ts
pExpr
=
tscSqlExprAppend
(
pQueryInfo
,
functionId
,
&
index
,
resultType
,
resultSize
,
getNewResColId
(
pQueryInfo
),
resultSize
,
false
);
...
...
@@ -2308,12 +2308,12 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
SColumnIndex
index1
=
{
0
,
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
pExpr
=
tscSqlExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS
,
&
index1
,
TSDB_DATA_TYPE_TIMESTAMP
,
TSDB_KEYSIZE
,
getNewResColId
(
pQueryInfo
),
TSDB_KEYSIZE
,
false
);
tstrncpy
(
pExpr
->
aliasName
,
aAggs
[
TSDB_FUNC_TS
].
aN
ame
,
sizeof
(
pExpr
->
aliasName
));
tstrncpy
(
pExpr
->
aliasName
,
aAggs
[
TSDB_FUNC_TS
].
n
ame
,
sizeof
(
pExpr
->
aliasName
));
const
int32_t
TS_COLUMN_INDEX
=
PRIMARYKEY_TIMESTAMP_COL_INDEX
;
SColumnList
ids
=
getColumnList
(
1
,
0
,
TS_COLUMN_INDEX
);
insertResultField
(
pQueryInfo
,
TS_COLUMN_INDEX
,
&
ids
,
TSDB_KEYSIZE
,
TSDB_DATA_TYPE_TIMESTAMP
,
aAggs
[
TSDB_FUNC_TS
].
aN
ame
,
pExpr
);
aAggs
[
TSDB_FUNC_TS
].
n
ame
,
pExpr
);
colIndex
+=
1
;
// the first column is ts
...
...
@@ -2384,7 +2384,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
SSchema
s
=
{
0
};
if
(
index
.
columnIndex
==
TSDB_TBNAME_COLUMN_INDEX
)
{
s
=
tGetTableN
ameColumnSchema
();
s
=
*
tGetTbn
ameColumnSchema
();
}
else
{
s
=
pTagSchema
[
index
.
columnIndex
];
}
...
...
@@ -2400,7 +2400,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
s
.
bytes
=
bytes
;
TSDB_QUERY_SET_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_TAG_FILTER_QUERY
);
tscAdd
SpecialColumnForSelect
(
pQueryInfo
,
0
,
TSDB_FUNC_TID_TAG
,
&
index
,
&
s
,
TSDB_COL_TAG
);
tscAdd
FuncInSelectClause
(
pQueryInfo
,
0
,
TSDB_FUNC_TID_TAG
,
&
index
,
&
s
,
TSDB_COL_TAG
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -2778,7 +2778,7 @@ bool validateIpAddress(const char* ip, size_t size) {
return
epAddr
!=
INADDR_NONE
;
}
int32_t
tscTansform
SQL
FuncForSTableQuery
(
SQueryInfo
*
pQueryInfo
)
{
int32_t
tscTansformFuncForSTableQuery
(
SQueryInfo
*
pQueryInfo
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
if
(
pTableMetaInfo
->
pTableMeta
==
NULL
||
!
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
...
...
@@ -2800,7 +2800,7 @@ int32_t tscTansformSQLFuncForSTableQuery(SQueryInfo* pQueryInfo) {
SSchema
*
pSrcSchema
=
tscGetTableColumnSchema
(
pTableMetaInfo
->
pTableMeta
,
colIndex
);
if
((
functionId
>=
TSDB_FUNC_SUM
&&
functionId
<=
TSDB_FUNC_TWA
)
||
(
functionId
>=
TSDB_FUNC_FIRST_DST
&&
functionId
<=
TSDB_FUNC_
LAST
_DST
)
||
(
functionId
>=
TSDB_FUNC_FIRST_DST
&&
functionId
<=
TSDB_FUNC_
STDDEV
_DST
)
||
(
functionId
>=
TSDB_FUNC_RATE
&&
functionId
<=
TSDB_FUNC_AVG_IRATE
))
{
if
(
getResultDataInfo
(
pSrcSchema
->
type
,
pSrcSchema
->
bytes
,
functionId
,
(
int32_t
)
pExpr
->
param
[
0
].
i64
,
&
type
,
&
bytes
,
&
interBytes
,
0
,
true
)
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -2818,7 +2818,7 @@ int32_t tscTansformSQLFuncForSTableQuery(SQueryInfo* pQueryInfo) {
}
/* transfer the field-info back to original input format */
void
tscRestore
SQL
FuncForSTableQuery
(
SQueryInfo
*
pQueryInfo
)
{
void
tscRestoreFuncForSTableQuery
(
SQueryInfo
*
pQueryInfo
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
if
(
!
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
return
;
...
...
@@ -2842,6 +2842,8 @@ void tscRestoreSQLFuncForSTableQuery(SQueryInfo* pQueryInfo) {
functionId
=
TSDB_FUNC_FIRST
;
}
else
if
(
functionId
==
TSDB_FUNC_LAST_DST
)
{
functionId
=
TSDB_FUNC_LAST
;
}
else
if
(
functionId
==
TSDB_FUNC_STDDEV_DST
)
{
functionId
=
TSDB_FUNC_STDDEV
;
}
getResultDataInfo
(
pSchema
->
type
,
pSchema
->
bytes
,
functionId
,
0
,
&
pExpr
->
resType
,
&
pExpr
->
resBytes
,
...
...
@@ -2858,7 +2860,7 @@ bool hasUnsupportFunctionsForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo)
size_t
size
=
tscSqlExprNumOfExprs
(
pQueryInfo
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
int32_t
functionId
=
tscSqlExprGet
(
pQueryInfo
,
i
)
->
functionId
;
if
((
aAggs
[
functionId
].
nS
tatus
&
TSDB_FUNCSTATE_STABLE
)
==
0
)
{
if
((
aAggs
[
functionId
].
s
tatus
&
TSDB_FUNCSTATE_STABLE
)
==
0
)
{
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
true
;
}
...
...
@@ -2968,7 +2970,7 @@ int32_t parseGroupbyClause(SQueryInfo* pQueryInfo, SArray* pList, SSqlCmd* pCmd)
STableMeta
*
pTableMeta
=
NULL
;
SSchema
*
pSchema
=
NULL
;
SSchema
s
=
tGetTbnameColumnSchema
();
//
SSchema s = tGetTbnameColumnSchema();
int32_t
tableIndex
=
COLUMN_INDEX_INITIAL_VAL
;
...
...
@@ -2995,7 +2997,7 @@ int32_t parseGroupbyClause(SQueryInfo* pQueryInfo, SArray* pList, SSqlCmd* pCmd)
int32_t
numOfCols
=
tscGetNumOfColumns
(
pTableMeta
);
if
(
index
.
columnIndex
==
TSDB_TBNAME_COLUMN_INDEX
)
{
pSchema
=
&
s
;
pSchema
=
tGetTbnameColumnSchema
()
;
}
else
{
pSchema
=
tscGetTableColumnSchema
(
pTableMeta
,
index
.
columnIndex
);
}
...
...
@@ -3547,38 +3549,6 @@ static int32_t getJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSQLExpr*
return
TSDB_CODE_SUCCESS
;
}
// todo error handle / such as and /or mixed with +/-/*/
int32_t
doArithmeticExprToString
(
tSQLExpr
*
pExpr
,
char
**
exprString
)
{
tSQLExpr
*
pLeft
=
pExpr
->
pLeft
;
tSQLExpr
*
pRight
=
pExpr
->
pRight
;
*
(
*
exprString
)
++
=
'('
;
if
(
pLeft
->
nSQLOptr
>=
TK_PLUS
&&
pLeft
->
nSQLOptr
<=
TK_REM
)
{
doArithmeticExprToString
(
pLeft
,
exprString
);
}
else
{
int32_t
ret
=
tSQLExprNodeToString
(
pLeft
,
exprString
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
}
optrToString
(
pExpr
,
exprString
);
if
(
pRight
->
nSQLOptr
>=
TK_PLUS
&&
pRight
->
nSQLOptr
<=
TK_REM
)
{
doArithmeticExprToString
(
pRight
,
exprString
);
}
else
{
int32_t
ret
=
tSQLExprNodeToString
(
pRight
,
exprString
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
}
*
(
*
exprString
)
++
=
')'
;
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
validateSQLExpr
(
SSqlCmd
*
pCmd
,
tSQLExpr
*
pExpr
,
SQueryInfo
*
pQueryInfo
,
SColumnList
*
pList
,
int32_t
*
type
,
uint64_t
*
uid
)
{
if
(
pExpr
->
nSQLOptr
==
TK_ID
)
{
...
...
@@ -5228,7 +5198,7 @@ int32_t validateSqlFunctionInStreamSql(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) {
size_t
size
=
taosArrayGetSize
(
pQueryInfo
->
exprList
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
int32_t
functId
=
tscSqlExprGet
(
pQueryInfo
,
i
)
->
functionId
;
if
(
!
IS_STREAM_QUERY_VALID
(
aAggs
[
functId
].
nS
tatus
))
{
if
(
!
IS_STREAM_QUERY_VALID
(
aAggs
[
functId
].
s
tatus
))
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
}
...
...
@@ -5251,7 +5221,7 @@ int32_t validateFunctionsInIntervalOrGroupbyQuery(SSqlCmd* pCmd, SQueryInfo* pQu
bool
hasSelectivity
=
false
;
for
(
int32_t
j
=
0
;
j
<
size
;
++
j
)
{
SSqlExpr
*
pEx
=
tscSqlExprGet
(
pQueryInfo
,
j
);
if
((
aAggs
[
pEx
->
functionId
].
nS
tatus
&
TSDB_FUNCSTATE_SELECTIVITY
)
==
TSDB_FUNCSTATE_SELECTIVITY
)
{
if
((
aAggs
[
pEx
->
functionId
].
s
tatus
&
TSDB_FUNCSTATE_SELECTIVITY
)
==
TSDB_FUNCSTATE_SELECTIVITY
)
{
hasSelectivity
=
true
;
break
;
}
...
...
@@ -5704,7 +5674,7 @@ void doAddGroupColumnForSubquery(SQueryInfo* pQueryInfo, int32_t tagIndex) {
SSchema
*
pSchema
=
tscGetTableColumnSchema
(
pTableMetaInfo
->
pTableMeta
,
pColIndex
->
colIndex
);
SColumnIndex
colIndex
=
{.
tableIndex
=
0
,
.
columnIndex
=
pColIndex
->
colIndex
};
tscAdd
SpecialColumnForSelect
(
pQueryInfo
,
(
int32_t
)
size
,
TSDB_FUNC_PRJ
,
&
colIndex
,
pSchema
,
TSDB_COL_NORMAL
);
tscAdd
FuncInSelectClause
(
pQueryInfo
,
(
int32_t
)
size
,
TSDB_FUNC_PRJ
,
&
colIndex
,
pSchema
,
TSDB_COL_NORMAL
);
int32_t
numOfFields
=
tscNumOfFields
(
pQueryInfo
);
SInternalField
*
pInfo
=
tscFieldInfoGetInternalField
(
&
pQueryInfo
->
fieldsInfo
,
numOfFields
-
1
);
...
...
@@ -5868,7 +5838,7 @@ static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, SSqlCmd* pCmd)
continue
;
}
if
((
aAggs
[
functionId
].
nS
tatus
&
TSDB_FUNCSTATE_SELECTIVITY
)
!=
0
)
{
if
((
aAggs
[
functionId
].
s
tatus
&
TSDB_FUNCSTATE_SELECTIVITY
)
!=
0
)
{
numOfSelectivity
++
;
}
else
{
numOfAggregation
++
;
...
...
@@ -5900,7 +5870,7 @@ static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, SSqlCmd* pCmd)
for
(
int32_t
i
=
0
;
i
<
numOfExprs
;
++
i
)
{
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
pQueryInfo
,
i
);
int16_t
functionId
=
pExpr
->
functionId
;
if
(
functionId
==
TSDB_FUNC_TAGPRJ
||
(
aAggs
[
functionId
].
nS
tatus
&
TSDB_FUNCSTATE_SELECTIVITY
)
==
0
)
{
if
(
functionId
==
TSDB_FUNC_TAGPRJ
||
(
aAggs
[
functionId
].
s
tatus
&
TSDB_FUNCSTATE_SELECTIVITY
)
==
0
)
{
continue
;
}
...
...
@@ -5943,7 +5913,7 @@ static int32_t doAddGroupbyColumnsOnDemand(SSqlCmd* pCmd, SQueryInfo* pQueryInfo
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
SSchema
s
=
tGetTableN
ameColumnSchema
();
SSchema
s
=
*
tGetTbn
ameColumnSchema
();
SSchema
*
pSchema
=
tscGetTableSchema
(
pTableMetaInfo
->
pTableMeta
);
int16_t
bytes
=
0
;
int16_t
type
=
0
;
...
...
@@ -6087,7 +6057,7 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) {
}
}
if
(
IS_MULTIOUTPUT
(
aAggs
[
functId
].
nS
tatus
)
&&
functId
!=
TSDB_FUNC_TOP
&&
functId
!=
TSDB_FUNC_BOTTOM
&&
if
(
IS_MULTIOUTPUT
(
aAggs
[
functId
].
s
tatus
)
&&
functId
!=
TSDB_FUNC_TOP
&&
functId
!=
TSDB_FUNC_BOTTOM
&&
functId
!=
TSDB_FUNC_TAGPRJ
&&
functId
!=
TSDB_FUNC_PRJ
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
...
...
@@ -6277,7 +6247,7 @@ void tscPrintSelectClause(SSqlObj* pSql, int32_t subClauseIndex) {
char
tmpBuf
[
1024
]
=
{
0
};
int32_t
tmpLen
=
0
;
tmpLen
=
sprintf
(
tmpBuf
,
"%s(uid:%"
PRId64
", %d)"
,
aAggs
[
pExpr
->
functionId
].
aN
ame
,
pExpr
->
uid
,
pExpr
->
colInfo
.
colId
);
sprintf
(
tmpBuf
,
"%s(uid:%"
PRId64
", %d)"
,
aAggs
[
pExpr
->
functionId
].
n
ame
,
pExpr
->
uid
,
pExpr
->
colInfo
.
colId
);
if
(
tmpLen
+
offset
>=
totalBufSize
-
1
)
break
;
...
...
@@ -6978,3 +6948,4 @@ bool hasNormalColumnFilter(SQueryInfo* pQueryInfo) {
return
false
;
}
src/client/src/tscServer.c
浏览文件 @
4867add6
...
...
@@ -746,6 +746,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pQueryMsg
->
queryType
=
htonl
(
pQueryInfo
->
type
);
pQueryMsg
->
vgroupLimit
=
htobe64
(
pQueryInfo
->
vgroupLimit
);
pQueryMsg
->
sqlstrLen
=
htonl
(
sqlLen
);
pQueryMsg
->
prevResultLen
=
htonl
(
pQueryInfo
->
bufLen
);
size_t
numOfOutput
=
tscSqlExprNumOfExprs
(
pQueryInfo
);
pQueryMsg
->
numOfOutput
=
htons
((
int16_t
)
numOfOutput
);
// this is the stage one output column number
...
...
@@ -983,6 +984,11 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
}
}
if
(
pQueryInfo
->
bufLen
>
0
)
{
memcpy
(
pMsg
,
pQueryInfo
->
buf
,
pQueryInfo
->
bufLen
);
pMsg
+=
pQueryInfo
->
bufLen
;
}
SCond
*
pCond
=
&
pQueryInfo
->
tagCond
.
tbnameCond
;
if
(
pCond
->
len
>
0
)
{
strncpy
(
pMsg
,
pCond
->
cond
,
pCond
->
len
);
...
...
src/client/src/tscSql.c
浏览文件 @
4867add6
...
...
@@ -446,24 +446,6 @@ TAOS_FIELD *taos_fetch_fields(TAOS_RES *res) {
return
pFieldInfo
->
final
;
}
int
taos_retrieve
(
TAOS_RES
*
res
)
{
if
(
res
==
NULL
)
return
0
;
SSqlObj
*
pSql
=
(
SSqlObj
*
)
res
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
return
0
;
if
(
pRes
->
qhandle
==
0
)
return
0
;
tscResetForNextRetrieve
(
pRes
);
if
(
pCmd
->
command
<
TSDB_SQL_LOCAL
)
{
pCmd
->
command
=
(
pCmd
->
command
>
TSDB_SQL_MGMT
)
?
TSDB_SQL_RETRIEVE
:
TSDB_SQL_FETCH
;
}
tscProcessSql
(
pSql
);
return
pRes
->
numOfRows
;
}
static
bool
needToFetchNewBlock
(
SSqlObj
*
pSql
)
{
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
...
...
src/client/src/tscStream.c
浏览文件 @
4867add6
...
...
@@ -103,7 +103,7 @@ static void doLaunchQuery(void* param, TAOS_RES* tres, int32_t code) {
// failed to get table Meta or vgroup list, retry in 10sec.
if
(
code
==
TSDB_CODE_SUCCESS
)
{
tscTansform
SQL
FuncForSTableQuery
(
pQueryInfo
);
tscTansformFuncForSTableQuery
(
pQueryInfo
);
tscDebug
(
"%p stream:%p, start stream query on:%s"
,
pSql
,
pStream
,
tNameGetTableName
(
&
pTableMetaInfo
->
name
));
pSql
->
fp
=
tscProcessStreamQueryCallback
;
...
...
src/client/src/tscSubquery.c
浏览文件 @
4867add6
...
...
@@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _GNU_SOURCE
#include "os.h"
#include "texpr.h"
...
...
@@ -23,6 +23,7 @@
#include "tscSubquery.h"
#include "tschemautil.h"
#include "tsclient.h"
#include "qUtil.h"
typedef
struct
SInsertSupporter
{
SSqlObj
*
pSql
;
...
...
@@ -501,7 +502,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
int16_t
functionId
=
tscIsProjectionQuery
(
pQueryInfo
)
?
TSDB_FUNC_PRJ
:
TSDB_FUNC_TS
;
tscAdd
SpecialColumnForSelect
(
pQueryInfo
,
0
,
functionId
,
&
index
,
s
,
TSDB_COL_NORMAL
);
tscAdd
FuncInSelectClause
(
pQueryInfo
,
0
,
functionId
,
&
index
,
s
,
TSDB_COL_NORMAL
);
tscPrintSelectClause
(
pNew
,
0
);
tscFieldInfoUpdateOffset
(
pQueryInfo
);
...
...
@@ -681,7 +682,7 @@ void tscBuildVgroupTableInfo(SSqlObj* pSql, STableMetaInfo* pTableMetaInfo, SArr
}
}
static
void
issueT
S
CompQuery
(
SSqlObj
*
pSql
,
SJoinSupporter
*
pSupporter
,
SSqlObj
*
pParent
)
{
static
void
issueT
s
CompQuery
(
SSqlObj
*
pSql
,
SJoinSupporter
*
pSupporter
,
SSqlObj
*
pParent
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
tscClearSubqueryInfo
(
pCmd
);
tscFreeSqlResult
(
pSql
);
...
...
@@ -701,7 +702,7 @@ static void issueTSCompQuery(SSqlObj* pSql, SJoinSupporter* pSupporter, SSqlObj*
SSchema
colSchema
=
{.
type
=
TSDB_DATA_TYPE_BINARY
,
.
bytes
=
1
};
SColumnIndex
index
=
{
0
,
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
tscAdd
SpecialColumnForSelect
(
pQueryInfo
,
0
,
TSDB_FUNC_TS_COMP
,
&
index
,
&
colSchema
,
TSDB_COL_NORMAL
);
tscAdd
FuncInSelectClause
(
pQueryInfo
,
0
,
TSDB_FUNC_TS_COMP
,
&
index
,
&
colSchema
,
TSDB_COL_NORMAL
);
// set the tags value for ts_comp function
if
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
...
...
@@ -970,7 +971,7 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
for
(
int32_t
m
=
0
;
m
<
pParentSql
->
subState
.
numOfSub
;
++
m
)
{
SSqlObj
*
sub
=
pParentSql
->
pSubs
[
m
];
issueT
S
CompQuery
(
sub
,
sub
->
param
,
pParentSql
);
issueT
s
CompQuery
(
sub
,
sub
->
param
,
pParentSql
);
}
}
...
...
@@ -1470,7 +1471,7 @@ void tscSetupOutputColumnIndex(SSqlObj* pSql) {
}
// restore the offset value for super table query in case of final result.
tscRestore
SQL
FuncForSTableQuery
(
pQueryInfo
);
tscRestoreFuncForSTableQuery
(
pQueryInfo
);
tscFieldInfoUpdateOffset
(
pQueryInfo
);
}
...
...
@@ -1651,7 +1652,7 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter
// set get tags query type
TSDB_QUERY_SET_TYPE
(
pNewQueryInfo
->
type
,
TSDB_QUERY_TYPE_TAG_FILTER_QUERY
);
tscAdd
SpecialColumnForSelect
(
pNewQueryInfo
,
0
,
TSDB_FUNC_TID_TAG
,
&
colIndex
,
&
s1
,
TSDB_COL_TAG
);
tscAdd
FuncInSelectClause
(
pNewQueryInfo
,
0
,
TSDB_FUNC_TID_TAG
,
&
colIndex
,
&
s1
,
TSDB_COL_TAG
);
size_t
numOfCols
=
taosArrayGetSize
(
pNewQueryInfo
->
colList
);
tscDebug
(
...
...
@@ -1662,7 +1663,7 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter
}
else
{
SSchema
colSchema
=
{.
type
=
TSDB_DATA_TYPE_BINARY
,
.
bytes
=
1
};
SColumnIndex
colIndex
=
{
0
,
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
tscAdd
SpecialColumnForSelect
(
pNewQueryInfo
,
0
,
TSDB_FUNC_TS_COMP
,
&
colIndex
,
&
colSchema
,
TSDB_COL_NORMAL
);
tscAdd
FuncInSelectClause
(
pNewQueryInfo
,
0
,
TSDB_FUNC_TS_COMP
,
&
colIndex
,
&
colSchema
,
TSDB_COL_NORMAL
);
// set the tags value for ts_comp function
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
pNewQueryInfo
,
0
);
...
...
@@ -1821,7 +1822,262 @@ void tscUnlockByThread(int64_t *lockedBy) {
}
}
typedef
struct
SFirstRoundQuerySup
{
SSqlObj
*
pParent
;
int32_t
numOfRows
;
SArray
*
pColsInfo
;
int32_t
tagLen
;
STColumn
*
pTagCols
;
SArray
*
pResult
;
// SArray<SInterResult>
int64_t
interval
;
char
*
buf
;
int32_t
bufLen
;
}
SFirstRoundQuerySup
;
void
doAppendData
(
SInterResult
*
pInterResult
,
TAOS_ROW
row
,
int32_t
numOfCols
,
SQueryInfo
*
pQueryInfo
)
{
TSKEY
key
=
INT64_MIN
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
pQueryInfo
,
i
);
if
(
TSDB_COL_IS_TAG
(
pExpr
->
colInfo
.
flag
))
{
continue
;
}
if
(
pExpr
->
colInfo
.
colId
==
PRIMARYKEY_TIMESTAMP_COL_INDEX
)
{
key
=
*
(
TSKEY
*
)
row
[
i
];
continue
;
}
double
v
=
0
;
if
(
row
[
i
]
!=
NULL
)
{
v
=
*
(
double
*
)
row
[
i
];
}
else
{
SET_DOUBLE_NULL
(
&
v
);
}
int32_t
id
=
pExpr
->
colInfo
.
colId
;
int32_t
numOfQueriedCols
=
taosArrayGetSize
(
pInterResult
->
pResult
);
SArray
*
p
=
NULL
;
for
(
int32_t
j
=
0
;
j
<
numOfQueriedCols
;
++
j
)
{
SStddevInterResult
*
pColRes
=
taosArrayGet
(
pInterResult
->
pResult
,
j
);
if
(
pColRes
->
colId
==
id
)
{
p
=
pColRes
->
pResult
;
break
;
}
}
//append a new column
if
(
p
==
NULL
)
{
SStddevInterResult
t
=
{.
colId
=
id
,
.
pResult
=
taosArrayInit
(
10
,
sizeof
(
SResPair
)),};
taosArrayPush
(
pInterResult
->
pResult
,
&
t
);
p
=
t
.
pResult
;
}
SResPair
pair
=
{.
avg
=
v
,
.
key
=
key
};
taosArrayPush
(
p
,
&
pair
);
}
}
void
tscFirstRoundRetrieveCallback
(
void
*
param
,
TAOS_RES
*
tres
,
int
numOfRows
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
tres
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
SFirstRoundQuerySup
*
pSup
=
param
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
if
(
numOfRows
>
0
)
{
TAOS_ROW
row
=
NULL
;
int32_t
numOfCols
=
taos_field_count
(
tres
);
if
(
pSup
->
tagLen
==
0
)
{
// no tags, all rows belong to one group
SInterResult
interResult
=
{.
tags
=
NULL
,
.
pResult
=
taosArrayInit
(
4
,
sizeof
(
SStddevInterResult
))};
taosArrayPush
(
pSup
->
pResult
,
&
interResult
);
while
((
row
=
taos_fetch_row
(
tres
))
!=
NULL
)
{
doAppendData
(
&
interResult
,
row
,
numOfCols
,
pQueryInfo
);
}
}
else
{
// tagLen > 0
char
*
p
=
calloc
(
1
,
pSup
->
tagLen
);
while
((
row
=
taos_fetch_row
(
tres
))
!=
NULL
)
{
int32_t
*
length
=
taos_fetch_lengths
(
tres
);
memset
(
p
,
0
,
pSup
->
tagLen
);
int32_t
offset
=
0
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
&&
offset
<
pSup
->
tagLen
;
++
i
)
{
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
pQueryInfo
,
i
);
if
(
TSDB_COL_IS_TAG
(
pExpr
->
colInfo
.
flag
))
{
memcpy
(
p
+
offset
,
row
[
i
],
length
[
i
]);
offset
+=
pExpr
->
resBytes
;
}
}
assert
(
offset
==
pSup
->
tagLen
);
size_t
size
=
taosArrayGetSize
(
pSup
->
pResult
);
if
(
size
>
0
)
{
SInterResult
*
pInterResult
=
taosArrayGetLast
(
pSup
->
pResult
);
if
(
memcmp
(
pInterResult
->
tags
,
p
,
pSup
->
tagLen
)
==
0
)
{
// belongs to the same group
doAppendData
(
pInterResult
,
row
,
numOfCols
,
pQueryInfo
);
}
else
{
char
*
tags
=
malloc
(
pSup
->
tagLen
);
memcpy
(
tags
,
p
,
pSup
->
tagLen
);
SInterResult
interResult
=
{.
tags
=
tags
,
.
pResult
=
taosArrayInit
(
4
,
sizeof
(
SStddevInterResult
))};
taosArrayPush
(
pSup
->
pResult
,
&
interResult
);
doAppendData
(
&
interResult
,
row
,
numOfCols
,
pQueryInfo
);
}
}
else
{
char
*
tags
=
malloc
(
pSup
->
tagLen
);
memcpy
(
tags
,
p
,
pSup
->
tagLen
);
SInterResult
interResult
=
{.
tags
=
tags
,
.
pResult
=
taosArrayInit
(
4
,
sizeof
(
SStddevInterResult
))};
taosArrayPush
(
pSup
->
pResult
,
&
interResult
);
doAppendData
(
&
interResult
,
row
,
numOfCols
,
pQueryInfo
);
}
}
tfree
(
p
);
}
}
pSup
->
numOfRows
+=
numOfRows
;
if
(
!
pRes
->
completed
)
{
taos_fetch_rows_a
(
tres
,
tscFirstRoundRetrieveCallback
,
param
);
return
;
}
// set the parameters for the second round query process
SSqlObj
*
pParent
=
pSup
->
pParent
;
SSqlCmd
*
pPCmd
=
&
pParent
->
cmd
;
SQueryInfo
*
pQueryInfo1
=
tscGetQueryInfoDetail
(
pPCmd
,
0
);
if
(
pSup
->
numOfRows
>
0
)
{
SBufferWriter
bw
=
tbufInitWriter
(
NULL
,
false
);
interResToBinary
(
&
bw
,
pSup
->
pResult
,
pSup
->
tagLen
);
pQueryInfo1
->
bufLen
=
tbufTell
(
&
bw
);
pQueryInfo1
->
buf
=
tbufGetData
(
&
bw
,
true
);
// set the serialized binary string as the parameter of arithmetic expression
tbufCloseWriter
(
&
bw
);
}
taosArrayDestroyEx
(
pSup
->
pResult
,
freeInterResult
);
taosArrayDestroy
(
pSup
->
pColsInfo
);
tfree
(
pSup
);
taos_free_result
(
pSql
);
pQueryInfo1
->
round
=
1
;
tscDoQuery
(
pParent
);
}
void
tscFirstRoundCallback
(
void
*
param
,
TAOS_RES
*
tres
,
int
code
)
{
int32_t
c
=
taos_errno
(
tres
);
if
(
c
!=
TSDB_CODE_SUCCESS
)
{
// TODO HANDLE ERROR
}
taos_fetch_rows_a
(
tres
,
tscFirstRoundRetrieveCallback
,
param
);
}
int32_t
tscHandleFirstRoundStableQuery
(
SSqlObj
*
pSql
)
{
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
STableMetaInfo
*
pTableMetaInfo1
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
0
,
0
);
SFirstRoundQuerySup
*
pSup
=
calloc
(
1
,
sizeof
(
SFirstRoundQuerySup
));
pSup
->
pParent
=
pSql
;
pSup
->
interval
=
pQueryInfo
->
interval
.
interval
;
pSup
->
pResult
=
taosArrayInit
(
6
,
sizeof
(
SStddevInterResult
));
pSup
->
pColsInfo
=
taosArrayInit
(
6
,
sizeof
(
int16_t
));
// result column id
SSqlObj
*
pNew
=
createSubqueryObj
(
pSql
,
0
,
tscFirstRoundCallback
,
pSup
,
TSDB_SQL_SELECT
,
NULL
);
SSqlCmd
*
pCmd
=
&
pNew
->
cmd
;
tscClearSubqueryInfo
(
pCmd
);
tscFreeSqlResult
(
pSql
);
SQueryInfo
*
pNewQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
assert
(
pQueryInfo
->
numOfTables
==
1
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pNewQueryInfo
,
0
);
tscInitQueryInfo
(
pNewQueryInfo
);
pNewQueryInfo
->
groupbyExpr
=
pQueryInfo
->
groupbyExpr
;
if
(
pQueryInfo
->
groupbyExpr
.
columnInfo
!=
NULL
)
{
pNewQueryInfo
->
groupbyExpr
.
columnInfo
=
taosArrayDup
(
pQueryInfo
->
groupbyExpr
.
columnInfo
);
if
(
pNewQueryInfo
->
groupbyExpr
.
columnInfo
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
// goto _error;
}
}
if
(
tscTagCondCopy
(
&
pNewQueryInfo
->
tagCond
,
&
pQueryInfo
->
tagCond
)
!=
0
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
// goto _error;
}
pNewQueryInfo
->
interval
=
pQueryInfo
->
interval
;
pCmd
->
command
=
TSDB_SQL_SELECT
;
pNew
->
fp
=
tscFirstRoundCallback
;
int32_t
numOfExprs
=
tscSqlExprNumOfExprs
(
pQueryInfo
);
int32_t
index
=
0
;
int32_t
numOfTags
=
0
;
for
(
int32_t
i
=
0
;
i
<
numOfExprs
;
++
i
)
{
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
pQueryInfo
,
i
);
if
(
pExpr
->
functionId
==
TSDB_FUNC_TS
&&
pQueryInfo
->
interval
.
interval
>
0
)
{
taosArrayPush
(
pSup
->
pColsInfo
,
&
pExpr
->
resColId
);
SColumnIndex
colIndex
=
{.
tableIndex
=
0
,
.
columnIndex
=
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
SSchema
*
schema
=
tscGetColumnSchemaById
(
pTableMetaInfo1
->
pTableMeta
,
pExpr
->
colInfo
.
colId
);
SSqlExpr
*
p
=
tscAddFuncInSelectClause
(
pNewQueryInfo
,
index
++
,
TSDB_FUNC_TS
,
&
colIndex
,
schema
,
TSDB_COL_NORMAL
);
p
->
resColId
=
pExpr
->
resColId
;
// update the result column id
}
else
if
(
pExpr
->
functionId
==
TSDB_FUNC_STDDEV_DST
)
{
taosArrayPush
(
pSup
->
pColsInfo
,
&
pExpr
->
resColId
);
SColumnIndex
colIndex
=
{.
tableIndex
=
0
,
.
columnIndex
=
pExpr
->
colInfo
.
colIndex
};
SSchema
schema
=
{.
type
=
TSDB_DATA_TYPE_DOUBLE
,
.
bytes
=
sizeof
(
double
)};
tstrncpy
(
schema
.
name
,
pExpr
->
aliasName
,
tListLen
(
schema
.
name
));
SSqlExpr
*
p
=
tscAddFuncInSelectClause
(
pNewQueryInfo
,
index
++
,
TSDB_FUNC_AVG
,
&
colIndex
,
&
schema
,
TSDB_COL_NORMAL
);
p
->
resColId
=
pExpr
->
resColId
;
// update the result column id
}
else
if
(
pExpr
->
functionId
==
TSDB_FUNC_TAG
)
{
pSup
->
tagLen
+=
pExpr
->
resBytes
;
SColumnIndex
colIndex
=
{.
tableIndex
=
0
,
.
columnIndex
=
pExpr
->
colInfo
.
colIndex
};
SSchema
*
schema
=
NULL
;
if
(
pExpr
->
colInfo
.
colId
!=
TSDB_TBNAME_COLUMN_INDEX
)
{
schema
=
tscGetColumnSchemaById
(
pTableMetaInfo1
->
pTableMeta
,
pExpr
->
colInfo
.
colId
);
}
else
{
schema
=
tGetTbnameColumnSchema
();
}
SSqlExpr
*
p
=
tscAddFuncInSelectClause
(
pNewQueryInfo
,
index
++
,
TSDB_FUNC_TAG
,
&
colIndex
,
schema
,
TSDB_COL_TAG
);
p
->
resColId
=
pExpr
->
resColId
;
numOfTags
+=
1
;
}
}
SColumnIndex
columnIndex
=
{.
tableIndex
=
0
,
.
columnIndex
=
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
tscInsertPrimaryTsSourceColumn
(
pNewQueryInfo
,
&
columnIndex
);
tscTansformFuncForSTableQuery
(
pNewQueryInfo
);
tscDebug
(
"%p first round subquery:%p tableIndex:%d, vgroupIndex:%d, numOfVgroups:%d, type:%d, query to retrieve timestamps, "
"numOfExpr:%"
PRIzu
", colList:%d, numOfOutputFields:%d, name:%s"
,
pSql
,
pNew
,
0
,
pTableMetaInfo
->
vgroupIndex
,
pTableMetaInfo
->
vgroupList
->
numOfVgroups
,
pNewQueryInfo
->
type
,
tscSqlExprNumOfExprs
(
pNewQueryInfo
),
index
+
1
,
pNewQueryInfo
->
fieldsInfo
.
numOfOutput
,
tNameGetTableName
(
&
pTableMetaInfo
->
name
));
tscHandleMasterSTableQuery
(
pNew
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
tscHandleMasterSTableQuery
(
SSqlObj
*
pSql
)
{
SSqlRes
*
pRes
=
&
pSql
->
res
;
...
...
@@ -1833,7 +2089,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
return
pRes
->
code
;
}
tExtMemBuffer
**
pMemoryBuf
=
NULL
;
tExtMemBuffer
**
pMemoryBuf
=
NULL
;
tOrderDescriptor
*
pDesc
=
NULL
;
SColumnModel
*
pModel
=
NULL
;
SColumnModel
*
pFinalModel
=
NULL
;
...
...
@@ -1863,10 +2119,8 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
return
ret
;
}
pSql
->
pSubs
=
calloc
(
pState
->
numOfSub
,
POINTER_BYTES
);
tscDebug
(
"%p retrieved query data from %d vnode(s)"
,
pSql
,
pState
->
numOfSub
);
pSql
->
pSubs
=
calloc
(
pState
->
numOfSub
,
POINTER_BYTES
);
if
(
pSql
->
pSubs
==
NULL
)
{
tfree
(
pSql
->
pSubs
);
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
...
...
@@ -2739,7 +2993,7 @@ void tscBuildResFromSubqueries(SSqlObj *pSql) {
return
;
}
tscRestore
SQL
FuncForSTableQuery
(
pQueryInfo
);
tscRestoreFuncForSTableQuery
(
pQueryInfo
);
}
assert
(
pRes
->
row
>=
pRes
->
numOfRows
);
...
...
src/client/src/tscUtil.c
浏览文件 @
4867add6
...
...
@@ -99,11 +99,6 @@ bool tscIsTwoStageSTableQuery(SQueryInfo* pQueryInfo, int32_t tableIndex) {
return
false
;
}
// for select query super table, the super table vgroup list can not be null in any cases.
// if (pQueryInfo->command == TSDB_SQL_SELECT && UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) {
// assert(pTableMetaInfo->vgroupList != NULL);
// }
if
((
pQueryInfo
->
type
&
TSDB_QUERY_TYPE_FREE_RESOURCE
)
==
TSDB_QUERY_TYPE_FREE_RESOURCE
)
{
return
false
;
}
...
...
@@ -1073,7 +1068,7 @@ void tscFieldInfoClear(SFieldInfo* pFieldInfo) {
memset
(
pFieldInfo
,
0
,
sizeof
(
SFieldInfo
));
}
static
SSqlExpr
*
do
Build
SqlExpr
(
SQueryInfo
*
pQueryInfo
,
int16_t
functionId
,
SColumnIndex
*
pColIndex
,
int16_t
type
,
static
SSqlExpr
*
do
Create
SqlExpr
(
SQueryInfo
*
pQueryInfo
,
int16_t
functionId
,
SColumnIndex
*
pColIndex
,
int16_t
type
,
int16_t
size
,
int16_t
resColId
,
int16_t
interSize
,
int32_t
colType
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
pColIndex
->
tableIndex
);
...
...
@@ -1126,14 +1121,14 @@ SSqlExpr* tscSqlExprInsert(SQueryInfo* pQueryInfo, int32_t index, int16_t functi
return
tscSqlExprAppend
(
pQueryInfo
,
functionId
,
pColIndex
,
type
,
size
,
resColId
,
interSize
,
isTagCol
);
}
SSqlExpr
*
pExpr
=
do
Build
SqlExpr
(
pQueryInfo
,
functionId
,
pColIndex
,
type
,
size
,
resColId
,
interSize
,
isTagCol
);
SSqlExpr
*
pExpr
=
do
Create
SqlExpr
(
pQueryInfo
,
functionId
,
pColIndex
,
type
,
size
,
resColId
,
interSize
,
isTagCol
);
taosArrayInsert
(
pQueryInfo
->
exprList
,
index
,
&
pExpr
);
return
pExpr
;
}
SSqlExpr
*
tscSqlExprAppend
(
SQueryInfo
*
pQueryInfo
,
int16_t
functionId
,
SColumnIndex
*
pColIndex
,
int16_t
type
,
int16_t
size
,
int16_t
resColId
,
int16_t
interSize
,
bool
isTagCol
)
{
SSqlExpr
*
pExpr
=
do
Build
SqlExpr
(
pQueryInfo
,
functionId
,
pColIndex
,
type
,
size
,
resColId
,
interSize
,
isTagCol
);
SSqlExpr
*
pExpr
=
do
Create
SqlExpr
(
pQueryInfo
,
functionId
,
pColIndex
,
type
,
size
,
resColId
,
interSize
,
isTagCol
);
taosArrayPush
(
pQueryInfo
->
exprList
,
&
pExpr
);
return
pExpr
;
}
...
...
@@ -1157,6 +1152,22 @@ SSqlExpr* tscSqlExprUpdate(SQueryInfo* pQueryInfo, int32_t index, int16_t functi
return
pExpr
;
}
bool
tscMultiRoundQuery
(
SQueryInfo
*
pQueryInfo
,
int32_t
index
)
{
if
(
!
UTIL_TABLE_IS_SUPER_TABLE
(
pQueryInfo
->
pTableMetaInfo
[
index
]))
{
return
false
;
}
int32_t
numOfExprs
=
tscSqlExprNumOfExprs
(
pQueryInfo
);
for
(
int32_t
i
=
0
;
i
<
numOfExprs
;
++
i
)
{
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
pQueryInfo
,
i
);
if
(
pExpr
->
functionId
==
TSDB_FUNC_STDDEV_DST
)
{
return
true
;
}
}
return
false
;
}
size_t
tscSqlExprNumOfExprs
(
SQueryInfo
*
pQueryInfo
)
{
return
taosArrayGetSize
(
pQueryInfo
->
exprList
);
}
...
...
@@ -1757,6 +1768,7 @@ static void freeQueryInfoImpl(SQueryInfo* pQueryInfo) {
pQueryInfo
->
tsBuf
=
tsBufDestroy
(
pQueryInfo
->
tsBuf
);
tfree
(
pQueryInfo
->
fillVal
);
tfree
(
pQueryInfo
->
buf
);
}
void
tscClearSubqueryInfo
(
SSqlCmd
*
pCmd
)
{
...
...
@@ -2024,7 +2036,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t
pNew
->
signature
=
pNew
;
pNew
->
sqlstr
=
strdup
(
pSql
->
sqlstr
);
SSqlCmd
*
pnCmd
=
&
pNew
->
cmd
;
SSqlCmd
*
pnCmd
=
&
pNew
->
cmd
;
memcpy
(
pnCmd
,
pCmd
,
sizeof
(
SSqlCmd
));
pnCmd
->
command
=
cmd
;
...
...
@@ -2063,7 +2075,18 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t
pNewQueryInfo
->
clauseLimit
=
pQueryInfo
->
clauseLimit
;
pNewQueryInfo
->
numOfTables
=
0
;
pNewQueryInfo
->
pTableMetaInfo
=
NULL
;
pNewQueryInfo
->
bufLen
=
pQueryInfo
->
bufLen
;
pNewQueryInfo
->
buf
=
malloc
(
pQueryInfo
->
bufLen
);
if
(
pNewQueryInfo
->
buf
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
goto
_error
;
}
if
(
pQueryInfo
->
bufLen
>
0
)
{
memcpy
(
pNewQueryInfo
->
buf
,
pQueryInfo
->
buf
,
pQueryInfo
->
bufLen
);
}
pNewQueryInfo
->
groupbyExpr
=
pQueryInfo
->
groupbyExpr
;
if
(
pQueryInfo
->
groupbyExpr
.
columnInfo
!=
NULL
)
{
pNewQueryInfo
->
groupbyExpr
.
columnInfo
=
taosArrayDup
(
pQueryInfo
->
groupbyExpr
.
columnInfo
);
...
...
@@ -2229,6 +2252,9 @@ void tscDoQuery(SSqlObj* pSql) {
}
}
return
;
}
else
if
(
tscMultiRoundQuery
(
pQueryInfo
,
0
)
&&
pQueryInfo
->
round
==
0
)
{
tscHandleFirstRoundStableQuery
(
pSql
);
// todo lock?
return
;
}
else
if
(
tscIsTwoStageSTableQuery
(
pQueryInfo
,
0
))
{
// super table query
tscLockByThread
(
&
pSql
->
squeryLock
);
...
...
src/common/inc/tname.h
浏览文件 @
4867add6
...
...
@@ -36,6 +36,11 @@ typedef struct SColumnInfoData {
void
*
pData
;
// the corresponding block data in memory
}
SColumnInfoData
;
typedef
struct
SResPair
{
TSKEY
key
;
double
avg
;
}
SResPair
;
#define TSDB_DB_NAME_T 1
#define TSDB_TABLE_NAME_T 2
...
...
@@ -58,7 +63,7 @@ size_t tableIdPrefix(const char* name, char* prefix, int32_t len);
void
extractTableNameFromToken
(
SStrToken
*
pToken
,
SStrToken
*
pTable
);
SSchema
tGetTableN
ameColumnSchema
();
//SSchema tGetTbn
ameColumnSchema();
SSchema
tGetBlockDistColumnSchema
();
...
...
@@ -68,7 +73,7 @@ bool tscValidateTableNameLength(size_t len);
SColumnFilterInfo
*
tFilterInfoDup
(
const
SColumnFilterInfo
*
src
,
int32_t
numOfFilters
);
SSchema
tGetTbnameColumnSchema
();
SSchema
*
tGetTbnameColumnSchema
();
/**
* check if the schema is valid or not, including following aspects:
...
...
src/common/src/texpr.c
浏览文件 @
4867add6
...
...
@@ -407,7 +407,7 @@ tExprNode* exprTreeFromTableName(const char* tbnameCond) {
SSchema
*
pSchema
=
exception_calloc
(
1
,
sizeof
(
SSchema
));
left
->
pSchema
=
pSchema
;
*
pSchema
=
tGetTbnameColumnSchema
();
*
pSchema
=
*
tGetTbnameColumnSchema
();
tExprNode
*
right
=
exception_calloc
(
1
,
sizeof
(
tExprNode
));
expr
->
_node
.
pRight
=
right
;
...
...
src/common/src/tname.c
浏览文件 @
4867add6
...
...
@@ -10,6 +10,7 @@
#define VALID_NAME_TYPE(x) ((x) == TSDB_DB_NAME_T || (x) == TSDB_TABLE_NAME_T)
//TODO remove it
void
extractTableName
(
const
char
*
tableId
,
char
*
name
)
{
size_t
s1
=
strcspn
(
tableId
,
&
TS_PATH_DELIMITER
[
0
]);
size_t
s2
=
strcspn
(
&
tableId
[
s1
+
1
],
&
TS_PATH_DELIMITER
[
0
]);
...
...
@@ -24,6 +25,7 @@ char* extractDBName(const char* tableId, char* name) {
return
strncpy
(
name
,
&
tableId
[
offset1
+
1
],
len
);
}
// todo remove it
size_t
tableIdPrefix
(
const
char
*
name
,
char
*
prefix
,
int32_t
len
)
{
tstrncpy
(
prefix
,
name
,
len
);
strcat
(
prefix
,
TS_PATH_DELIMITER
);
...
...
@@ -31,14 +33,6 @@ size_t tableIdPrefix(const char* name, char* prefix, int32_t len) {
return
strlen
(
prefix
);
}
SSchema
tGetTableNameColumnSchema
()
{
SSchema
s
=
{
0
};
s
.
bytes
=
TSDB_TABLE_NAME_LEN
-
1
+
VARSTR_HEADER_SIZE
;
s
.
type
=
TSDB_DATA_TYPE_BINARY
;
s
.
colId
=
TSDB_TBNAME_COLUMN_INDEX
;
tstrncpy
(
s
.
name
,
TSQL_TBNAME_L
,
TSDB_COL_NAME_LEN
);
return
s
;
}
SSchema
tGetBlockDistColumnSchema
()
{
SSchema
s
=
{
0
};
s
.
bytes
=
TSDB_MAX_BINARY_LEN
;;
...
...
@@ -189,15 +183,15 @@ void extractTableNameFromToken(SStrToken* pToken, SStrToken* pTable) {
}
}
SSchema
tGetTbnameColumnSchema
()
{
struct
SSchema
s
=
{
.
colId
=
TSDB_TBNAME_COLUMN_INDEX
,
.
type
=
TSDB_DATA_TYPE_BINARY
,
.
bytes
=
TSDB_TABLE_NAME_LEN
};
static
struct
SSchema
_s
=
{
.
colId
=
TSDB_TBNAME_COLUMN_INDEX
,
.
type
=
TSDB_DATA_TYPE_BINARY
,
.
bytes
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
,
.
name
=
TSQL_TBNAME_L
,
};
strcpy
(
s
.
name
,
TSQL_TBNAME_L
);
return
s
;
SSchema
*
tGetTbnameColumnSchema
()
{
return
&
_
s
;
}
static
bool
doValidateSchema
(
SSchema
*
pSchema
,
int32_t
numOfCols
,
int32_t
maxLen
)
{
...
...
src/common/src/tvariant.c
浏览文件 @
4867add6
...
...
@@ -86,43 +86,53 @@ void tVariantCreateFromBinary(tVariant *pVar, const char *pz, size_t len, uint32
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_TINYINT
:
{
pVar
->
nLen
=
tDataTypes
[
type
].
bytes
;
pVar
->
i64
=
GET_INT8_VAL
(
pz
);
break
;
}
case
TSDB_DATA_TYPE_UTINYINT
:
{
pVar
->
nLen
=
tDataTypes
[
type
].
bytes
;
pVar
->
u64
=
GET_UINT8_VAL
(
pz
);
break
;
}
case
TSDB_DATA_TYPE_SMALLINT
:
{
pVar
->
nLen
=
tDataTypes
[
type
].
bytes
;
pVar
->
i64
=
GET_INT16_VAL
(
pz
);
break
;
}
case
TSDB_DATA_TYPE_USMALLINT
:
{
pVar
->
nLen
=
tDataTypes
[
type
].
bytes
;
pVar
->
u64
=
GET_UINT16_VAL
(
pz
);
break
;
}
case
TSDB_DATA_TYPE_INT
:
{
pVar
->
nLen
=
tDataTypes
[
type
].
bytes
;
pVar
->
i64
=
GET_INT32_VAL
(
pz
);
break
;
}
case
TSDB_DATA_TYPE_UINT
:
{
pVar
->
nLen
=
tDataTypes
[
type
].
bytes
;
pVar
->
u64
=
GET_UINT32_VAL
(
pz
);
break
;
}
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
pVar
->
nLen
=
tDataTypes
[
type
].
bytes
;
pVar
->
i64
=
GET_INT64_VAL
(
pz
);
break
;
}
case
TSDB_DATA_TYPE_UBIGINT
:
{
pVar
->
nLen
=
tDataTypes
[
type
].
bytes
;
pVar
->
u64
=
GET_UINT64_VAL
(
pz
);
break
;
}
case
TSDB_DATA_TYPE_DOUBLE
:
{
pVar
->
nLen
=
tDataTypes
[
type
].
bytes
;
pVar
->
dKey
=
GET_DOUBLE_VAL
(
pz
);
break
;
}
case
TSDB_DATA_TYPE_FLOAT
:
{
pVar
->
nLen
=
tDataTypes
[
type
].
bytes
;
pVar
->
dKey
=
GET_FLOAT_VAL
(
pz
);
break
;
}
...
...
@@ -144,6 +154,7 @@ void tVariantCreateFromBinary(tVariant *pVar, const char *pz, size_t len, uint32
default:
pVar
->
i64
=
GET_INT32_VAL
(
pz
);
pVar
->
nLen
=
tDataTypes
[
TSDB_DATA_TYPE_INT
].
bytes
;
}
pVar
->
nType
=
type
;
...
...
src/inc/taosmsg.h
浏览文件 @
4867add6
...
...
@@ -496,6 +496,7 @@ typedef struct {
int32_t
tsOrder
;
// ts comp block order
int32_t
numOfTags
;
// number of tags columns involved
int32_t
sqlstrLen
;
// sql query string
int32_t
prevResultLen
;
// previous result length
SColumnInfo
colList
[];
}
SQueryTableMsg
;
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
4867add6
...
...
@@ -1461,9 +1461,9 @@ static int32_t mnodeGetShowSuperTableMeta(STableMetaMsg *pMeta, SShowObj *pShow,
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
schema
;
SSchema
tbnameSchema
=
tGetTableN
ameColumnSchema
();
pShow
->
bytes
[
cols
]
=
tbnameSchema
.
bytes
;
pSchema
[
cols
].
type
=
tbnameSchema
.
type
;
SSchema
*
tbnameSchema
=
tGetTbn
ameColumnSchema
();
pShow
->
bytes
[
cols
]
=
tbnameSchema
->
bytes
;
pSchema
[
cols
].
type
=
tbnameSchema
->
type
;
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
@@ -2821,9 +2821,9 @@ static int32_t mnodeGetShowTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, void
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
schema
;
SSchema
s
=
tGetTableN
ameColumnSchema
();
pShow
->
bytes
[
cols
]
=
s
.
bytes
;
pSchema
[
cols
].
type
=
s
.
type
;
SSchema
*
s
=
tGetTbn
ameColumnSchema
();
pShow
->
bytes
[
cols
]
=
s
->
bytes
;
pSchema
[
cols
].
type
=
s
->
type
;
strcpy
(
pSchema
[
cols
].
name
,
"table_name"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
@@ -2840,9 +2840,9 @@ static int32_t mnodeGetShowTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, void
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
SSchema
tbCol
=
tGetTableN
ameColumnSchema
();
pShow
->
bytes
[
cols
]
=
tbCol
.
bytes
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
tbCol
.
type
;
SSchema
*
tbCol
=
tGetTbn
ameColumnSchema
();
pShow
->
bytes
[
cols
]
=
tbCol
->
bytes
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
tbCol
->
type
;
strcpy
(
pSchema
[
cols
].
name
,
"stable_name"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
@@ -3076,9 +3076,9 @@ static int32_t mnodeGetStreamTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, vo
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
schema
;
SSchema
tbnameColSchema
=
tGetTableN
ameColumnSchema
();
pShow
->
bytes
[
cols
]
=
tbnameColSchema
.
bytes
;
pSchema
[
cols
].
type
=
tbnameColSchema
.
type
;
SSchema
*
tbnameColSchema
=
tGetTbn
ameColumnSchema
();
pShow
->
bytes
[
cols
]
=
tbnameColSchema
->
bytes
;
pSchema
[
cols
].
type
=
tbnameColSchema
->
type
;
strcpy
(
pSchema
[
cols
].
name
,
"table_name"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
src/query/inc/qAggMain.h
浏览文件 @
4867add6
...
...
@@ -59,25 +59,27 @@ extern "C" {
#define TSDB_FUNC_FIRST_DST 25
#define TSDB_FUNC_LAST_DST 26
#define TSDB_FUNC_INTERP 27
#define TSDB_FUNC_RATE 28
#define TSDB_FUNC_IRATE 29
#define TSDB_FUNC_SUM_RATE 30
#define TSDB_FUNC_SUM_IRATE 31
#define TSDB_FUNC_AVG_RATE 32
#define TSDB_FUNC_AVG_IRATE 33
#define TSDB_FUNC_TID_TAG 34
#define TSDB_FUNC_HISTOGRAM 35
#define TSDB_FUNC_HLL 36
#define TSDB_FUNC_MODE 37
#define TSDB_FUNC_SAMPLE 38
#define TSDB_FUNC_CEIL 39
#define TSDB_FUNC_FLOOR 40
#define TSDB_FUNC_ROUND 41
#define TSDB_FUNC_MAVG 42
#define TSDB_FUNC_CSUM 43
#define TSDB_FUNC_STDDEV_DST 27
#define TSDB_FUNC_INTERP 28
#define TSDB_FUNC_RATE 29
#define TSDB_FUNC_IRATE 30
#define TSDB_FUNC_SUM_RATE 31
#define TSDB_FUNC_SUM_IRATE 32
#define TSDB_FUNC_AVG_RATE 33
#define TSDB_FUNC_AVG_IRATE 34
#define TSDB_FUNC_TID_TAG 35
#define TSDB_FUNC_HISTOGRAM 36
#define TSDB_FUNC_HLL 37
#define TSDB_FUNC_MODE 38
#define TSDB_FUNC_SAMPLE 39
#define TSDB_FUNC_CEIL 40
#define TSDB_FUNC_FLOOR 41
#define TSDB_FUNC_ROUND 42
#define TSDB_FUNC_MAVG 43
#define TSDB_FUNC_CSUM 44
#define TSDB_FUNCSTATE_SO 0x1u // single output
#define TSDB_FUNCSTATE_MO 0x2u // dynamic number of output, not multinumber of output e.g., TOP/BOTTOM
...
...
@@ -90,15 +92,12 @@ extern "C" {
#define TSDB_BASE_FUNC_SO TSDB_FUNCSTATE_SO | TSDB_FUNCSTATE_STREAM | TSDB_FUNCSTATE_STABLE | TSDB_FUNCSTATE_OF
#define TSDB_BASE_FUNC_MO TSDB_FUNCSTATE_MO | TSDB_FUNCSTATE_STREAM | TSDB_FUNCSTATE_STABLE | TSDB_FUNCSTATE_OF
#define TSDB_FUNCTIONS_NAME_MAX_LENGTH 16
#define TSDB_AVG_FUNCTION_INTER_BUFFER_SIZE 50
#define DATA_SET_FLAG ',' // to denote the output area has data, not null value
#define DATA_SET_FLAG_SIZE sizeof(DATA_SET_FLAG)
#define QUERY_ASC_FORWARD_STEP 1
#define QUERY_DESC_FORWARD_STEP -1
...
...
@@ -167,8 +166,9 @@ typedef struct SExtTagsInfo {
// sql function runtime context
typedef
struct
SQLFunctionCtx
{
int32_t
startOffset
;
int32_t
startOffset
;
// todo remove it
int32_t
size
;
// number of rows
void
*
pInput
;
//
uint32_t
order
;
// asc|desc
int16_t
inputType
;
int16_t
inputBytes
;
...
...
@@ -177,13 +177,12 @@ typedef struct SQLFunctionCtx {
int16_t
outputBytes
;
// size of results, determined by function and input column data type
int32_t
interBufBytes
;
// internal buffer size
bool
hasNull
;
// null value exist in current block
bool
requireNull
;
// require null in some function
bool
requireNull
;
// require null in some function
bool
stableQuery
;
int16_t
functionId
;
// function id
void
*
aInputElemBuf
;
char
*
aOutputBuf
;
// final result output buffer, point to sdata->data
uint8_t
currentStage
;
// record current running step, default: 0
int64_t
nStartQueryTimestamp
;
// timestamp range of current query when function is executed on a specific data block
int16_t
functionId
;
// function id
char
*
pOutput
;
// final result output buffer, point to sdata->data
uint8_t
currentStage
;
// record current running step, default: 0
int64_t
startTs
;
// timestamp range of current query when function is executed on a specific data block
int32_t
numOfParams
;
tVariant
param
[
4
];
// input parameter, e.g., top(k, 20), the number of results for top query is kept in param */
int64_t
*
ptsList
;
// corresponding timestamp array list
...
...
@@ -198,17 +197,16 @@ typedef struct SQLFunctionCtx {
SPoint1
end
;
}
SQLFunctionCtx
;
typedef
struct
SQLAggFuncElem
{
char
aName
[
TSDB_FUNCTIONS_NAME_MAX_LENGTH
];
uint8_t
nAggIdx
;
// index of function in aAggs
typedef
struct
SAggFunctionInfo
{
char
name
[
TSDB_FUNCTIONS_NAME_MAX_LENGTH
];
uint8_t
index
;
// index of function in aAggs
int8_t
stableFuncId
;
// transfer function for super table query
uint16_t
nS
tatus
;
uint16_t
s
tatus
;
bool
(
*
init
)(
SQLFunctionCtx
*
pCtx
);
// setup the execute environment
void
(
*
xFunction
)(
SQLFunctionCtx
*
pCtx
);
// blocks version function
void
(
*
xFunctionF
)(
SQLFunctionCtx
*
pCtx
,
int32_t
position
);
// single-row function version
void
(
*
xFunctionF
)(
SQLFunctionCtx
*
pCtx
,
int32_t
position
);
// single-row function version
, todo merge with blockwise function
// some sql function require scan data twice or more, e.g.,stddev, percentile
void
(
*
xNextStep
)(
SQLFunctionCtx
*
pCtx
);
...
...
@@ -218,7 +216,7 @@ typedef struct SQLAggFuncElem {
void
(
*
mergeFunc
)(
SQLFunctionCtx
*
pCtx
);
int32_t
(
*
dataReqFunc
)(
SQLFunctionCtx
*
pCtx
,
TSKEY
start
,
TSKEY
end
,
int32_t
colId
);
}
S
QLAggFuncElem
;
}
S
AggFunctionInfo
;
#define GET_RES_INFO(ctx) ((ctx)->resultInfo)
...
...
@@ -246,7 +244,7 @@ typedef struct STwaInfo {
}
STwaInfo
;
/* global sql function array */
extern
struct
S
QLAggFuncElem
aAggs
[];
extern
struct
S
AggFunctionInfo
aAggs
[];
extern
int32_t
functionCompatList
[];
// compatible check array list
...
...
src/query/inc/qExecutor.h
浏览文件 @
4867add6
...
...
@@ -143,6 +143,11 @@ typedef struct {
int64_t
ts
;
}
SOrderedPrjQueryInfo
;
typedef
struct
{
char
*
tags
;
SArray
*
pResult
;
// SArray<SStddevInterResult>
}
SInterResult
;
typedef
struct
SQuery
{
int16_t
numOfCols
;
int16_t
numOfTags
;
...
...
@@ -152,9 +157,14 @@ typedef struct SQuery {
int16_t
precision
;
int16_t
numOfOutput
;
int16_t
fillType
;
int16_t
checkResultBuf
;
// check if the buffer is full during scan each block
int16_t
checkResultBuf
;
// check if the buffer is full during scan each block
SLimitVal
limit
;
int32_t
rowSize
;
int32_t
srcRowSize
;
// todo extract struct
int32_t
resultRowSize
;
int32_t
maxSrcColumnSize
;
int32_t
tagLen
;
// tag value length of current query
SSqlGroupbyExpr
*
pGroupbyExpr
;
SExprInfo
*
pExpr1
;
SExprInfo
*
pExpr2
;
...
...
@@ -184,14 +194,13 @@ typedef struct SQueryRuntimeEnv {
uint16_t
scanFlag
;
// denotes reversed scan of data or not
SFillInfo
*
pFillInfo
;
SResultRowInfo
windowResInfo
;
STSBuf
*
pTsBuf
;
STSCursor
cur
;
SQueryCostInfo
summary
;
void
*
pQueryHandle
;
void
*
pSecQueryHandle
;
// another thread for
bool
stableQuery
;
// super table query or not
bool
topBotQuery
;
// TODO used bitwise flag
bool
groupbyColumn
;
// denote if this is a groupby normal column query
bool
groupbyColumn
;
// denote if this is a groupby normal column query
bool
hasTagResults
;
// if there are tag values in final result or not
bool
timeWindowInterpo
;
// if the time window start/end required interpolation
bool
queryWindowIdentical
;
// all query time windows are identical for all tables in one group
...
...
@@ -205,8 +214,12 @@ typedef struct SQueryRuntimeEnv {
int32_t
*
rowCellInfoOffset
;
// offset value for each row result cell info
char
**
prevRow
;
char
**
nextRow
;
SArray
*
prevResult
;
// intermediate result, SArray<SInterResult>
STSBuf
*
pTsBuf
;
// timestamp filter list
STSCursor
cur
;
char
*
tagVal
;
// tag value of current data block
SArithmeticSupport
*
sasArray
;
}
SQueryRuntimeEnv
;
...
...
src/query/inc/qFill.h
浏览文件 @
4867add6
...
...
@@ -68,7 +68,7 @@ typedef struct SPoint {
void
*
val
;
}
SPoint
;
SFillInfo
*
taos
Init
FillInfo
(
int32_t
order
,
TSKEY
skey
,
int32_t
numOfTags
,
int32_t
capacity
,
int32_t
numOfCols
,
SFillInfo
*
taos
Create
FillInfo
(
int32_t
order
,
TSKEY
skey
,
int32_t
numOfTags
,
int32_t
capacity
,
int32_t
numOfCols
,
int64_t
slidingTime
,
int8_t
slidingUnit
,
int8_t
precision
,
int32_t
fillType
,
SFillColInfo
*
pFillCol
,
void
*
handle
);
...
...
@@ -78,7 +78,7 @@ void* taosDestroyFillInfo(SFillInfo *pFillInfo);
void
taosFillSetStartInfo
(
SFillInfo
*
pFillInfo
,
int32_t
numOfRows
,
TSKEY
endKey
);
void
taosFill
CopyInputData
FromFilePage
(
SFillInfo
*
pFillInfo
,
const
tFilePage
**
pInput
);
void
taosFill
SetDataBlock
FromFilePage
(
SFillInfo
*
pFillInfo
,
const
tFilePage
**
pInput
);
void
taosFillCopyInputDataFromOneFilePage
(
SFillInfo
*
pFillInfo
,
const
tFilePage
*
pInput
);
...
...
src/query/inc/qUtil.h
浏览文件 @
4867add6
...
...
@@ -15,6 +15,8 @@
#ifndef TDENGINE_QUERYUTIL_H
#define TDENGINE_QUERYUTIL_H
#include "tbuffer.h"
#define SET_RES_WINDOW_KEY(_k, _ori, _len, _uid) \
do { \
assert(sizeof(_uid) == sizeof(uint64_t)); \
...
...
@@ -74,5 +76,13 @@ int32_t getNumOfUsedResultRows(SResultRowPool* p);
bool
isPointInterpoQuery
(
SQuery
*
pQuery
);
typedef
struct
{
SArray
*
pResult
;
// SArray<SResPair>
int32_t
colId
;
}
SStddevInterResult
;
void
interResToBinary
(
SBufferWriter
*
bw
,
SArray
*
pRes
,
int32_t
tagLen
);
SArray
*
interResFromBinary
(
const
char
*
data
,
int32_t
len
);
void
freeInterResult
(
void
*
param
);
#endif // TDENGINE_QUERYUTIL_H
src/query/src/qAggMain.c
浏览文件 @
4867add6
此差异已折叠。
点击以展开。
src/query/src/qExecutor.c
浏览文件 @
4867add6
此差异已折叠。
点击以展开。
src/query/src/qFill.c
浏览文件 @
4867add6
...
...
@@ -321,7 +321,7 @@ static int32_t taosNumOfRemainRows(SFillInfo* pFillInfo) {
return
pFillInfo
->
numOfRows
-
pFillInfo
->
index
;
}
SFillInfo
*
taos
Init
FillInfo
(
int32_t
order
,
TSKEY
skey
,
int32_t
numOfTags
,
int32_t
capacity
,
int32_t
numOfCols
,
SFillInfo
*
taos
Create
FillInfo
(
int32_t
order
,
TSKEY
skey
,
int32_t
numOfTags
,
int32_t
capacity
,
int32_t
numOfCols
,
int64_t
slidingTime
,
int8_t
slidingUnit
,
int8_t
precision
,
int32_t
fillType
,
SFillColInfo
*
pCol
,
void
*
handle
)
{
if
(
fillType
==
TSDB_FILL_NONE
)
{
...
...
@@ -414,7 +414,7 @@ void taosFillSetStartInfo(SFillInfo* pFillInfo, int32_t numOfRows, TSKEY endKey)
}
// copy the data into source data buffer
void
taosFill
CopyInputData
FromFilePage
(
SFillInfo
*
pFillInfo
,
const
tFilePage
**
pInput
)
{
void
taosFill
SetDataBlock
FromFilePage
(
SFillInfo
*
pFillInfo
,
const
tFilePage
**
pInput
)
{
for
(
int32_t
i
=
0
;
i
<
pFillInfo
->
numOfCols
;
++
i
)
{
memcpy
(
pFillInfo
->
pData
[
i
],
pInput
[
i
]
->
data
,
pFillInfo
->
numOfRows
*
pFillInfo
->
pFillCol
[
i
].
col
.
bytes
);
}
...
...
src/query/src/qUtil.c
浏览文件 @
4867add6
...
...
@@ -19,6 +19,7 @@
#include "qExecutor.h"
#include "qUtil.h"
#include "tbuffer.h"
int32_t
getOutputInterResultBufSize
(
SQuery
*
pQuery
)
{
int32_t
size
=
0
;
...
...
@@ -228,4 +229,97 @@ void* destroyResultRowPool(SResultRowPool* p) {
tfree
(
p
);
return
NULL
;
}
void
interResToBinary
(
SBufferWriter
*
bw
,
SArray
*
pRes
,
int32_t
tagLen
)
{
uint32_t
numOfGroup
=
taosArrayGetSize
(
pRes
);
tbufWriteUint32
(
bw
,
numOfGroup
);
tbufWriteUint16
(
bw
,
tagLen
);
for
(
int32_t
i
=
0
;
i
<
numOfGroup
;
++
i
)
{
SInterResult
*
pOne
=
taosArrayGet
(
pRes
,
i
);
if
(
tagLen
>
0
)
{
tbufWriteBinary
(
bw
,
pOne
->
tags
,
tagLen
);
}
uint32_t
numOfCols
=
taosArrayGetSize
(
pOne
->
pResult
);
tbufWriteUint32
(
bw
,
numOfCols
);
for
(
int32_t
j
=
0
;
j
<
numOfCols
;
++
j
)
{
SStddevInterResult
*
p
=
taosArrayGet
(
pOne
->
pResult
,
j
);
uint32_t
numOfRows
=
taosArrayGetSize
(
p
->
pResult
);
tbufWriteUint16
(
bw
,
p
->
colId
);
tbufWriteUint32
(
bw
,
numOfRows
);
for
(
int32_t
k
=
0
;
k
<
numOfRows
;
++
k
)
{
SResPair
v
=
*
(
SResPair
*
)
taosArrayGet
(
p
->
pResult
,
k
);
tbufWriteDouble
(
bw
,
v
.
avg
);
tbufWriteInt64
(
bw
,
v
.
key
);
}
}
}
}
SArray
*
interResFromBinary
(
const
char
*
data
,
int32_t
len
)
{
SBufferReader
br
=
tbufInitReader
(
data
,
len
,
false
);
uint32_t
numOfGroup
=
tbufReadUint32
(
&
br
);
uint16_t
tagLen
=
tbufReadUint16
(
&
br
);
char
*
tag
=
NULL
;
if
(
tagLen
>
0
)
{
tag
=
calloc
(
1
,
tagLen
);
}
SArray
*
pResult
=
taosArrayInit
(
4
,
sizeof
(
SInterResult
));
for
(
int32_t
i
=
0
;
i
<
numOfGroup
;
++
i
)
{
if
(
tagLen
>
0
)
{
memset
(
tag
,
0
,
tagLen
);
tbufReadToBinary
(
&
br
,
tag
,
tagLen
);
}
uint32_t
numOfCols
=
tbufReadUint32
(
&
br
);
SArray
*
p
=
taosArrayInit
(
numOfCols
,
sizeof
(
SStddevInterResult
));
for
(
int32_t
j
=
0
;
j
<
numOfCols
;
++
j
)
{
int16_t
colId
=
tbufReadUint16
(
&
br
);
int32_t
numOfRows
=
tbufReadUint32
(
&
br
);
SStddevInterResult
interRes
=
{.
colId
=
colId
,
.
pResult
=
taosArrayInit
(
4
,
sizeof
(
struct
SResPair
)),};
for
(
int32_t
k
=
0
;
k
<
numOfRows
;
++
k
)
{
SResPair
px
=
{
0
};
px
.
avg
=
tbufReadDouble
(
&
br
);
px
.
key
=
tbufReadInt64
(
&
br
);
taosArrayPush
(
interRes
.
pResult
,
&
px
);
}
taosArrayPush
(
p
,
&
interRes
);
}
char
*
p1
=
NULL
;
if
(
tagLen
>
0
)
{
p1
=
malloc
(
tagLen
);
memcpy
(
p1
,
tag
,
tagLen
);
}
SInterResult
d
=
{.
pResult
=
p
,
.
tags
=
p1
,};
taosArrayPush
(
pResult
,
&
d
);
}
tfree
(
tag
);
return
pResult
;
}
void
freeInterResult
(
void
*
param
)
{
SInterResult
*
pResult
=
(
SInterResult
*
)
param
;
tfree
(
pResult
->
tags
);
int32_t
numOfCols
=
taosArrayGetSize
(
pResult
->
pResult
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SStddevInterResult
*
p
=
taosArrayGet
(
pResult
->
pResult
,
i
);
taosArrayDestroy
(
p
->
pResult
);
}
taosArrayDestroy
(
pResult
->
pResult
);
}
\ No newline at end of file
src/tsdb/src/tsdbRead.c
浏览文件 @
4867add6
...
...
@@ -2624,7 +2624,7 @@ static int32_t tableGroupComparFn(const void *p1, const void *p2, const void *pa
f1
=
(
char
*
)
TABLE_NAME
(
pTable1
);
f2
=
(
char
*
)
TABLE_NAME
(
pTable2
);
type
=
TSDB_DATA_TYPE_BINARY
;
bytes
=
tGetT
ableNameColumnSchema
().
bytes
;
bytes
=
tGetT
bnameColumnSchema
()
->
bytes
;
}
else
{
STColumn
*
pCol
=
schemaColAt
(
pTableGroupSupp
->
pTagSchema
,
colIndex
);
bytes
=
pCol
->
bytes
;
...
...
src/util/inc/tarray.h
浏览文件 @
4867add6
...
...
@@ -136,7 +136,7 @@ void taosArrayDestroyEx(SArray* pArray, void (*fp)(void*));
* @param pArray
* @param compar
*/
void
taosArraySort
(
SArray
*
pArray
,
int
(
*
compar
)(
const
void
*
,
const
void
*
)
);
void
taosArraySort
(
SArray
*
pArray
,
__compar_fn_t
comparFn
);
/**
* sort string array
...
...
src/util/src/tarray.c
浏览文件 @
4867add6
...
...
@@ -210,7 +210,7 @@ void taosArrayDestroyEx(SArray* pArray, void (*fp)(void*)) {
taosArrayDestroy
(
pArray
);
}
void
taosArraySort
(
SArray
*
pArray
,
int
(
*
compar
)(
const
void
*
,
const
void
*
)
)
{
void
taosArraySort
(
SArray
*
pArray
,
__compar_fn_t
compar
)
{
assert
(
pArray
!=
NULL
);
assert
(
compar
!=
NULL
);
...
...
tests/script/general/parser/function.sim
浏览文件 @
4867add6
...
...
@@ -407,4 +407,359 @@ sql insert into tm13 values('2020-1-1 1:1:1', 0);
sql select count(*) from m1 where ts='2020-1-1 1:1:1' interval(1h) group by tbname;
if $rows != 2 then
return -1
endi
\ No newline at end of file
endi
sql drop table m1;
sql drop table if exists tm1;
sql drop table if exists tm2;
sql create table m1(ts timestamp, k double, b double, c int, d smallint, e int unsigned) tags(a int);
sql create table tm1 using m1 tags(1);
sql create table tm2 using m1 tags(2);
sql insert into tm1 values('2021-01-27 22:22:39.294', 1, 10, NULL, 110, 123) ('2021-01-27 22:22:40.294', 2, 20, NULL, 120, 124) ('2021-01-27 22:22:41.294', 3, 30, NULL, 130, 125)('2021-01-27 22:22:43.294', 4, 40, NULL, 140, 126)('2021-01-27 22:22:44.294', 5, 50, NULL, 150, 127);
sql insert into tm2 values('2021-01-27 22:22:40.688', 5, 101, NULL, 210, 321) ('2021-01-27 22:22:41.688', 5, 102, NULL, 220, 322) ('2021-01-27 22:22:42.688', 5, 103, NULL, 230, 323)('2021-01-27 22:22:43.688', 5, 104, NULL, 240, 324)('2021-01-27 22:22:44.688', 5, 105, NULL, 250, 325)('2021-01-27 22:22:45.688', 5, 106, NULL, 260, 326);
sql select stddev(k) from m1
if $rows != 1 then
return -1
endi
if $data00 != 1.378704626 then
return -1
endi
sql select stddev(c) from m1
if $rows != 0 then
return -1
endi
sql select stddev(k), stddev(c) from m1
if $rows != 1 then
return -1
endi
if $data00 != 1.378704626 then
return -1
endi
if $data01 != NULL then
return -1;
endi
sql select stddev(b),stddev(b),stddev(k) from m1;
if $rows != 1 then
return -1
endi
if $data00 != 37.840465463 then
return -1
endi
if $data01 != 37.840465463 then
return -1
endi
if $data02 != 1.378704626 then
return -1
endi
sql select stddev(k), stddev(b) from m1 group by a
if $rows != 2 then
return -1
endi
if $data00 != 1.414213562 then
return -1
endi
if $data01 != 14.142135624 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data10 != 0.000000000 then
return -1
endi
if $data11 != 1.707825128 then
return -1
endi
if $data12 != 2 then
return -1
endi
sql select stddev(k), stddev(b) from m1 where a= 1 group by a
if $rows != 1 then
return -1
endi
if $data00 != 1.414213562 then
return -1
endi
if $data01 != 14.142135624 then
return -1
endi
if $data02 != 1 then
return -1
endi
sql select stddev(k), stddev(b) from m1 group by tbname
if $rows != 2 then
return -1
endi
if $data00 != 1.414213562 then
return -1
endi
if $data01 != 14.142135624 then
return -1
endi
if $data02 != @tm1@ then
return -1
endi
if $data10 != 0.000000000 then
return -1
endi
if $data11 != 1.707825128 then
return -1
endi
if $data12 != @tm2@ then
return -1
endi
sql select stddev(k), stddev(b) from m1 group by tbname,a
if $rows != 2 then
return -1
endi
sql select stddev(k), stddev(b), stddev(c) from m1 group by tbname,a
if $rows != 2 then
return -1
endi
if $data00 != 1.414213562 then
return -1
endi
if $data01 != 14.142135624 then
return -1
endi
if $data02 != NULL then
return -1
endi
if $data03 != @tm1@ then
return -1
endi
if $data04 != 1 then
return -1
endi
if $data10 != 0.000000000 then
return -1
endi
if $data11 != 1.707825128 then
return -1
endi
if $data12 != NULL then
return -1
endi
if $data13 != @tm2@ then
return -1
endi
if $data14 != 2 then
return -1
endi
sql select stddev(k), stddev(b), stddev(c) from m1 interval(10s) group by tbname,a
if $rows != 3 then
return -1
endi
if $data01 != 0.000000000 then
return -1
endi
if $data02 != 0.000000000 then
return -1
endi
if $data03 != NULL then
return -1
endi
if $data04 != @tm1@ then
return -1
endi
if $data05 != 1 then
return -1
endi
if $data11 != 1.118033989 then
return -1
endi
if $data12 != 11.180339887 then
return -1
endi
if $data13 != NULL then
return -1
endi
if $data14 != @tm1@ then
return -1
endi
if $data22 != 1.707825128 then
return -1
endi
if $data23 != NULL then
return -1
endi
if $data24 != @tm2@ then
return -1
endi
if $data25 != 2 then
return -1
endi
sql select count(*), first(b), stddev(b), stddev(c) from m1 interval(10s) group by a
if $rows != 3 then
return -1
endi
if $data00 != @21-01-27 22:22:30.000@ then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 10.000000000 then
return -1
endi
if $data03 != 0.000000000 then
return -1
endi
if $data04 != NULL then
return -1
endi
if $data05 != 1 then
return -1
endi
if $data12 != 20.000000000 then
return -1
endi
if $data13 != 11.180339887 then
return -1
endi
if $data14 != NULL then
return -1
endi
if $data23 != 1.707825128 then
return -1
endi
sql select count(*), first(b), stddev(b), stddev(c) from m1 interval(10s) group by tbname,a
if $rows != 3 then
return -1
endi
if $data23 != 1.707825128 then
return -1
endi
if $data25 != @tm2@ then
return -1
endi
sql select count(*), stddev(b), stddev(b)+20, stddev(c) from m1 interval(10s) group by tbname,a
if $rows != 3 then
return -1
endi
if $data02 != 0.000000000 then
return -1
endi
if $data03 != 20.000000000 then
return -1
endi
if $data13 != 31.180339887 then
return -1
endi
if $data14 != NULL then
return -1
endi
sql select count(*), first(b), stddev(b)+first(b), stddev(c) from m1 interval(10s) group by tbname,a
if $rows != 3 then
return -1
endi
if $data02 != 10.000000000 then
return -1
endi
if $data03 != 10.000000000 then
return -1
endi
if $data12 != 20.000000000 then
return -1
endi
if $data13 != 31.180339887 then
return -1
endi
if $data22 != 101.000000000 then
return -1
endi
if $data23 != 102.707825128 then
return -1
endi
sql select stddev(e),stddev(k) from m1 where a=1
if $rows != 1 then
return -1
endi
if $data00 != 1.414213562 then
return -1
endi
if $data01 != 1.414213562 then
return -1
endi
tests/script/general/parser/testSuite.sim
浏览文件 @
4867add6
run general/parser/alter.sim
sleep 100
run general/parser/alter1.sim
sleep 100
run general/parser/alter_stable.sim
sleep 100
run general/parser/auto_create_tb.sim
sleep 100
run general/parser/auto_create_tb_drop_tb.sim
sleep 100
run general/parser/col_arithmetic_operation.sim
sleep 100
run general/parser/columnValue.sim
sleep 100
run general/parser/commit.sim
sleep 100
run general/parser/create_db.sim
sleep 100
run general/parser/create_mt.sim
sleep 100
run general/parser/create_tb.sim
sleep 100
run general/parser/dbtbnameValidate.sim
sleep 100
run general/parser/fill.sim
sleep 100
run general/parser/fill_stb.sim
sleep 100
#run general/parser/fill_us.sim #
sleep 100
run general/parser/first_last.sim
sleep 100
run general/parser/import_commit1.sim
sleep 100
run general/parser/import_commit2.sim
sleep 100
run general/parser/import_commit3.sim
sleep 100
#run general/parser/import_file.sim
sleep 100
run general/parser/insert_tb.sim
sleep 100
run general/parser/tags_dynamically_specifiy.sim
sleep 100
run general/parser/interp.sim
sleep 100
run general/parser/lastrow.sim
sleep 100
run general/parser/limit.sim
sleep 100
run general/parser/limit1.sim
sleep 100
run general/parser/limit1_tblocks100.sim
sleep 100
run general/parser/limit2.sim
sleep 100
run general/parser/mixed_blocks.sim
sleep 100
run general/parser/nchar.sim
sleep 100
run general/parser/null_char.sim
sleep 100
run general/parser/selectResNum.sim
sleep 100
run general/parser/select_across_vnodes.sim
sleep 100
run general/parser/select_from_cache_disk.sim
sleep 100
run general/parser/set_tag_vals.sim
sleep 100
run general/parser/single_row_in_tb.sim
sleep 100
run general/parser/slimit.sim
sleep 100
run general/parser/slimit1.sim
sleep 100
run general/parser/slimit_alter_tags.sim
sleep 100
run general/parser/tbnameIn.sim
sleep 100
run general/parser/slimit_alter_tags.sim # persistent failed
#
run general/parser/alter.sim
#
sleep 100
#
run general/parser/alter1.sim
#
sleep 100
#
run general/parser/alter_stable.sim
#
sleep 100
#
run general/parser/auto_create_tb.sim
#
sleep 100
#
run general/parser/auto_create_tb_drop_tb.sim
#
sleep 100
#
run general/parser/col_arithmetic_operation.sim
#
sleep 100
#
run general/parser/columnValue.sim
#
sleep 100
#
run general/parser/commit.sim
#
sleep 100
#
run general/parser/create_db.sim
#
sleep 100
#
run general/parser/create_mt.sim
#
sleep 100
#
run general/parser/create_tb.sim
#
sleep 100
#
run general/parser/dbtbnameValidate.sim
#
sleep 100
#
run general/parser/fill.sim
#
sleep 100
#
run general/parser/fill_stb.sim
#
sleep 100
#
#
run general/parser/fill_us.sim #
#
sleep 100
#
run general/parser/first_last.sim
#
sleep 100
#
run general/parser/import_commit1.sim
#
sleep 100
#
run general/parser/import_commit2.sim
#
sleep 100
#
run general/parser/import_commit3.sim
#
sleep 100
#
#
run general/parser/import_file.sim
#
sleep 100
#
run general/parser/insert_tb.sim
#
sleep 100
#
run general/parser/tags_dynamically_specifiy.sim
#
sleep 100
#
run general/parser/interp.sim
#
sleep 100
#
run general/parser/lastrow.sim
#
sleep 100
#
run general/parser/limit.sim
#
sleep 100
#
run general/parser/limit1.sim
#
sleep 100
#
run general/parser/limit1_tblocks100.sim
#
sleep 100
#
run general/parser/limit2.sim
#
sleep 100
#
run general/parser/mixed_blocks.sim
#
sleep 100
#
run general/parser/nchar.sim
#
sleep 100
#
run general/parser/null_char.sim
#
sleep 100
#
run general/parser/selectResNum.sim
#
sleep 100
#
run general/parser/select_across_vnodes.sim
#
sleep 100
#
run general/parser/select_from_cache_disk.sim
#
sleep 100
#
run general/parser/set_tag_vals.sim
#
sleep 100
#
run general/parser/single_row_in_tb.sim
#
sleep 100
#
run general/parser/slimit.sim
#
sleep 100
#
run general/parser/slimit1.sim
#
sleep 100
#
run general/parser/slimit_alter_tags.sim
#
sleep 100
#
run general/parser/tbnameIn.sim
#
sleep 100
#
run general/parser/slimit_alter_tags.sim # persistent failed
sleep 100
run general/parser/join.sim
sleep 100
...
...
@@ -106,4 +106,4 @@ run general/parser/sliding.sim
sleep 100
run general/parser/function.sim
sleep 100
run general/parse/stableOp.sim
run general/parse
r
/stableOp.sim
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录