Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
d8aa6d93
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
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看板
提交
d8aa6d93
编写于
4月 05, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-98] suppress compiler warnings and fix some typo
上级
93bd1471
变更
16
显示空白变更内容
内联
并排
Showing
16 changed file
with
75 addition
and
245 deletion
+75
-245
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+1
-0
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+3
-3
src/client/src/tscSchemaUtil.c
src/client/src/tscSchemaUtil.c
+1
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+11
-9
src/client/src/tscSql.c
src/client/src/tscSql.c
+3
-3
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+9
-9
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+0
-14
src/common/inc/name.h
src/common/inc/name.h
+1
-1
src/common/src/name.c
src/common/src/name.c
+2
-2
src/mnode/src/mgmtTable.c
src/mnode/src/mgmtTable.c
+1
-2
src/query/inc/queryUtil.h
src/query/inc/queryUtil.h
+2
-0
src/query/src/qparserImpl.c
src/query/src/qparserImpl.c
+0
-170
src/query/src/queryExecutor.c
src/query/src/queryExecutor.c
+25
-24
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+4
-0
src/util/src/tutil.c
src/util/src/tutil.c
+1
-1
src/vnode/tsdb/src/tsdbRead.c
src/vnode/tsdb/src/tsdbRead.c
+11
-6
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
d8aa6d93
...
...
@@ -134,6 +134,7 @@ void tscFieldInfoSetBinExpr(SFieldInfo* pFieldInfo, int32_t index, SSqlFunctionE
void
tscFieldInfoCalOffset
(
SQueryInfo
*
pQueryInfo
);
void
tscFieldInfoCopy
(
SFieldInfo
*
src
,
SFieldInfo
*
dst
,
const
int32_t
*
indexList
,
int32_t
size
);
void
tscFieldInfoCopyAll
(
SFieldInfo
*
dst
,
SFieldInfo
*
src
);
void
tscFieldInfoUpdateOffsetForInterResult
(
SQueryInfo
*
pQueryInfo
);
TAOS_FIELD
*
tscFieldInfoGetField
(
SQueryInfo
*
pQueryInfo
,
int32_t
index
);
int16_t
tscFieldInfoGetOffset
(
SQueryInfo
*
pQueryInfo
,
int32_t
index
);
...
...
src/client/src/tscLocal.c
浏览文件 @
d8aa6d93
...
...
@@ -343,10 +343,10 @@ static int tscBuildMetricTagProjectionResult(SSqlObj *pSql) {
}
static
int
tscBuildMetricTagSqlFunctionResult
(
SSqlObj
*
pSql
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
//
SSqlCmd *pCmd = &pSql->cmd;
//
SSqlRes *pRes = &pSql->res;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
//
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, 0);
#if 0
SSuperTableMeta *pMetricMeta = tscGetMetaInfo(pQueryInfo, 0)->pMetricMeta;
int32_t totalNumOfResults = 1; // count function only produce one result
...
...
src/client/src/tscSchemaUtil.c
浏览文件 @
d8aa6d93
...
...
@@ -131,7 +131,7 @@ bool isValidSchema(struct SSchema* pSchema, int32_t numOfCols) {
SSchema
*
tscGetTableColumnSchema
(
const
STableMeta
*
pTableMeta
,
int32_t
startCol
)
{
assert
(
pTableMeta
!=
NULL
);
SSchema
*
pSchema
=
pTableMeta
->
schema
;
SSchema
*
pSchema
=
(
SSchema
*
)
pTableMeta
->
schema
;
#if 0
if (pTableMeta->tableType == TSDB_CHILD_TABLE) {
assert (pTableMeta->pSTable != NULL);
...
...
src/client/src/tscServer.c
浏览文件 @
d8aa6d93
...
...
@@ -1420,10 +1420,10 @@ int tscProcessDescribeTableRsp(SSqlObj *pSql) {
}
int
tscProcessTagRetrieveRsp
(
SSqlObj
*
pSql
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
//
SSqlCmd *pCmd = &pSql->cmd;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
//
SQueryInfo * pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex);
//
STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
int32_t
numOfRes
=
0
;
#if 0
...
...
@@ -1569,7 +1569,7 @@ int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
return
pCmd
->
payloadLen
;
}
static
int32_t
tscEstimateMetricMetaMsgSize
(
SSqlCmd
*
pCmd
)
{
static
UNUSED_FUNC
int32_t
tscEstimateMetricMetaMsgSize
(
SSqlCmd
*
pCmd
)
{
const
int32_t
defaultSize
=
minMsgSize
()
+
sizeof
(
SSuperTableMetaMsg
)
+
sizeof
(
SMgmtHead
)
+
sizeof
(
int16_t
)
*
TSDB_MAX_TAGS
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
...
...
@@ -1884,10 +1884,10 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
* |...... 1B 1B 4B
**/
int
tscProcessMultiMeterMetaRsp
(
SSqlObj
*
pSql
)
{
uint8_t
ieType
;
int32_t
totalNum
;
int32_t
i
;
//
uint8_t ieType;
//
int32_t totalNum;
//
int32_t i;
#if 0
char *rsp = pSql->res.pRsp;
ieType = *rsp;
...
...
@@ -1985,6 +1985,8 @@ int tscProcessMultiMeterMetaRsp(SSqlObj *pSql) {
pSql->res.code = TSDB_CODE_SUCCESS;
pSql->res.numOfTotal = i;
tscTrace("%p load multi-metermeta resp complete num:%d", pSql, pSql->res.numOfTotal);
#endif
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -2467,7 +2469,7 @@ int tscGetSTableVgroupInfo(SSqlObj *pSql, int32_t clauseIndex) {
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
//the query condition is serialized into pCmd->payload, we need to rebuild key for stable meta info in cache.
bool
required
=
false
;
//
bool required = false;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
clauseIndex
);
if
(
pQueryInfo
->
pTableMetaInfo
[
0
]
->
vgroupIdList
!=
NULL
)
{
...
...
src/client/src/tscSql.c
浏览文件 @
d8aa6d93
...
...
@@ -535,11 +535,11 @@ static bool tscHashRemainDataInSubqueryResultSet(SSqlObj *pSql) {
continue
;
}
SSqlRes
*
pRes1
=
&
pSql
->
pSubs
[
i
]
->
res
;
//
SSqlRes *pRes1 = &pSql->pSubs[i]->res;
SSqlCmd
*
pCmd1
=
&
pSql
->
pSubs
[
i
]
->
cmd
;
SQueryInfo
*
pQueryInfo1
=
tscGetQueryInfoDetail
(
pCmd1
,
pCmd1
->
clauseIndex
);
STableMetaInfo
*
pMetaInfo
=
tscGetMetaInfo
(
pQueryInfo1
,
0
);
//
STableMetaInfo *pMetaInfo = tscGetMetaInfo(pQueryInfo1, 0);
assert
(
pQueryInfo1
->
numOfTables
==
1
);
...
...
@@ -576,7 +576,7 @@ static bool tscHashRemainDataInSubqueryResultSet(SSqlObj *pSql) {
return
hasData
;
}
static
void
**
tscBuildResFromSubqueries
(
SSqlObj
*
pSql
)
{
static
UNUSED_FUNC
void
**
tscBuildResFromSubqueries
(
SSqlObj
*
pSql
)
{
SSqlRes
*
pRes
=
&
pSql
->
res
;
while
(
1
)
{
...
...
src/client/src/tscSubquery.c
浏览文件 @
d8aa6d93
...
...
@@ -279,7 +279,7 @@ int32_t tscLaunchSecondPhaseSubqueries(SSqlObj* pSql) {
assert
(
pSubQueryInfo
->
exprsInfo
.
numOfExprs
==
1
);
// ts_comp query only requires one resutl columns
taos_free_result
(
pPrevSub
);
SSqlObj
*
pNew
=
createSubqueryObj
(
pSql
,
(
int16_t
)
i
,
tscJoinQueryCallback
,
TSDB_SQL_SELECT
,
pSupporter
,
NULL
);
SSqlObj
*
pNew
=
createSubqueryObj
(
pSql
,
(
int16_t
)
i
,
tscJoinQueryCallback
,
pSupporter
,
TSDB_SQL_SELECT
,
NULL
);
if
(
pNew
==
NULL
)
{
tscDestroyJoinSupporter
(
pSupporter
);
success
=
false
;
...
...
@@ -538,7 +538,7 @@ static void joinRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) {
}
if
(
tscNonOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
)
&&
numOfRows
==
0
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
//
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
assert
(
pQueryInfo
->
numOfTables
==
1
);
// for projection query, need to try next vnode if current vnode is exhausted
...
...
@@ -606,7 +606,7 @@ void tscFetchDatablockFromSubquery(SSqlObj* pSql) {
SSqlRes
*
pRes
=
&
pSql
->
pSubs
[
i
]
->
res
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
pSubs
[
i
]
->
cmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
//
STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
if
(
tscNonOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
))
{
// if (pRes->row >= pRes->numOfRows && pTableMetaInfo->vnodeIndex < pTableMetaInfo->pMetricMeta->numOfVnodes &&
...
...
@@ -834,7 +834,7 @@ int32_t tscLaunchJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSubquerySu
}
}
SSqlObj
*
pNew
=
createSubqueryObj
(
pSql
,
tableIndex
,
tscJoinQueryCallback
,
TSDB_SQL_SELECT
,
pSupporter
,
NULL
);
SSqlObj
*
pNew
=
createSubqueryObj
(
pSql
,
tableIndex
,
tscJoinQueryCallback
,
pSupporter
,
TSDB_SQL_SELECT
,
NULL
);
if
(
pNew
==
NULL
)
{
return
TSDB_CODE_CLI_OUT_OF_MEMORY
;
}
...
...
@@ -1237,7 +1237,7 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
// data in from current vnode is stored in cache and disk
uint32_t
numOfRowsFromSubquery
=
trsupport
->
pExtMemBuffer
[
idx
]
->
numOfTotalElems
+
trsupport
->
localBuffer
->
numOfElems
;
//
uint32_t numOfRowsFromSubquery = trsupport->pExtMemBuffer[idx]->numOfTotalElems + trsupport->localBuffer->numOfElems;
// tscTrace("%p sub:%p all data retrieved from ip:%u,vid:%d, numOfRows:%d, orderOfSub:%d", pPObj, pSql, pSvd->ip,
// pSvd->vnode, numOfRowsFromSubquery, idx);
...
...
@@ -1333,7 +1333,7 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR
SSqlRes
*
pRes
=
&
pSql
->
res
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
//
STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
// SVnodeSidList *vnodeInfo = tscGetVnodeSidList(pTableMetaInfo->pMetricMeta, idx);
// SVnodeSidList *vnodeInfo = 0;
...
...
@@ -1409,10 +1409,10 @@ void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) {
SSqlObj
*
pParentSql
=
trsupport
->
pParentSqlObj
;
SSqlObj
*
pSql
=
(
SSqlObj
*
)
tres
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
0
,
0
);
//
STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pSql->cmd, 0, 0);
assert
(
pSql
->
cmd
.
numOfClause
==
1
&&
pSql
->
cmd
.
pQueryInfo
[
0
]
->
numOfTables
==
1
);
int32_t
idx
=
pTableMetaInfo
->
vnodeIndex
;
//
int32_t idx = pTableMetaInfo->vnodeIndex;
SVnodeSidList
*
vnodeInfo
=
NULL
;
SVnodeDesc
*
pSvd
=
NULL
;
...
...
@@ -1459,7 +1459,7 @@ void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) {
pState
->
code
=
-
TSDB_CODE_CLI_OUT_OF_MEMORY
;
trsupport
->
numOfRetry
=
MAX_NUM_OF_SUBQUERY_RETRY
;
}
else
{
SQueryInfo
*
pNewQueryInfo
=
tscGetQueryInfoDetail
(
&
pNew
->
cmd
,
0
);
//
SQueryInfo *pNewQueryInfo = tscGetQueryInfoDetail(&pNew->cmd, 0);
// assert(pNewQueryInfo->pTableMetaInfo[0]->pTableMeta != NULL && pNewQueryInfo->pTableMetaInfo[0]->pMetricMeta != NULL);
tscProcessSql
(
pNew
);
return
;
...
...
src/client/src/tscUtil.c
浏览文件 @
d8aa6d93
...
...
@@ -993,20 +993,6 @@ void tscFieldInfoCalOffset(SQueryInfo* pQueryInfo) {
}
void
tscFieldInfoUpdateOffsetForInterResult
(
SQueryInfo
*
pQueryInfo
)
{
// SFieldInfo* pFieldInfo = &pQueryInfo->fieldsInfo;
// if (pFieldInfo->numOfOutputCols == 0) {
// return;
// }
//
// pFieldInfo->pOffset[0] = 0;
//
// /*
// * the retTypeLen is used to store the intermediate result length
// * for potential secondary merge exists
// */
// for (int32_t i = 1; i < pFieldInfo->numOfOutputCols; ++i) {
// pFieldInfo->pOffset[i] = pFieldInfo->pOffset[i - 1] + tscSqlExprGet(pQueryInfo, i - 1)->resBytes;
// }
SSqlExprInfo
*
pExprInfo
=
&
pQueryInfo
->
exprsInfo
;
if
(
pExprInfo
->
numOfExprs
==
0
)
{
return
;
...
...
src/common/inc/name.h
浏览文件 @
d8aa6d93
...
...
@@ -19,7 +19,7 @@ typedef struct SColumnInfoEx {
void
*
pData
;
// the corresponding block data in memory
}
SColumnInfoEx
;
int32_t
extractTableName
(
const
char
*
tableId
,
char
*
name
);
void
extractTableName
(
const
char
*
tableId
,
char
*
name
);
char
*
extractDBName
(
const
char
*
tableId
,
char
*
name
);
...
...
src/common/src/name.c
浏览文件 @
d8aa6d93
...
...
@@ -24,11 +24,11 @@ static FORCE_INLINE size_t copy(char* dst, const char* src, char delimiter) {
return
len
;
}
int32_t
extractTableName
(
const
char
*
tableId
,
char
*
name
)
{
void
extractTableName
(
const
char
*
tableId
,
char
*
name
)
{
size_t
offset
=
strcspn
(
tableId
,
&
TS_PATH_DELIMITER
[
0
]);
offset
=
strcspn
(
&
tableId
[
offset
],
&
TS_PATH_DELIMITER
[
0
]);
return
strncpy
(
name
,
&
tableId
[
offset
],
TSDB_TABLE_NAME_LEN
);
strncpy
(
name
,
&
tableId
[
offset
],
TSDB_TABLE_NAME_LEN
);
// char* r = skipSegments(tableId, TS_PATH_DELIMITER[0], 2);
// return copy(name, r, TS_PATH_DELIMITER[0]);
...
...
src/mnode/src/mgmtTable.c
浏览文件 @
d8aa6d93
...
...
@@ -2011,9 +2011,8 @@ static int32_t mgmtRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows,
}
char
tableName
[
TSDB_TABLE_NAME_LEN
]
=
{
0
};
memset
(
tableName
,
0
,
tListLen
(
tableName
));
// pattern compare for
meter
name
// pattern compare for
table
name
mgmtExtractTableName
(
pTable
->
info
.
tableId
,
tableName
);
if
(
pShow
->
payloadLen
>
0
&&
...
...
src/query/inc/queryUtil.h
浏览文件 @
d8aa6d93
...
...
@@ -36,4 +36,6 @@ bool isWindowResClosed(SWindowResInfo *pWindowResInfo, int32_t slot);
void
createQueryResultInfo
(
SQuery
*
pQuery
,
SWindowResult
*
pResultRow
,
bool
isSTableQuery
,
SPosInfo
*
posInfo
);
char
*
getPosInResultPage
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
columnIndex
,
SWindowResult
*
pResult
);
#endif // TDENGINE_QUERYUTIL_H
src/query/src/qparserImpl.c
浏览文件 @
d8aa6d93
...
...
@@ -901,173 +901,3 @@ void setDefaultCreateDbOption(SCreateDBInfo *pDBInfo) {
memset
(
&
pDBInfo
->
precision
,
0
,
sizeof
(
SSQLToken
));
}
\ No newline at end of file
static
bool
isExprLeafNode
(
tSQLExpr
*
pExpr
)
{
return
(
pExpr
->
pRight
==
NULL
&&
pExpr
->
pLeft
==
NULL
)
&&
(
pExpr
->
nSQLOptr
==
TK_ID
||
(
pExpr
->
nSQLOptr
>=
TK_BOOL
&&
pExpr
->
nSQLOptr
<=
TK_NCHAR
)
||
pExpr
->
nSQLOptr
==
TK_SET
);
}
static
bool
isExprParentOfLeafNode
(
tSQLExpr
*
pExpr
)
{
return
(
pExpr
->
pLeft
!=
NULL
&&
pExpr
->
pRight
!=
NULL
)
&&
(
isExprLeafNode
(
pExpr
->
pLeft
)
&&
isExprLeafNode
(
pExpr
->
pRight
));
}
static
int32_t
tSQLExprNodeToString
(
tSQLExpr
*
pExpr
,
SStringBuilder
*
pBuilder
)
{
if
(
pExpr
->
nSQLOptr
==
TK_ID
)
{
// column name
// strncpy(*str, pExpr->colInfo.z, pExpr->colInfo.n);
// *str += pExpr->colInfo.n;
}
else
if
(
pExpr
->
nSQLOptr
>=
TK_BOOL
&&
pExpr
->
nSQLOptr
<=
TK_STRING
)
{
// value
// *str += tVariantToString(&pExpr->val, *str);
// taosStringBuilderAppendStringLen()
}
else
if
(
pExpr
->
nSQLOptr
>=
TK_COUNT
&&
pExpr
->
nSQLOptr
<=
TK_AVG_IRATE
)
{
taosStringBuilderAppendStringLen
(
pBuilder
,
pExpr
->
operand
.
z
,
pExpr
->
operand
.
n
);
}
else
{
// not supported operation
assert
(
false
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
optrToString
(
tSQLExpr
*
pExpr
,
char
**
exprString
)
{
const
char
*
le
=
"<="
;
const
char
*
ge
=
">="
;
const
char
*
ne
=
"<>"
;
const
char
*
likeOptr
=
"LIKE"
;
switch
(
pExpr
->
nSQLOptr
)
{
case
TK_LE
:
{
*
(
int16_t
*
)(
*
exprString
)
=
*
(
int16_t
*
)
le
;
*
exprString
+=
1
;
break
;
}
case
TK_GE
:
{
*
(
int16_t
*
)(
*
exprString
)
=
*
(
int16_t
*
)
ge
;
*
exprString
+=
1
;
break
;
}
case
TK_NE
:
{
*
(
int16_t
*
)(
*
exprString
)
=
*
(
int16_t
*
)
ne
;
*
exprString
+=
1
;
break
;
}
case
TK_LT
:
*
(
*
exprString
)
=
'<'
;
break
;
case
TK_GT
:
*
(
*
exprString
)
=
'>'
;
break
;
case
TK_EQ
:
*
(
*
exprString
)
=
'='
;
break
;
case
TK_PLUS
:
*
(
*
exprString
)
=
'+'
;
break
;
case
TK_MINUS
:
*
(
*
exprString
)
=
'-'
;
break
;
case
TK_STAR
:
*
(
*
exprString
)
=
'*'
;
break
;
case
TK_DIVIDE
:
*
(
*
exprString
)
=
'/'
;
break
;
case
TK_REM
:
*
(
*
exprString
)
=
'%'
;
break
;
case
TK_LIKE
:
{
int32_t
len
=
sprintf
(
*
exprString
,
" %s "
,
likeOptr
);
*
exprString
+=
(
len
-
1
);
break
;
}
default:
return
TSDB_CODE_INVALID_SQL
;
}
*
exprString
+=
1
;
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
tSQLExprLeafToBinary
(
tSQLExpr
*
pExpr
,
SStringBuilder
*
pBuilder
)
{
if
(
!
isExprParentOfLeafNode
(
pExpr
))
{
return
TSDB_CODE_INVALID_SQL
;
}
tSQLExpr
*
pLeft
=
pExpr
->
pLeft
;
tSQLExpr
*
pRight
=
pExpr
->
pRight
;
// if (addParentheses) {
// *(*output) = '(';
// *output += 1;
// }
tSQLExprNodeToString
(
pLeft
,
pBuilder
);
tSQLExprNodeToString
(
pRight
,
pBuilder
);
if
(
optrToString
(
pExpr
,
pBuilder
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_INVALID_SQL
;
}
// if (addParentheses) {
// *(*output) = ')';
// *output += 1;
// }
return
TSDB_CODE_SUCCESS
;
}
static
void
relToString
(
tSQLExpr
*
pExpr
,
SStringBuilder
*
pBuilder
)
{
assert
(
pExpr
->
nSQLOptr
==
TK_AND
||
pExpr
->
nSQLOptr
==
TK_OR
);
const
char
*
or
=
"OR"
;
const
char
*
and
=
"AND"
;
// if (pQueryInfo->tagCond.relType == TSQL_STABLE_QTYPE_COND) {
// if (pExpr->nSQLOptr == TK_AND) {
// strcpy(*str, and);
// *str += strlen(and);
// } else {
// strcpy(*str, or);
// *str += strlen(or);
// }
}
static
int32_t
doSQLExprToBinary
(
tSQLExpr
*
pExpr
,
SStringBuilder
*
pBuilder
)
{
if
(
pExpr
==
NULL
)
{
return
TSDB_CODE_SUCCESS
;
}
if
(
!
isExprParentOfLeafNode
(
pExpr
))
{
// *(*str) = '(';
// *str += 1;
int32_t
ret
=
doSQLExprToBinary
(
pExpr
->
pLeft
,
pBuilder
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
}
ret
=
doSQLExprToBinary
(
pExpr
->
pRight
,
pBuilder
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
}
relToString
(
pExpr
,
pBuilder
);
// *(*str) = ')';
// *str += 1;
return
ret
;
}
return
tSQLExprLeafToBinary
(
pExpr
,
pBuilder
);
}
// post order seralize to binary data
int32_t
tSQLExprToBinary
(
tSQLExpr
*
pExpr
,
SStringBuilder
*
pBuilder
)
{
assert
(
pExpr
!=
NULL
&&
pBuilder
!=
NULL
);
}
\ No newline at end of file
src/query/src/queryExecutor.c
浏览文件 @
d8aa6d93
...
...
@@ -47,7 +47,7 @@
#define SET_SUPPLEMENT_SCAN_FLAG(runtime) ((runtime)->scanFlag = SUPPLEMENTARY_SCAN)
#define SET_MASTER_SCAN_FLAG(runtime) ((runtime)->scanFlag = MASTER_SCAN)
#define GET_QINFO_ADDR(x) ((
char *)(x)-offsetof(SQInfo, runtimeEnv
))
#define GET_QINFO_ADDR(x) ((
void*)((char *)(x)-offsetof(SQInfo, runtimeEnv)
))
#define GET_COL_DATA_POS(query, index, step) ((query)->pos + (index) * (step))
...
...
@@ -1140,13 +1140,13 @@ static int32_t rowwiseApplyAllFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStat
bool
hasNull
=
hasNullValue
(
pQuery
,
k
,
pDataBlockInfo
,
pStatis
,
&
pColStatis
);
char
*
dataBlock
=
getDataBlocks
(
pRuntimeEnv
,
&
sasArray
[
k
],
k
,
pDataBlockInfo
->
size
,
pDataBlock
);
setExecParams
(
pQuery
,
&
pCtx
[
k
],
dataBlock
,
(
char
*
)
primaryKeyCol
,
pDataBlockInfo
->
size
,
functionId
,
pColStatis
,
setExecParams
(
pQuery
,
&
pCtx
[
k
],
dataBlock
,
primaryKeyCol
,
pDataBlockInfo
->
size
,
functionId
,
pColStatis
,
hasNull
,
&
sasArray
[
k
],
pRuntimeEnv
->
scanFlag
);
}
// set the input column data
for
(
int32_t
k
=
0
;
k
<
pQuery
->
numOfFilterCols
;
++
k
)
{
SSingleColumnFilterInfo
*
pFilterInfo
=
&
pQuery
->
pFilterInfo
[
k
];
//
SSingleColumnFilterInfo *pFilterInfo = &pQuery->pFilterInfo[k];
assert
(
0
);
/*
* NOTE: here the tbname/tags column cannot reach here, since it will never be a filter column,
...
...
@@ -1465,7 +1465,7 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, SColumnModel
pRuntimeEnv
->
offset
[
0
]
=
0
;
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfOutputCols
;
++
i
)
{
SSqlFuncExprMsg
*
pSqlFuncMsg
=
&
pQuery
->
pSelectExpr
[
i
].
pBase
;
SColIndexEx
*
pColIndexEx
=
&
pSqlFuncMsg
->
colInfo
;
//
SColIndexEx * pColIndexEx = &pSqlFuncMsg->colInfo;
SQLFunctionCtx
*
pCtx
=
&
pRuntimeEnv
->
pCtx
[
i
];
pCtx
->
inputType
=
GET_COLUMN_TYPE
(
pQuery
,
i
);
...
...
@@ -1586,7 +1586,7 @@ static bool isQueryKilled(SQInfo *pQInfo) {
#endif
}
static
bool
setQueryKilled
(
SQInfo
*
pQInfo
)
{
static
void
setQueryKilled
(
SQInfo
*
pQInfo
)
{
pQInfo
->
code
=
TSDB_CODE_QUERY_CANCELLED
;
}
...
...
@@ -1738,6 +1738,7 @@ static UNUSED_FUNC bool doGetQueryPos(TSKEY key, SQInfo *pQInfo, SPointInterpoSu
}
}
#endif
return
true
;
}
static
UNUSED_FUNC
bool
doSetDataInfo
(
SQInfo
*
pQInfo
,
SPointInterpoSupporter
*
pPointInterpSupporter
,
void
*
pMeterObj
,
...
...
@@ -2924,11 +2925,11 @@ int32_t tableResultComparFn(const void *pLeft, const void *pRight, void *param)
}
int32_t
mergeResultsToGroup
(
SQInfo
*
pQInfo
)
{
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
//
SQueryRuntimeEnv *pRuntimeEnv = &pQInfo->runtimeEnv;
//
SQuery * pQuery = pRuntimeEnv->pQuery;
int64_t
st
=
taosGetTimestampMs
();
int32_t
ret
=
TSDB_CODE_SUCCESS
;
//
int64_t st = taosGetTimestampMs();
//
int32_t ret = TSDB_CODE_SUCCESS;
// while (pQInfo->subgroupIdx < pQInfo->pSidSet->numOfSubSet) {
// int32_t start = pQInfo->pSidSet->starterPos[pQInfo->subgroupIdx];
...
...
@@ -2994,7 +2995,7 @@ void copyResToQueryResultBuf(SQInfo *pQInfo, SQuery *pQuery) {
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfOutputCols
;
++
i
)
{
int32_t
bytes
=
pRuntimeEnv
->
pCtx
[
i
].
outputBytes
;
char
*
pDest
=
pQuery
->
sdata
[
i
];
char
*
pDest
=
pQuery
->
sdata
[
i
]
->
data
;
memcpy
(
pDest
+
offset
*
bytes
,
pData
->
data
+
pRuntimeEnv
->
offset
[
i
]
*
pData
->
numOfElems
,
bytes
*
pData
->
numOfElems
);
...
...
@@ -3033,7 +3034,7 @@ int64_t getNumOfResultWindowRes(SQueryRuntimeEnv *pRuntimeEnv, SWindowResult *pW
return
maxOutput
;
}
int32_t
doMergeMetersResultsToGroupRes
(
SQInfo
*
pQInfo
,
STableDataInfo
*
pTableDataInfo
,
int32_t
start
,
int32_t
end
)
{
UNUSED_FUNC
int32_t
doMergeMetersResultsToGroupRes
(
SQInfo
*
pQInfo
,
STableDataInfo
*
pTableDataInfo
,
int32_t
start
,
int32_t
end
)
{
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
...
...
@@ -3204,7 +3205,7 @@ int32_t flushFromResultBuf(SQInfo *pQInfo) {
void
resetMergeResultBuf
(
SQuery
*
pQuery
,
SQLFunctionCtx
*
pCtx
,
SResultInfo
*
pResultInfo
)
{
for
(
int32_t
k
=
0
;
k
<
pQuery
->
numOfOutputCols
;
++
k
)
{
pCtx
[
k
].
aOutputBuf
=
pQuery
->
sdata
[
k
]
-
pCtx
[
k
].
outputBytes
;
pCtx
[
k
].
aOutputBuf
=
pQuery
->
sdata
[
k
]
->
data
-
pCtx
[
k
].
outputBytes
;
pCtx
[
k
].
size
=
1
;
pCtx
[
k
].
startOffset
=
0
;
pCtx
[
k
].
resultInfo
=
&
pResultInfo
[
k
];
...
...
@@ -3561,7 +3562,7 @@ void scanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv) {
}
// set the correct start position, and load the corresponding block in buffer for next round scan all data blocks.
int32_t
ret
=
tsdbDataBlockSeek
(
pRuntimeEnv
->
pQueryHandle
,
pos
);
/*int32_t ret =*/
tsdbDataBlockSeek
(
pRuntimeEnv
->
pQueryHandle
,
pos
);
status
=
pQuery
->
status
;
pRuntimeEnv
->
windowResInfo
.
curIndex
=
activeSlot
;
...
...
@@ -3582,7 +3583,7 @@ void scanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv) {
pQuery
->
window
.
skey
=
skey
;
pQuery
->
window
.
ekey
=
pQuery
->
lastKey
-
step
;
tsdbpos_t
current
=
tsdbDataBlockTell
(
pRuntimeEnv
->
pQueryHandle
);
/*tsdbpos_t current =*/
tsdbDataBlockTell
(
pRuntimeEnv
->
pQueryHandle
);
doSingleMeterSupplementScan
(
pRuntimeEnv
);
...
...
@@ -3591,7 +3592,7 @@ void scanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv) {
pQuery
->
lastKey
=
lkey
;
pQuery
->
window
.
ekey
=
ekey
;
STimeWindow
win
=
{.
skey
=
pQuery
->
window
.
skey
,
.
ekey
=
pQuery
->
window
.
ekey
};
//
STimeWindow win = {.skey = pQuery->window.skey, .ekey = pQuery->window.ekey};
// tsdbResetQuery(pRuntimeEnv->pQueryHandle, &win, current, pQuery->order.order);
// tsdbNextDataBlock(pRuntimeEnv->pQueryHandle);
}
...
...
@@ -4020,7 +4021,7 @@ bool vnodeHasRemainResults(void *handle) {
// query has completed
if
(
Q_STATUS_EQUAL
(
pQuery
->
status
,
QUERY_COMPLETED
))
{
TSKEY
ekey
=
taosGetRevisedEndKey
(
pQuery
->
window
.
ekey
,
pQuery
->
order
.
order
,
pQuery
->
intervalTime
,
/*TSKEY ekey =*/
taosGetRevisedEndKey
(
pQuery
->
window
.
ekey
,
pQuery
->
order
.
order
,
pQuery
->
intervalTime
,
pQuery
->
slidingTimeUnit
,
pQuery
->
precision
);
// int32_t numOfTotal = taosGetNumOfResultWithInterpo(pInterpoInfo, (TSKEY
// *)pRuntimeEnv->pInterpoBuf[0]->data,
...
...
@@ -4088,8 +4089,8 @@ static void doCopyQueryResultToMsg(SQInfo *pQInfo, int32_t numOfRows, char *data
int32_t
vnodeQueryResultInterpolate
(
SQInfo
*
pQInfo
,
tFilePage
**
pDst
,
tFilePage
**
pDataSrc
,
int32_t
numOfRows
,
int32_t
*
numOfInterpo
)
{
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
//
SQueryRuntimeEnv *pRuntimeEnv = &pQInfo->runtimeEnv;
//
SQuery * pQuery = pRuntimeEnv->pQuery;
#if 0
while (1) {
numOfRows = taosNumOfRemainPoints(&pRuntimeEnv->interpoInfo);
...
...
@@ -4390,8 +4391,8 @@ static int64_t queryOnDataBlocks(SQInfo *pQInfo) {
static
bool
multimeterMultioutputHelper
(
SQInfo
*
pQInfo
,
bool
*
dataInDisk
,
bool
*
dataInCache
,
int32_t
index
,
int32_t
start
)
{
// STableIdInfo **pMeterSidExtInfo = pQInfo->pMeterSidExtInfo;
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
SQuery
*
pQuery
=
&
pRuntimeEnv
->
pQuery
;
//
SQueryRuntimeEnv *pRuntimeEnv = &pQInfo->runtimeEnv;
// SQuery * pQuery =
pRuntimeEnv->pQuery;
#if 0
setQueryStatus(pQuery, QUERY_NOT_COMPLETED);
...
...
@@ -4438,7 +4439,7 @@ static bool multimeterMultioutputHelper(SQInfo *pQInfo, bool *dataInDisk, bool *
#endif
initCtxOutputBuf
(
pRuntimeEnv
);
//
initCtxOutputBuf(pRuntimeEnv);
return
true
;
}
...
...
@@ -5457,8 +5458,8 @@ static int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SArray **pTableIdList,
}
static
int32_t
buildAirthmeticExprFromMsg
(
SSqlFunctionExpr
*
pExpr
,
SQueryTableMsg
*
pQueryMsg
)
{
SSqlBinaryExprInfo
*
pBinaryExprInfo
=
&
pExpr
->
binExprInfo
;
SColumnInfo
*
pColMsg
=
pQueryMsg
->
colList
;
//
SSqlBinaryExprInfo *pBinaryExprInfo = &pExpr->binExprInfo;
//
SColumnInfo * pColMsg = pQueryMsg->colList;
#if 0
tExprNode* pBinExpr = NULL;
SSchema* pSchema = toSchema(pQueryMsg, pColMsg, pQueryMsg->numOfCols);
...
...
@@ -5874,7 +5875,7 @@ static bool isValidQInfo(void *param) {
* pQInfo->signature may be changed by another thread, so we assign value of signature
* into local variable, then compare by using local variable
*/
uint64_t
sig
=
pQInfo
->
signature
;
uint64_t
sig
=
(
uint64_t
)
pQInfo
->
signature
;
return
(
sig
==
(
uint64_t
)
pQInfo
);
}
...
...
src/rpc/src/rpcMain.c
浏览文件 @
d8aa6d93
...
...
@@ -1100,6 +1100,10 @@ static void rpcProcessConnError(void *param, void *id) {
SRpcInfo
*
pRpc
=
pContext
->
pRpc
;
SRpcMsg
rpcMsg
;
if
(
pRpc
==
NULL
)
{
return
;
}
tTrace
(
"%s connection error happens"
,
pRpc
->
label
);
if
(
pContext
->
numOfTry
>=
pContext
->
ipSet
.
numOfIps
)
{
...
...
src/util/src/tutil.c
浏览文件 @
d8aa6d93
...
...
@@ -645,7 +645,7 @@ void * taosbsearch(const void *key, const void *base, size_t nmemb, size_t size,
}
}
if
((
*
compar
)(
key
,
elePtrAt
(
base
,
size
,
idx
)
<
0
)
)
{
if
((
*
compar
)(
key
,
elePtrAt
(
base
,
size
,
idx
)
)
<
0
)
{
return
elePtrAt
(
base
,
size
,
idx
);
}
else
{
if
(
idx
+
1
>
nmemb
-
1
)
{
...
...
src/vnode/tsdb/src/tsdbRead.c
浏览文件 @
d8aa6d93
...
...
@@ -301,6 +301,7 @@ tsdb_query_handle_t *tsdbQueryByTableId(tsdb_repo_t* tsdb, STsdbQueryCond *pCond
.
pCompInfo
=
calloc
(
1
,
1024
),
};
assert
(
info
.
pTableObj
!=
NULL
);
taosArrayPush
(
pQueryHandle
->
pTableCheckInfo
,
&
info
);
}
...
...
@@ -1008,17 +1009,21 @@ SArray *tsdbRetrieveDataBlock(tsdb_query_handle_t *pQueryHandle, SArray *pIdList
}
}
int32_t
tsdbResetQuery
(
tsdb_query_handle_t
*
pQueryHandle
,
STimeWindow
*
window
,
tsdbpos_t
position
,
int16_t
order
)
{}
int32_t
tsdbResetQuery
(
tsdb_query_handle_t
*
pQueryHandle
,
STimeWindow
*
window
,
tsdbpos_t
position
,
int16_t
order
)
{
return
0
;
}
int32_t
tsdbDataBlockSeek
(
tsdb_query_handle_t
*
pQueryHandle
,
tsdbpos_t
pos
)
{}
int32_t
tsdbDataBlockSeek
(
tsdb_query_handle_t
*
pQueryHandle
,
tsdbpos_t
pos
)
{
return
0
;
}
tsdbpos_t
tsdbDataBlockTell
(
tsdb_query_handle_t
*
pQueryHandle
)
{
return
NULL
;
}
SArray
*
tsdbRetrieveDataRow
(
tsdb_query_handle_t
*
pQueryHandle
,
SArray
*
pIdList
,
SQueryRowCond
*
pCond
)
{}
SArray
*
tsdbRetrieveDataRow
(
tsdb_query_handle_t
*
pQueryHandle
,
SArray
*
pIdList
,
SQueryRowCond
*
pCond
)
{
return
NULL
;
}
tsdb_query_handle_t
*
tsdbQueryFromTagConds
(
STsdbQueryCond
*
pCond
,
int16_t
stableId
,
const
char
*
pTagFilterStr
)
{}
tsdb_query_handle_t
*
tsdbQueryFromTagConds
(
STsdbQueryCond
*
pCond
,
int16_t
stableId
,
const
char
*
pTagFilterStr
)
{
return
NULL
;
}
SArray
*
tsdbGetTableList
(
tsdb_query_handle_t
*
pQueryHandle
)
{}
SArray
*
tsdbGetTableList
(
tsdb_query_handle_t
*
pQueryHandle
)
{
return
NULL
;
}
static
SArray
*
createTableIdArrayList
(
STsdbRepo
*
tsdb
,
int64_t
uid
)
{
STable
*
pTable
=
tsdbGetTableByUid
(
tsdbGetMeta
(
tsdb
),
uid
);
...
...
@@ -1303,7 +1308,7 @@ static int32_t doQueryTableList(STable* pSTable, SArray* pRes, const char* pCond
STColumn
*
stcol
=
schemaColAt
(
pSTable
->
tagSchema
,
0
);
tExprNode
*
pExpr
=
NULL
;
tSQLBinaryExprFromString
(
&
pExpr
,
stcol
,
schemaNCols
(
pSTable
->
tagSchema
),
pCond
,
strlen
(
pCond
));
tSQLBinaryExprFromString
(
&
pExpr
,
stcol
,
schemaNCols
(
pSTable
->
tagSchema
),
(
char
*
)
pCond
,
strlen
(
pCond
));
// failed to build expression, no result, return immediately
if
(
pExpr
==
NULL
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录