Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
92bef71e
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
92bef71e
编写于
1月 24, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename MAX/MIN/POW2/SWAP name
上级
9c3a3c10
变更
33
隐藏空白更改
内联
并排
Showing
33 changed file
with
158 addition
and
158 deletion
+158
-158
2.0/src/client/src/tscGlobalmerge.c
2.0/src/client/src/tscGlobalmerge.c
+2
-2
2.0/src/client/src/tscParseLineProtocol.c
2.0/src/client/src/tscParseLineProtocol.c
+2
-2
2.0/src/client/src/tscSQLParser.c
2.0/src/client/src/tscSQLParser.c
+5
-5
2.0/src/client/src/tscSql.c
2.0/src/client/src/tscSql.c
+5
-5
2.0/src/client/src/tscSubquery.c
2.0/src/client/src/tscSubquery.c
+1
-1
2.0/src/query/src/qAggMain.c
2.0/src/query/src/qAggMain.c
+6
-6
2.0/src/query/src/qExecutor.c
2.0/src/query/src/qExecutor.c
+17
-17
include/os/osMath.h
include/os/osMath.h
+7
-7
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+4
-4
source/common/src/ttypes.c
source/common/src/ttypes.c
+7
-7
source/dnode/mgmt/impl/src/dndVnodes.c
source/dnode/mgmt/impl/src/dndVnodes.c
+4
-4
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+1
-1
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+1
-1
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+1
-1
source/dnode/mnode/sdb/src/sdbHash.c
source/dnode/mnode/sdb/src/sdbHash.c
+4
-4
source/dnode/vnode/src/tsdb/tsdbCompact.c
source/dnode/vnode/src/tsdb/tsdbCompact.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbFS.c
source/dnode/vnode/src/tsdb/tsdbFS.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbMemTable.c
source/dnode/vnode/src/tsdb/tsdbMemTable.c
+16
-16
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+7
-7
source/dnode/vnode/src/vnd/vnodeArenaMAImpl.c
source/dnode/vnode/src/vnd/vnodeArenaMAImpl.c
+1
-1
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+17
-17
source/libs/function/src/taggfunction.c
source/libs/function/src/taggfunction.c
+6
-6
source/libs/function/src/tbinoperator.c
source/libs/function/src/tbinoperator.c
+7
-7
source/libs/index/src/index_fst.c
source/libs/index/src/index_fst.c
+3
-3
source/libs/parser/src/astValidate.c
source/libs/parser/src/astValidate.c
+5
-5
source/libs/parser/src/insertParser.c
source/libs/parser/src/insertParser.c
+1
-1
source/libs/planner/src/physicalPlan.c
source/libs/planner/src/physicalPlan.c
+1
-1
source/libs/qcom/src/queryUtil.c
source/libs/qcom/src/queryUtil.c
+1
-1
source/libs/sync/inc/sync_type.h
source/libs/sync/inc/sync_type.h
+4
-4
source/libs/sync/src/sync_raft_progress.c
source/libs/sync/src/sync_raft_progress.c
+3
-3
source/libs/wal/src/walMeta.c
source/libs/wal/src/walMeta.c
+1
-1
source/util/src/thash.c
source/util/src/thash.c
+1
-1
tools/shell/src/shellEngine.c
tools/shell/src/shellEngine.c
+15
-15
未找到文件。
2.0/src/client/src/tscGlobalmerge.c
浏览文件 @
92bef71e
...
@@ -701,7 +701,7 @@ SGlobalMerger* tscInitResObjForLocalQuery(int32_t numOfRes, int32_t rowLen, uint
...
@@ -701,7 +701,7 @@ SGlobalMerger* tscInitResObjForLocalQuery(int32_t numOfRes, int32_t rowLen, uint
// todo remove it
// todo remove it
int32_t
doArithmeticCalculate
(
SQueryInfo
*
pQueryInfo
,
tFilePage
*
pOutput
,
int32_t
rowSize
,
int32_t
finalRowSize
)
{
int32_t
doArithmeticCalculate
(
SQueryInfo
*
pQueryInfo
,
tFilePage
*
pOutput
,
int32_t
rowSize
,
int32_t
finalRowSize
)
{
int32_t
maxRowSize
=
MAX
(
rowSize
,
finalRowSize
);
int32_t
maxRowSize
=
T
MAX
(
rowSize
,
finalRowSize
);
char
*
pbuf
=
calloc
(
1
,
(
size_t
)(
pOutput
->
num
*
maxRowSize
));
char
*
pbuf
=
calloc
(
1
,
(
size_t
)(
pOutput
->
num
*
maxRowSize
));
size_t
size
=
tscNumOfFields
(
pQueryInfo
);
size_t
size
=
tscNumOfFields
(
pQueryInfo
);
...
@@ -965,7 +965,7 @@ SSDataBlock* doGlobalAggregate(void* param, bool* newgroup) {
...
@@ -965,7 +965,7 @@ SSDataBlock* doGlobalAggregate(void* param, bool* newgroup) {
w
->
ekey
=
*
(
int64_t
*
)(((
char
*
)
pInfoData
->
pData
)
+
TSDB_KEYSIZE
*
(
pRes
->
info
.
rows
-
1
));
w
->
ekey
=
*
(
int64_t
*
)(((
char
*
)
pInfoData
->
pData
)
+
TSDB_KEYSIZE
*
(
pRes
->
info
.
rows
-
1
));
if
(
pOperator
->
pRuntimeEnv
->
pQueryAttr
->
order
.
order
==
TSDB_ORDER_DESC
)
{
if
(
pOperator
->
pRuntimeEnv
->
pQueryAttr
->
order
.
order
==
TSDB_ORDER_DESC
)
{
SWAP
(
w
->
skey
,
w
->
ekey
,
TSKEY
);
T
SWAP
(
w
->
skey
,
w
->
ekey
,
TSKEY
);
assert
(
w
->
skey
<=
w
->
ekey
);
assert
(
w
->
skey
<=
w
->
ekey
);
}
}
}
}
...
...
2.0/src/client/src/tscParseLineProtocol.c
浏览文件 @
92bef71e
...
@@ -47,7 +47,7 @@ int compareSmlColKv(const void* p1, const void* p2) {
...
@@ -47,7 +47,7 @@ int compareSmlColKv(const void* p1, const void* p2) {
TAOS_SML_KV
*
kv2
=
(
TAOS_SML_KV
*
)
p2
;
TAOS_SML_KV
*
kv2
=
(
TAOS_SML_KV
*
)
p2
;
int
kvLen1
=
(
int
)
strlen
(
kv1
->
key
);
int
kvLen1
=
(
int
)
strlen
(
kv1
->
key
);
int
kvLen2
=
(
int
)
strlen
(
kv2
->
key
);
int
kvLen2
=
(
int
)
strlen
(
kv2
->
key
);
int
res
=
strncasecmp
(
kv1
->
key
,
kv2
->
key
,
MIN
(
kvLen1
,
kvLen2
));
int
res
=
strncasecmp
(
kv1
->
key
,
kv2
->
key
,
T
MIN
(
kvLen1
,
kvLen2
));
if
(
res
!=
0
)
{
if
(
res
!=
0
)
{
return
res
;
return
res
;
}
else
{
}
else
{
...
@@ -123,7 +123,7 @@ static int32_t buildSmlKvSchema(TAOS_SML_KV* smlKv, SHashObj* hash, SArray* arra
...
@@ -123,7 +123,7 @@ static int32_t buildSmlKvSchema(TAOS_SML_KV* smlKv, SHashObj* hash, SArray* arra
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
return
code
;
return
code
;
}
}
pField
->
bytes
=
MAX
(
pField
->
bytes
,
bytes
);
pField
->
bytes
=
T
MAX
(
pField
->
bytes
,
bytes
);
}
else
{
}
else
{
SSchema
field
=
{
0
};
SSchema
field
=
{
0
};
...
...
2.0/src/client/src/tscSQLParser.c
浏览文件 @
92bef71e
...
@@ -1785,7 +1785,7 @@ static int32_t handleArithmeticExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32
...
@@ -1785,7 +1785,7 @@ static int32_t handleArithmeticExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32
getNewResColId
(
pCmd
),
sizeof
(
double
),
false
);
getNewResColId
(
pCmd
),
sizeof
(
double
),
false
);
char
*
name
=
(
pItem
->
aliasName
!=
NULL
)
?
pItem
->
aliasName
:
pItem
->
pNode
->
exprToken
.
z
;
char
*
name
=
(
pItem
->
aliasName
!=
NULL
)
?
pItem
->
aliasName
:
pItem
->
pNode
->
exprToken
.
z
;
size_t
len
=
MIN
(
sizeof
(
pExpr
->
base
.
aliasName
),
pItem
->
pNode
->
exprToken
.
n
+
1
);
size_t
len
=
T
MIN
(
sizeof
(
pExpr
->
base
.
aliasName
),
pItem
->
pNode
->
exprToken
.
n
+
1
);
tstrncpy
(
pExpr
->
base
.
aliasName
,
name
,
len
);
tstrncpy
(
pExpr
->
base
.
aliasName
,
name
,
len
);
tExprNode
*
pNode
=
NULL
;
tExprNode
*
pNode
=
NULL
;
...
@@ -2246,7 +2246,7 @@ SSchema tGetUserSpecifiedColumnSchema(SVariant* pVal, SStrToken* exprStr, const
...
@@ -2246,7 +2246,7 @@ SSchema tGetUserSpecifiedColumnSchema(SVariant* pVal, SStrToken* exprStr, const
if
(
name
!=
NULL
)
{
if
(
name
!=
NULL
)
{
tstrncpy
(
s
.
name
,
name
,
sizeof
(
s
.
name
));
tstrncpy
(
s
.
name
,
name
,
sizeof
(
s
.
name
));
}
else
{
}
else
{
size_t
tlen
=
MIN
(
sizeof
(
s
.
name
),
exprStr
->
n
+
1
);
size_t
tlen
=
T
MIN
(
sizeof
(
s
.
name
),
exprStr
->
n
+
1
);
tstrncpy
(
s
.
name
,
exprStr
->
z
,
tlen
);
tstrncpy
(
s
.
name
,
exprStr
->
z
,
tlen
);
strdequote
(
s
.
name
);
strdequote
(
s
.
name
);
}
}
...
@@ -2419,7 +2419,7 @@ void setResultColName(char* name, tSqlExprItem* pItem, int32_t functionId, SStrT
...
@@ -2419,7 +2419,7 @@ void setResultColName(char* name, tSqlExprItem* pItem, int32_t functionId, SStrT
tstrncpy
(
name
,
pItem
->
aliasName
,
TSDB_COL_NAME_LEN
);
tstrncpy
(
name
,
pItem
->
aliasName
,
TSDB_COL_NAME_LEN
);
}
else
if
(
multiCols
)
{
}
else
if
(
multiCols
)
{
char
uname
[
TSDB_COL_NAME_LEN
]
=
{
0
};
char
uname
[
TSDB_COL_NAME_LEN
]
=
{
0
};
int32_t
len
=
MIN
(
pToken
->
n
+
1
,
TSDB_COL_NAME_LEN
);
int32_t
len
=
T
MIN
(
pToken
->
n
+
1
,
TSDB_COL_NAME_LEN
);
tstrncpy
(
uname
,
pToken
->
z
,
len
);
tstrncpy
(
uname
,
pToken
->
z
,
len
);
if
(
tsKeepOriginalColumnName
)
{
// keep the original column name
if
(
tsKeepOriginalColumnName
)
{
// keep the original column name
...
@@ -2432,7 +2432,7 @@ void setResultColName(char* name, tSqlExprItem* pItem, int32_t functionId, SStrT
...
@@ -2432,7 +2432,7 @@ void setResultColName(char* name, tSqlExprItem* pItem, int32_t functionId, SStrT
tstrncpy
(
name
,
tmp
,
TSDB_COL_NAME_LEN
);
tstrncpy
(
name
,
tmp
,
TSDB_COL_NAME_LEN
);
}
}
}
else
{
// use the user-input result column name
}
else
{
// use the user-input result column name
int32_t
len
=
MIN
(
pItem
->
pNode
->
exprToken
.
n
+
1
,
TSDB_COL_NAME_LEN
);
int32_t
len
=
T
MIN
(
pItem
->
pNode
->
exprToken
.
n
+
1
,
TSDB_COL_NAME_LEN
);
tstrncpy
(
name
,
pItem
->
pNode
->
exprToken
.
z
,
len
);
tstrncpy
(
name
,
pItem
->
pNode
->
exprToken
.
z
,
len
);
}
}
}
}
...
@@ -4380,7 +4380,7 @@ static void exchangeExpr(tSqlExpr* pExpr) {
...
@@ -4380,7 +4380,7 @@ static void exchangeExpr(tSqlExpr* pExpr) {
}
}
pExpr
->
tokenId
=
optr
;
pExpr
->
tokenId
=
optr
;
SWAP
(
pExpr
->
pLeft
,
pExpr
->
pRight
,
void
*
);
T
SWAP
(
pExpr
->
pLeft
,
pExpr
->
pRight
,
void
*
);
}
}
}
}
...
...
2.0/src/client/src/tscSql.c
浏览文件 @
92bef71e
...
@@ -120,7 +120,7 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
...
@@ -120,7 +120,7 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
pObj
->
signature
=
pObj
;
pObj
->
signature
=
pObj
;
pObj
->
pRpcObj
=
(
SRpcObj
*
)
pRpcObj
;
pObj
->
pRpcObj
=
(
SRpcObj
*
)
pRpcObj
;
tstrncpy
(
pObj
->
user
,
user
,
sizeof
(
pObj
->
user
));
tstrncpy
(
pObj
->
user
,
user
,
sizeof
(
pObj
->
user
));
secretEncryptLen
=
MIN
(
secretEncryptLen
,
sizeof
(
pObj
->
pass
));
secretEncryptLen
=
T
MIN
(
secretEncryptLen
,
sizeof
(
pObj
->
pass
));
memcpy
(
pObj
->
pass
,
secretEncrypt
,
secretEncryptLen
);
memcpy
(
pObj
->
pass
,
secretEncrypt
,
secretEncryptLen
);
if
(
db
)
{
if
(
db
)
{
...
@@ -245,10 +245,10 @@ TAOS *taos_connect_c(const char *ip, uint8_t ipLen, const char *user, uint8_t us
...
@@ -245,10 +245,10 @@ TAOS *taos_connect_c(const char *ip, uint8_t ipLen, const char *user, uint8_t us
char
userBuf
[
TSDB_USER_LEN
]
=
{
0
};
char
userBuf
[
TSDB_USER_LEN
]
=
{
0
};
char
passBuf
[
TSDB_KEY_LEN
]
=
{
0
};
char
passBuf
[
TSDB_KEY_LEN
]
=
{
0
};
char
dbBuf
[
TSDB_DB_NAME_LEN
]
=
{
0
};
char
dbBuf
[
TSDB_DB_NAME_LEN
]
=
{
0
};
strncpy
(
ipBuf
,
ip
,
MIN
(
TSDB_EP_LEN
-
1
,
ipLen
));
strncpy
(
ipBuf
,
ip
,
T
MIN
(
TSDB_EP_LEN
-
1
,
ipLen
));
strncpy
(
userBuf
,
user
,
MIN
(
TSDB_USER_LEN
-
1
,
userLen
));
strncpy
(
userBuf
,
user
,
T
MIN
(
TSDB_USER_LEN
-
1
,
userLen
));
strncpy
(
passBuf
,
pass
,
MIN
(
TSDB_KEY_LEN
-
1
,
passLen
));
strncpy
(
passBuf
,
pass
,
T
MIN
(
TSDB_KEY_LEN
-
1
,
passLen
));
strncpy
(
dbBuf
,
db
,
MIN
(
TSDB_DB_NAME_LEN
-
1
,
dbLen
));
strncpy
(
dbBuf
,
db
,
T
MIN
(
TSDB_DB_NAME_LEN
-
1
,
dbLen
));
return
taos_connect
(
ipBuf
,
userBuf
,
passBuf
,
dbBuf
,
port
);
return
taos_connect
(
ipBuf
,
userBuf
,
passBuf
,
dbBuf
,
port
);
}
}
...
...
2.0/src/client/src/tscSubquery.c
浏览文件 @
92bef71e
...
@@ -3396,7 +3396,7 @@ static void doBuildResFromSubqueries(SSqlObj* pSql) {
...
@@ -3396,7 +3396,7 @@ static void doBuildResFromSubqueries(SSqlObj* pSql) {
}
}
int32_t
remain
=
(
int32_t
)(
pSub
->
res
.
numOfRows
-
pSub
->
res
.
row
);
int32_t
remain
=
(
int32_t
)(
pSub
->
res
.
numOfRows
-
pSub
->
res
.
row
);
numOfRes
=
(
int32_t
)(
MIN
(
numOfRes
,
remain
));
numOfRes
=
(
int32_t
)(
T
MIN
(
numOfRes
,
remain
));
}
}
if
(
numOfRes
==
0
)
{
// no result any more, free all subquery objects
if
(
numOfRes
==
0
)
{
// no result any more, free all subquery objects
...
...
2.0/src/query/src/qAggMain.c
浏览文件 @
92bef71e
...
@@ -373,7 +373,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
...
@@ -373,7 +373,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
*
interBytes
=
(
int16_t
)
sizeof
(
SPercentileInfo
);
*
interBytes
=
(
int16_t
)
sizeof
(
SPercentileInfo
);
}
else
if
(
functionId
==
TSDB_FUNC_LEASTSQR
)
{
}
else
if
(
functionId
==
TSDB_FUNC_LEASTSQR
)
{
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
bytes
=
MAX
(
TSDB_AVG_FUNCTION_INTER_BUFFER_SIZE
,
sizeof
(
SLeastsquaresInfo
));
// string
*
bytes
=
T
MAX
(
TSDB_AVG_FUNCTION_INTER_BUFFER_SIZE
,
sizeof
(
SLeastsquaresInfo
));
// string
*
interBytes
=
*
bytes
;
*
interBytes
=
*
bytes
;
}
else
if
(
functionId
==
TSDB_FUNC_FIRST_DST
||
functionId
==
TSDB_FUNC_LAST_DST
)
{
}
else
if
(
functionId
==
TSDB_FUNC_FIRST_DST
||
functionId
==
TSDB_FUNC_LAST_DST
)
{
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
type
=
TSDB_DATA_TYPE_BINARY
;
...
@@ -1275,7 +1275,7 @@ static void max_func_merge(SQLFunctionCtx *pCtx) {
...
@@ -1275,7 +1275,7 @@ static void max_func_merge(SQLFunctionCtx *pCtx) {
continue; \
continue; \
} \
} \
(num) += 1; \
(num) += 1; \
(r) += POW2(((type *)d)[i] - (delta)); \
(r) +=
T
POW2(((type *)d)[i] - (delta)); \
}
}
static
void
stddev_function
(
SQLFunctionCtx
*
pCtx
)
{
static
void
stddev_function
(
SQLFunctionCtx
*
pCtx
)
{
...
@@ -1314,7 +1314,7 @@ static void stddev_function(SQLFunctionCtx *pCtx) {
...
@@ -1314,7 +1314,7 @@ static void stddev_function(SQLFunctionCtx *pCtx) {
continue
;
continue
;
}
}
num
+=
1
;
num
+=
1
;
*
retVal
+=
POW2
(((
int32_t
*
)
pData
)[
i
]
-
avg
);
*
retVal
+=
T
POW2
(((
int32_t
*
)
pData
)[
i
]
-
avg
);
}
}
break
;
break
;
}
}
...
@@ -1427,7 +1427,7 @@ static void stddev_dst_function(SQLFunctionCtx *pCtx) {
...
@@ -1427,7 +1427,7 @@ static void stddev_dst_function(SQLFunctionCtx *pCtx) {
continue
;
continue
;
}
}
num
+=
1
;
num
+=
1
;
*
retVal
+=
POW2
(((
int32_t
*
)
pData
)[
i
]
-
avg
);
*
retVal
+=
T
POW2
(((
int32_t
*
)
pData
)[
i
]
-
avg
);
}
}
break
;
break
;
}
}
...
@@ -4109,8 +4109,8 @@ static void mergeTableBlockDist(SResultRowCellInfo* pResInfo, const STableBlockD
...
@@ -4109,8 +4109,8 @@ static void mergeTableBlockDist(SResultRowCellInfo* pResInfo, const STableBlockD
pDist
->
totalRows
+=
pSrc
->
totalRows
;
pDist
->
totalRows
+=
pSrc
->
totalRows
;
if
(
pResInfo
->
hasResult
==
DATA_SET_FLAG
)
{
if
(
pResInfo
->
hasResult
==
DATA_SET_FLAG
)
{
pDist
->
maxRows
=
MAX
(
pDist
->
maxRows
,
pSrc
->
maxRows
);
pDist
->
maxRows
=
T
MAX
(
pDist
->
maxRows
,
pSrc
->
maxRows
);
pDist
->
minRows
=
MIN
(
pDist
->
minRows
,
pSrc
->
minRows
);
pDist
->
minRows
=
T
MIN
(
pDist
->
minRows
,
pSrc
->
minRows
);
}
else
{
}
else
{
pDist
->
maxRows
=
pSrc
->
maxRows
;
pDist
->
maxRows
=
pSrc
->
maxRows
;
pDist
->
minRows
=
pSrc
->
minRows
;
pDist
->
minRows
=
pSrc
->
minRows
;
...
...
2.0/src/query/src/qExecutor.c
浏览文件 @
92bef71e
...
@@ -328,7 +328,7 @@ SSDataBlock* createOutputBuf(SExprInfo* pExpr, int32_t numOfOutput, int32_t numO
...
@@ -328,7 +328,7 @@ SSDataBlock* createOutputBuf(SExprInfo* pExpr, int32_t numOfOutput, int32_t numO
idata
.
info
.
bytes
=
pExpr
[
i
].
base
.
resBytes
;
idata
.
info
.
bytes
=
pExpr
[
i
].
base
.
resBytes
;
idata
.
info
.
colId
=
pExpr
[
i
].
base
.
resColId
;
idata
.
info
.
colId
=
pExpr
[
i
].
base
.
resColId
;
int32_t
size
=
MAX
(
idata
.
info
.
bytes
*
numOfRows
,
minSize
);
int32_t
size
=
T
MAX
(
idata
.
info
.
bytes
*
numOfRows
,
minSize
);
idata
.
pData
=
calloc
(
1
,
size
);
// at least to hold a pointer on x64 platform
idata
.
pData
=
calloc
(
1
,
size
);
// at least to hold a pointer on x64 platform
taosArrayPush
(
res
->
pDataBlock
,
&
idata
);
taosArrayPush
(
res
->
pDataBlock
,
&
idata
);
}
}
...
@@ -2643,7 +2643,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool
...
@@ -2643,7 +2643,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool
pQueryAttr
->
order
.
order
=
TSDB_ORDER_ASC
;
pQueryAttr
->
order
.
order
=
TSDB_ORDER_ASC
;
if
(
pQueryAttr
->
window
.
skey
>
pQueryAttr
->
window
.
ekey
)
{
if
(
pQueryAttr
->
window
.
skey
>
pQueryAttr
->
window
.
ekey
)
{
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
T
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
}
}
pQueryAttr
->
needReverseScan
=
false
;
pQueryAttr
->
needReverseScan
=
false
;
...
@@ -2653,7 +2653,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool
...
@@ -2653,7 +2653,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool
if
(
pQueryAttr
->
groupbyColumn
&&
pQueryAttr
->
order
.
order
==
TSDB_ORDER_DESC
)
{
if
(
pQueryAttr
->
groupbyColumn
&&
pQueryAttr
->
order
.
order
==
TSDB_ORDER_DESC
)
{
pQueryAttr
->
order
.
order
=
TSDB_ORDER_ASC
;
pQueryAttr
->
order
.
order
=
TSDB_ORDER_ASC
;
if
(
pQueryAttr
->
window
.
skey
>
pQueryAttr
->
window
.
ekey
)
{
if
(
pQueryAttr
->
window
.
skey
>
pQueryAttr
->
window
.
ekey
)
{
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
T
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
}
}
pQueryAttr
->
needReverseScan
=
false
;
pQueryAttr
->
needReverseScan
=
false
;
...
@@ -2664,7 +2664,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool
...
@@ -2664,7 +2664,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool
if
(
pQueryAttr
->
pointInterpQuery
&&
pQueryAttr
->
interval
.
interval
==
0
)
{
if
(
pQueryAttr
->
pointInterpQuery
&&
pQueryAttr
->
interval
.
interval
==
0
)
{
if
(
!
QUERY_IS_ASC_QUERY
(
pQueryAttr
))
{
if
(
!
QUERY_IS_ASC_QUERY
(
pQueryAttr
))
{
qDebug
(
msg
,
pQInfo
->
qId
,
"interp"
,
pQueryAttr
->
order
.
order
,
TSDB_ORDER_ASC
,
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
skey
);
qDebug
(
msg
,
pQInfo
->
qId
,
"interp"
,
pQueryAttr
->
order
.
order
,
TSDB_ORDER_ASC
,
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
skey
);
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
T
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
}
}
pQueryAttr
->
order
.
order
=
TSDB_ORDER_ASC
;
pQueryAttr
->
order
.
order
=
TSDB_ORDER_ASC
;
...
@@ -2677,7 +2677,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool
...
@@ -2677,7 +2677,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool
qDebug
(
msg
,
pQInfo
->
qId
,
"only-first"
,
pQueryAttr
->
order
.
order
,
TSDB_ORDER_ASC
,
pQueryAttr
->
window
.
skey
,
qDebug
(
msg
,
pQInfo
->
qId
,
"only-first"
,
pQueryAttr
->
order
.
order
,
TSDB_ORDER_ASC
,
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
skey
);
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
skey
);
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
T
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
doUpdateLastKey
(
pQueryAttr
);
doUpdateLastKey
(
pQueryAttr
);
}
}
...
@@ -2688,7 +2688,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool
...
@@ -2688,7 +2688,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool
qDebug
(
msg
,
pQInfo
->
qId
,
"only-last"
,
pQueryAttr
->
order
.
order
,
TSDB_ORDER_DESC
,
pQueryAttr
->
window
.
skey
,
qDebug
(
msg
,
pQInfo
->
qId
,
"only-last"
,
pQueryAttr
->
order
.
order
,
TSDB_ORDER_DESC
,
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
skey
);
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
skey
);
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
T
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
doUpdateLastKey
(
pQueryAttr
);
doUpdateLastKey
(
pQueryAttr
);
}
}
...
@@ -2703,7 +2703,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool
...
@@ -2703,7 +2703,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool
qDebug
(
msg
,
pQInfo
->
qId
,
"only-first stable"
,
pQueryAttr
->
order
.
order
,
TSDB_ORDER_ASC
,
qDebug
(
msg
,
pQInfo
->
qId
,
"only-first stable"
,
pQueryAttr
->
order
.
order
,
TSDB_ORDER_ASC
,
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
skey
);
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
skey
);
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
T
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
doUpdateLastKey
(
pQueryAttr
);
doUpdateLastKey
(
pQueryAttr
);
}
}
...
@@ -2714,7 +2714,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool
...
@@ -2714,7 +2714,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool
qDebug
(
msg
,
pQInfo
->
qId
,
"only-last stable"
,
pQueryAttr
->
order
.
order
,
TSDB_ORDER_DESC
,
qDebug
(
msg
,
pQInfo
->
qId
,
"only-last stable"
,
pQueryAttr
->
order
.
order
,
TSDB_ORDER_DESC
,
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
skey
);
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
ekey
,
pQueryAttr
->
window
.
skey
);
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
T
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
doUpdateLastKey
(
pQueryAttr
);
doUpdateLastKey
(
pQueryAttr
);
}
}
...
@@ -2754,8 +2754,8 @@ static FORCE_INLINE bool doFilterByBlockStatistics(SQueryRuntimeEnv* pRuntimeEnv
...
@@ -2754,8 +2754,8 @@ static FORCE_INLINE bool doFilterByBlockStatistics(SQueryRuntimeEnv* pRuntimeEnv
static
bool
overlapWithTimeWindow
(
SQueryAttr
*
pQueryAttr
,
SDataBlockInfo
*
pBlockInfo
)
{
static
bool
overlapWithTimeWindow
(
SQueryAttr
*
pQueryAttr
,
SDataBlockInfo
*
pBlockInfo
)
{
STimeWindow
w
=
{
0
};
STimeWindow
w
=
{
0
};
TSKEY
sk
=
MIN
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
);
TSKEY
sk
=
T
MIN
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
);
TSKEY
ek
=
MAX
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
);
TSKEY
ek
=
T
MAX
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
);
if
(
QUERY_IS_ASC_QUERY
(
pQueryAttr
))
{
if
(
QUERY_IS_ASC_QUERY
(
pQueryAttr
))
{
getAlignQueryTimeWindow
(
pQueryAttr
,
pBlockInfo
->
window
.
skey
,
sk
,
ek
,
&
w
);
getAlignQueryTimeWindow
(
pQueryAttr
,
pBlockInfo
->
window
.
skey
,
sk
,
ek
,
&
w
);
...
@@ -3523,7 +3523,7 @@ static void updateTableQueryInfoForReverseScan(STableQueryInfo *pTableQueryInfo)
...
@@ -3523,7 +3523,7 @@ static void updateTableQueryInfoForReverseScan(STableQueryInfo *pTableQueryInfo)
return
;
return
;
}
}
SWAP
(
pTableQueryInfo
->
win
.
skey
,
pTableQueryInfo
->
win
.
ekey
,
TSKEY
);
T
SWAP
(
pTableQueryInfo
->
win
.
skey
,
pTableQueryInfo
->
win
.
ekey
,
TSKEY
);
pTableQueryInfo
->
lastKey
=
pTableQueryInfo
->
win
.
skey
;
pTableQueryInfo
->
lastKey
=
pTableQueryInfo
->
win
.
skey
;
SWITCH_ORDER
(
pTableQueryInfo
->
cur
.
order
);
SWITCH_ORDER
(
pTableQueryInfo
->
cur
.
order
);
...
@@ -3730,7 +3730,7 @@ static void setupEnvForReverseScan(SQueryRuntimeEnv *pRuntimeEnv, SResultRowInfo
...
@@ -3730,7 +3730,7 @@ static void setupEnvForReverseScan(SQueryRuntimeEnv *pRuntimeEnv, SResultRowInfo
}
}
// reverse order time range
// reverse order time range
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
T
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
SET_REVERSE_SCAN_FLAG
(
pRuntimeEnv
);
SET_REVERSE_SCAN_FLAG
(
pRuntimeEnv
);
setQueryStatus
(
pRuntimeEnv
,
QUERY_NOT_COMPLETED
);
setQueryStatus
(
pRuntimeEnv
,
QUERY_NOT_COMPLETED
);
...
@@ -4109,8 +4109,8 @@ void setIntervalQueryRange(SQueryRuntimeEnv *pRuntimeEnv, TSKEY key) {
...
@@ -4109,8 +4109,8 @@ void setIntervalQueryRange(SQueryRuntimeEnv *pRuntimeEnv, TSKEY key) {
*/
*/
STimeWindow
w
=
TSWINDOW_INITIALIZER
;
STimeWindow
w
=
TSWINDOW_INITIALIZER
;
TSKEY
sk
=
MIN
(
win
.
skey
,
win
.
ekey
);
TSKEY
sk
=
T
MIN
(
win
.
skey
,
win
.
ekey
);
TSKEY
ek
=
MAX
(
win
.
skey
,
win
.
ekey
);
TSKEY
ek
=
T
MAX
(
win
.
skey
,
win
.
ekey
);
getAlignQueryTimeWindow
(
pQueryAttr
,
win
.
skey
,
sk
,
ek
,
&
w
);
getAlignQueryTimeWindow
(
pQueryAttr
,
win
.
skey
,
sk
,
ek
,
&
w
);
// if (pResultRowInfo->prevSKey == TSKEY_INITIAL_VAL) {
// if (pResultRowInfo->prevSKey == TSKEY_INITIAL_VAL) {
...
@@ -4235,7 +4235,7 @@ static void updateNumOfRowsInResultRows(SQueryRuntimeEnv* pRuntimeEnv, SQLFuncti
...
@@ -4235,7 +4235,7 @@ static void updateNumOfRowsInResultRows(SQueryRuntimeEnv* pRuntimeEnv, SQLFuncti
}
}
SResultRowCellInfo
*
pCell
=
getResultCell
(
pResult
,
j
,
rowCellInfoOffset
);
SResultRowCellInfo
*
pCell
=
getResultCell
(
pResult
,
j
,
rowCellInfoOffset
);
pResult
->
numOfRows
=
(
uint16_t
)(
MAX
(
pResult
->
numOfRows
,
pCell
->
numOfRes
));
pResult
->
numOfRows
=
(
uint16_t
)(
T
MAX
(
pResult
->
numOfRows
,
pCell
->
numOfRes
));
}
}
}
}
}
}
...
@@ -6945,8 +6945,8 @@ SOperatorInfo* createFillOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorIn
...
@@ -6945,8 +6945,8 @@ SOperatorInfo* createFillOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorIn
SFillColInfo
*
pColInfo
=
createFillColInfo
(
pExpr
,
numOfOutput
,
pQueryAttr
->
fillVal
);
SFillColInfo
*
pColInfo
=
createFillColInfo
(
pExpr
,
numOfOutput
,
pQueryAttr
->
fillVal
);
STimeWindow
w
=
TSWINDOW_INITIALIZER
;
STimeWindow
w
=
TSWINDOW_INITIALIZER
;
TSKEY
sk
=
MIN
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
);
TSKEY
sk
=
T
MIN
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
);
TSKEY
ek
=
MAX
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
);
TSKEY
ek
=
T
MAX
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
);
getAlignQueryTimeWindow
(
pQueryAttr
,
pQueryAttr
->
window
.
skey
,
sk
,
ek
,
&
w
);
getAlignQueryTimeWindow
(
pQueryAttr
,
pQueryAttr
->
window
.
skey
,
sk
,
ek
,
&
w
);
pInfo
->
pFillInfo
=
pInfo
->
pFillInfo
=
...
...
include/os/osMath.h
浏览文件 @
92bef71e
...
@@ -20,37 +20,37 @@
...
@@ -20,37 +20,37 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
#define POW2(x) ((x) * (x))
#define
T
POW2(x) ((x) * (x))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
#define SWAP(a, b, c) \
#define
T
SWAP(a, b, c) \
do { \
do { \
c __tmp = (c)(a); \
c __tmp = (c)(a); \
(a) = (c)(b); \
(a) = (c)(b); \
(b) = __tmp; \
(b) = __tmp; \
} while (0)
} while (0)
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#define
T
MAX(a, b) (((a) > (b)) ? (a) : (b))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define
T
MIN(a, b) (((a) < (b)) ? (a) : (b))
#else
#else
#define SWAP(a, b, c) \
#define
T
SWAP(a, b, c) \
do { \
do { \
typeof(a) __tmp = (a); \
typeof(a) __tmp = (a); \
(a) = (b); \
(a) = (b); \
(b) = __tmp; \
(b) = __tmp; \
} while (0)
} while (0)
#define MAX(a, b) \
#define
T
MAX(a, b) \
({ \
({ \
typeof(a) __a = (a); \
typeof(a) __a = (a); \
typeof(b) __b = (b); \
typeof(b) __b = (b); \
(__a > __b) ? __a : __b; \
(__a > __b) ? __a : __b; \
})
})
#define MIN(a, b) \
#define
T
MIN(a, b) \
({ \
({ \
typeof(a) __a = (a); \
typeof(a) __a = (a); \
typeof(b) __b = (b); \
typeof(b) __b = (b); \
...
...
source/client/src/clientImpl.c
浏览文件 @
92bef71e
...
@@ -694,10 +694,10 @@ TAOS *taos_connect_l(const char *ip, int ipLen, const char *user, int userLen, c
...
@@ -694,10 +694,10 @@ TAOS *taos_connect_l(const char *ip, int ipLen, const char *user, int userLen, c
char
userStr
[
TSDB_USER_LEN
]
=
{
0
};
char
userStr
[
TSDB_USER_LEN
]
=
{
0
};
char
passStr
[
TSDB_PASSWORD_LEN
]
=
{
0
};
char
passStr
[
TSDB_PASSWORD_LEN
]
=
{
0
};
strncpy
(
ipStr
,
ip
,
MIN
(
TSDB_EP_LEN
-
1
,
ipLen
));
strncpy
(
ipStr
,
ip
,
T
MIN
(
TSDB_EP_LEN
-
1
,
ipLen
));
strncpy
(
userStr
,
user
,
MIN
(
TSDB_USER_LEN
-
1
,
userLen
));
strncpy
(
userStr
,
user
,
T
MIN
(
TSDB_USER_LEN
-
1
,
userLen
));
strncpy
(
passStr
,
pass
,
MIN
(
TSDB_PASSWORD_LEN
-
1
,
passLen
));
strncpy
(
passStr
,
pass
,
T
MIN
(
TSDB_PASSWORD_LEN
-
1
,
passLen
));
strncpy
(
dbStr
,
db
,
MIN
(
TSDB_DB_NAME_LEN
-
1
,
dbLen
));
strncpy
(
dbStr
,
db
,
T
MIN
(
TSDB_DB_NAME_LEN
-
1
,
dbLen
));
return
taos_connect
(
ipStr
,
userStr
,
passStr
,
dbStr
,
port
);
return
taos_connect
(
ipStr
,
userStr
,
passStr
,
dbStr
,
port
);
}
}
...
...
source/common/src/ttypes.c
浏览文件 @
92bef71e
...
@@ -630,7 +630,7 @@ void operateVal(void *dst, void *s1, void *s2, int32_t optr, int32_t type) {
...
@@ -630,7 +630,7 @@ void operateVal(void *dst, void *s1, void *s2, int32_t optr, int32_t type) {
}
}
}
}
#define SWAP(a, b, c) \
#define
T
SWAP(a, b, c) \
do { \
do { \
typeof(a) __tmp = (a); \
typeof(a) __tmp = (a); \
(a) = (b); \
(a) = (b); \
...
@@ -642,35 +642,35 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size, void* buf
...
@@ -642,35 +642,35 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size, void* buf
switch
(
type
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_UINT
:
{
case
TSDB_DATA_TYPE_UINT
:
{
SWAP
(
*
(
int32_t
*
)(
pLeft
),
*
(
int32_t
*
)(
pRight
),
int32_t
);
T
SWAP
(
*
(
int32_t
*
)(
pLeft
),
*
(
int32_t
*
)(
pRight
),
int32_t
);
break
;
break
;
}
}
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
SWAP
(
*
(
int64_t
*
)(
pLeft
),
*
(
int64_t
*
)(
pRight
),
int64_t
);
T
SWAP
(
*
(
int64_t
*
)(
pLeft
),
*
(
int64_t
*
)(
pRight
),
int64_t
);
break
;
break
;
}
}
case
TSDB_DATA_TYPE_DOUBLE
:
{
case
TSDB_DATA_TYPE_DOUBLE
:
{
SWAP
(
*
(
double
*
)(
pLeft
),
*
(
double
*
)(
pRight
),
double
);
T
SWAP
(
*
(
double
*
)(
pLeft
),
*
(
double
*
)(
pRight
),
double
);
break
;
break
;
}
}
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_USMALLINT
:
{
case
TSDB_DATA_TYPE_USMALLINT
:
{
SWAP
(
*
(
int16_t
*
)(
pLeft
),
*
(
int16_t
*
)(
pRight
),
int16_t
);
T
SWAP
(
*
(
int16_t
*
)(
pLeft
),
*
(
int16_t
*
)(
pRight
),
int16_t
);
break
;
break
;
}
}
case
TSDB_DATA_TYPE_FLOAT
:
{
case
TSDB_DATA_TYPE_FLOAT
:
{
SWAP
(
*
(
float
*
)(
pLeft
),
*
(
float
*
)(
pRight
),
float
);
T
SWAP
(
*
(
float
*
)(
pLeft
),
*
(
float
*
)(
pRight
),
float
);
break
;
break
;
}
}
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_UTINYINT
:
{
case
TSDB_DATA_TYPE_UTINYINT
:
{
SWAP
(
*
(
int8_t
*
)(
pLeft
),
*
(
int8_t
*
)(
pRight
),
int8_t
);
T
SWAP
(
*
(
int8_t
*
)(
pLeft
),
*
(
int8_t
*
)(
pRight
),
int8_t
);
break
;
break
;
}
}
...
...
source/dnode/mgmt/impl/src/dndVnodes.c
浏览文件 @
92bef71e
...
@@ -910,11 +910,11 @@ static int32_t dndInitVnodeWorkers(SDnode *pDnode) {
...
@@ -910,11 +910,11 @@ static int32_t dndInitVnodeWorkers(SDnode *pDnode) {
SVnodesMgmt
*
pMgmt
=
&
pDnode
->
vmgmt
;
SVnodesMgmt
*
pMgmt
=
&
pDnode
->
vmgmt
;
int32_t
maxFetchThreads
=
4
;
int32_t
maxFetchThreads
=
4
;
int32_t
minFetchThreads
=
MIN
(
maxFetchThreads
,
pDnode
->
env
.
numOfCores
);
int32_t
minFetchThreads
=
T
MIN
(
maxFetchThreads
,
pDnode
->
env
.
numOfCores
);
int32_t
minQueryThreads
=
MAX
((
int32_t
)(
pDnode
->
env
.
numOfCores
*
pDnode
->
cfg
.
ratioOfQueryCores
),
1
);
int32_t
minQueryThreads
=
T
MAX
((
int32_t
)(
pDnode
->
env
.
numOfCores
*
pDnode
->
cfg
.
ratioOfQueryCores
),
1
);
int32_t
maxQueryThreads
=
minQueryThreads
;
int32_t
maxQueryThreads
=
minQueryThreads
;
int32_t
maxWriteThreads
=
MAX
(
pDnode
->
env
.
numOfCores
,
1
);
int32_t
maxWriteThreads
=
T
MAX
(
pDnode
->
env
.
numOfCores
,
1
);
int32_t
maxSyncThreads
=
MAX
(
pDnode
->
env
.
numOfCores
/
2
,
1
);
int32_t
maxSyncThreads
=
T
MAX
(
pDnode
->
env
.
numOfCores
/
2
,
1
);
SWorkerPool
*
pPool
=
&
pMgmt
->
queryPool
;
SWorkerPool
*
pPool
=
&
pMgmt
->
queryPool
;
pPool
->
name
=
"vnode-query"
;
pPool
->
name
=
"vnode-query"
;
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
92bef71e
...
@@ -261,7 +261,7 @@ static int32_t mndSaveQueryStreamList(SConnObj *pConn, SHeartBeatReq *pReq) {
...
@@ -261,7 +261,7 @@ static int32_t mndSaveQueryStreamList(SConnObj *pConn, SHeartBeatReq *pReq) {
pConn
->
pQueries
=
calloc
(
sizeof
(
SQueryDesc
),
QUERY_SAVE_SIZE
);
pConn
->
pQueries
=
calloc
(
sizeof
(
SQueryDesc
),
QUERY_SAVE_SIZE
);
}
}
pConn
->
numOfQueries
=
MIN
(
QUERY_SAVE_SIZE
,
numOfQueries
);
pConn
->
numOfQueries
=
T
MIN
(
QUERY_SAVE_SIZE
,
numOfQueries
);
int32_t
saveSize
=
pConn
->
numOfQueries
*
sizeof
(
SQueryDesc
);
int32_t
saveSize
=
pConn
->
numOfQueries
*
sizeof
(
SQueryDesc
);
if
(
saveSize
>
0
&&
pConn
->
pQueries
!=
NULL
)
{
if
(
saveSize
>
0
&&
pConn
->
pQueries
!=
NULL
)
{
...
...
source/dnode/mnode/impl/src/mndSync.c
浏览文件 @
92bef71e
...
@@ -56,7 +56,7 @@ static int32_t mndRestoreWal(SMnode *pMnode) {
...
@@ -56,7 +56,7 @@ static int32_t mndRestoreWal(SMnode *pMnode) {
int64_t
last
=
walGetLastVer
(
pWal
);
int64_t
last
=
walGetLastVer
(
pWal
);
mDebug
(
"start to restore sdb wal, sdb ver:%"
PRId64
", wal first:%"
PRId64
" last:%"
PRId64
,
lastSdbVer
,
first
,
last
);
mDebug
(
"start to restore sdb wal, sdb ver:%"
PRId64
", wal first:%"
PRId64
" last:%"
PRId64
,
lastSdbVer
,
first
,
last
);
first
=
MAX
(
lastSdbVer
+
1
,
first
);
first
=
T
MAX
(
lastSdbVer
+
1
,
first
);
for
(
int64_t
ver
=
first
;
ver
>=
0
&&
ver
<=
last
;
++
ver
)
{
for
(
int64_t
ver
=
first
;
ver
>=
0
&&
ver
<=
last
;
++
ver
)
{
if
(
walReadWithHandle
(
pHandle
,
ver
)
<
0
)
{
if
(
walReadWithHandle
(
pHandle
,
ver
)
<
0
)
{
mError
(
"failed to read by wal handle since %s, ver:%"
PRId64
,
terrstr
(),
ver
);
mError
(
"failed to read by wal handle since %s, ver:%"
PRId64
,
terrstr
(),
ver
);
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
92bef71e
...
@@ -459,7 +459,7 @@ static bool mndGetVgroupMaxReplicaFp(SMnode *pMnode, void *pObj, void *p1, void
...
@@ -459,7 +459,7 @@ static bool mndGetVgroupMaxReplicaFp(SMnode *pMnode, void *pObj, void *p1, void
int32_t
*
pNumOfVgroups
=
p3
;
int32_t
*
pNumOfVgroups
=
p3
;
if
(
pVgroup
->
dbUid
==
uid
)
{
if
(
pVgroup
->
dbUid
==
uid
)
{
*
pReplica
=
MAX
(
*
pReplica
,
pVgroup
->
replica
);
*
pReplica
=
T
MAX
(
*
pReplica
,
pVgroup
->
replica
);
(
*
pNumOfVgroups
)
++
;
(
*
pNumOfVgroups
)
++
;
}
}
...
...
source/dnode/mnode/sdb/src/sdbHash.c
浏览文件 @
92bef71e
...
@@ -162,10 +162,10 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
...
@@ -162,10 +162,10 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
}
}
if
(
pSdb
->
keyTypes
[
pRow
->
type
]
==
SDB_KEY_INT32
)
{
if
(
pSdb
->
keyTypes
[
pRow
->
type
]
==
SDB_KEY_INT32
)
{
pSdb
->
maxId
[
pRow
->
type
]
=
MAX
(
pSdb
->
maxId
[
pRow
->
type
],
*
((
int32_t
*
)
pRow
->
pObj
));
pSdb
->
maxId
[
pRow
->
type
]
=
T
MAX
(
pSdb
->
maxId
[
pRow
->
type
],
*
((
int32_t
*
)
pRow
->
pObj
));
}
}
if
(
pSdb
->
keyTypes
[
pRow
->
type
]
==
SDB_KEY_INT64
)
{
if
(
pSdb
->
keyTypes
[
pRow
->
type
]
==
SDB_KEY_INT64
)
{
pSdb
->
maxId
[
pRow
->
type
]
=
MAX
(
pSdb
->
maxId
[
pRow
->
type
],
*
((
int32_t
*
)
pRow
->
pObj
));
pSdb
->
maxId
[
pRow
->
type
]
=
T
MAX
(
pSdb
->
maxId
[
pRow
->
type
],
*
((
int32_t
*
)
pRow
->
pObj
));
}
}
pSdb
->
tableVer
[
pRow
->
type
]
++
;
pSdb
->
tableVer
[
pRow
->
type
]
++
;
...
@@ -420,13 +420,13 @@ int32_t sdbGetMaxId(SSdb *pSdb, ESdbType type) {
...
@@ -420,13 +420,13 @@ int32_t sdbGetMaxId(SSdb *pSdb, ESdbType type) {
while
(
ppRow
!=
NULL
)
{
while
(
ppRow
!=
NULL
)
{
SSdbRow
*
pRow
=
*
ppRow
;
SSdbRow
*
pRow
=
*
ppRow
;
int32_t
id
=
*
(
int32_t
*
)
pRow
->
pObj
;
int32_t
id
=
*
(
int32_t
*
)
pRow
->
pObj
;
maxId
=
MAX
(
id
,
maxId
);
maxId
=
T
MAX
(
id
,
maxId
);
ppRow
=
taosHashIterate
(
hash
,
ppRow
);
ppRow
=
taosHashIterate
(
hash
,
ppRow
);
}
}
taosRUnLockLatch
(
pLock
);
taosRUnLockLatch
(
pLock
);
maxId
=
MAX
(
maxId
,
pSdb
->
maxId
[
type
]);
maxId
=
T
MAX
(
maxId
,
pSdb
->
maxId
[
type
]);
return
maxId
+
1
;
return
maxId
+
1
;
}
}
...
...
source/dnode/vnode/src/tsdb/tsdbCompact.c
浏览文件 @
92bef71e
...
@@ -459,7 +459,7 @@ static int tsdbCompactMeta(STsdbRepo *pRepo) {
...
@@ -459,7 +459,7 @@ static int tsdbCompactMeta(STsdbRepo *pRepo) {
while (true) {
while (true) {
if (pReadh->pDCols[0]->numOfRows - ridx == 0) break;
if (pReadh->pDCols[0]->numOfRows - ridx == 0) break;
int rowsToMerge = MIN(pReadh->pDCols[0]->numOfRows - ridx, defaultRows - pComph->pDataCols->numOfRows);
int rowsToMerge =
T
MIN(pReadh->pDCols[0]->numOfRows - ridx, defaultRows - pComph->pDataCols->numOfRows);
tdMergeDataCols(pComph->pDataCols, pReadh->pDCols[0], rowsToMerge, &ridx, pCfg->update != TD_ROW_PARTIAL_UPDATE);
tdMergeDataCols(pComph->pDataCols, pReadh->pDCols[0], rowsToMerge, &ridx, pCfg->update != TD_ROW_PARTIAL_UPDATE);
...
...
source/dnode/vnode/src/tsdb/tsdbFS.c
浏览文件 @
92bef71e
...
@@ -836,7 +836,7 @@ static int tsdbScanAndTryFixFS(STsdb *pRepo) {
...
@@ -836,7 +836,7 @@ static int tsdbScanAndTryFixFS(STsdb *pRepo) {
// return -1;
// return -1;
// }
// }
// maxBufSize = MAX(maxBufSize, rInfo.size);
// maxBufSize =
T
MAX(maxBufSize, rInfo.size);
// if (tsdbSeekMFile(pMFile, rInfo.size, SEEK_CUR) < 0) {
// if (tsdbSeekMFile(pMFile, rInfo.size, SEEK_CUR) < 0) {
// tsdbError("vgId:%d failed to lseek file %s since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pMFile),
// tsdbError("vgId:%d failed to lseek file %s since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pMFile),
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
92bef71e
...
@@ -153,8 +153,8 @@ int tsdbLoadDataFromCache(STable *pTable, SSkipListIterator *pIter, TSKEY maxKey
...
@@ -153,8 +153,8 @@ int tsdbLoadDataFromCache(STable *pTable, SSkipListIterator *pIter, TSKEY maxKey
if
(
fKey
==
INT64_MAX
&&
rowKey
==
INT64_MAX
)
break
;
if
(
fKey
==
INT64_MAX
&&
rowKey
==
INT64_MAX
)
break
;
if
(
fKey
<
rowKey
)
{
if
(
fKey
<
rowKey
)
{
pMergeInfo
->
keyFirst
=
MIN
(
pMergeInfo
->
keyFirst
,
fKey
);
pMergeInfo
->
keyFirst
=
T
MIN
(
pMergeInfo
->
keyFirst
,
fKey
);
pMergeInfo
->
keyLast
=
MAX
(
pMergeInfo
->
keyLast
,
fKey
);
pMergeInfo
->
keyLast
=
T
MAX
(
pMergeInfo
->
keyLast
,
fKey
);
filterIter
++
;
filterIter
++
;
if
(
filterIter
>=
nFilterKeys
)
{
if
(
filterIter
>=
nFilterKeys
)
{
...
@@ -170,8 +170,8 @@ int tsdbLoadDataFromCache(STable *pTable, SSkipListIterator *pIter, TSKEY maxKey
...
@@ -170,8 +170,8 @@ int tsdbLoadDataFromCache(STable *pTable, SSkipListIterator *pIter, TSKEY maxKey
if
(
pCols
&&
pMergeInfo
->
nOperations
>=
pCols
->
maxPoints
)
break
;
if
(
pCols
&&
pMergeInfo
->
nOperations
>=
pCols
->
maxPoints
)
break
;
pMergeInfo
->
rowsInserted
++
;
pMergeInfo
->
rowsInserted
++
;
pMergeInfo
->
nOperations
++
;
pMergeInfo
->
nOperations
++
;
pMergeInfo
->
keyFirst
=
MIN
(
pMergeInfo
->
keyFirst
,
rowKey
);
pMergeInfo
->
keyFirst
=
T
MIN
(
pMergeInfo
->
keyFirst
,
rowKey
);
pMergeInfo
->
keyLast
=
MAX
(
pMergeInfo
->
keyLast
,
rowKey
);
pMergeInfo
->
keyLast
=
T
MAX
(
pMergeInfo
->
keyLast
,
rowKey
);
tsdbAppendTableRowToCols
(
pTable
,
pCols
,
&
pSchema
,
row
);
tsdbAppendTableRowToCols
(
pTable
,
pCols
,
&
pSchema
,
row
);
}
}
...
@@ -196,12 +196,12 @@ int tsdbLoadDataFromCache(STable *pTable, SSkipListIterator *pIter, TSKEY maxKey
...
@@ -196,12 +196,12 @@ int tsdbLoadDataFromCache(STable *pTable, SSkipListIterator *pIter, TSKEY maxKey
if
(
pCols
&&
pMergeInfo
->
nOperations
>=
pCols
->
maxPoints
)
break
;
if
(
pCols
&&
pMergeInfo
->
nOperations
>=
pCols
->
maxPoints
)
break
;
pMergeInfo
->
rowsUpdated
++
;
pMergeInfo
->
rowsUpdated
++
;
pMergeInfo
->
nOperations
++
;
pMergeInfo
->
nOperations
++
;
pMergeInfo
->
keyFirst
=
MIN
(
pMergeInfo
->
keyFirst
,
rowKey
);
pMergeInfo
->
keyFirst
=
T
MIN
(
pMergeInfo
->
keyFirst
,
rowKey
);
pMergeInfo
->
keyLast
=
MAX
(
pMergeInfo
->
keyLast
,
rowKey
);
pMergeInfo
->
keyLast
=
T
MAX
(
pMergeInfo
->
keyLast
,
rowKey
);
tsdbAppendTableRowToCols
(
pTable
,
pCols
,
&
pSchema
,
row
);
tsdbAppendTableRowToCols
(
pTable
,
pCols
,
&
pSchema
,
row
);
}
else
{
}
else
{
pMergeInfo
->
keyFirst
=
MIN
(
pMergeInfo
->
keyFirst
,
fKey
);
pMergeInfo
->
keyFirst
=
T
MIN
(
pMergeInfo
->
keyFirst
,
fKey
);
pMergeInfo
->
keyLast
=
MAX
(
pMergeInfo
->
keyLast
,
fKey
);
pMergeInfo
->
keyLast
=
T
MAX
(
pMergeInfo
->
keyLast
,
fKey
);
}
}
}
}
...
@@ -714,8 +714,8 @@ int tsdbLoadDataFromCache(STable *pTable, SSkipListIterator *pIter, TSKEY maxKey
...
@@ -714,8 +714,8 @@ int tsdbLoadDataFromCache(STable *pTable, SSkipListIterator *pIter, TSKEY maxKey
if (fKey == INT64_MAX && rowKey == INT64_MAX) break;
if (fKey == INT64_MAX && rowKey == INT64_MAX) break;
if (fKey < rowKey) {
if (fKey < rowKey) {
pMergeInfo->keyFirst = MIN(pMergeInfo->keyFirst, fKey);
pMergeInfo->keyFirst =
T
MIN(pMergeInfo->keyFirst, fKey);
pMergeInfo->keyLast = MAX(pMergeInfo->keyLast, fKey);
pMergeInfo->keyLast =
T
MAX(pMergeInfo->keyLast, fKey);
filterIter++;
filterIter++;
if (filterIter >= nFilterKeys) {
if (filterIter >= nFilterKeys) {
...
@@ -731,8 +731,8 @@ int tsdbLoadDataFromCache(STable *pTable, SSkipListIterator *pIter, TSKEY maxKey
...
@@ -731,8 +731,8 @@ int tsdbLoadDataFromCache(STable *pTable, SSkipListIterator *pIter, TSKEY maxKey
if (pCols && pMergeInfo->nOperations >= pCols->maxPoints) break;
if (pCols && pMergeInfo->nOperations >= pCols->maxPoints) break;
pMergeInfo->rowsInserted++;
pMergeInfo->rowsInserted++;
pMergeInfo->nOperations++;
pMergeInfo->nOperations++;
pMergeInfo->keyFirst = MIN(pMergeInfo->keyFirst, rowKey);
pMergeInfo->keyFirst =
T
MIN(pMergeInfo->keyFirst, rowKey);
pMergeInfo->keyLast = MAX(pMergeInfo->keyLast, rowKey);
pMergeInfo->keyLast =
T
MAX(pMergeInfo->keyLast, rowKey);
tsdbAppendTableRowToCols(pTable, pCols, &pSchema, row);
tsdbAppendTableRowToCols(pTable, pCols, &pSchema, row);
}
}
...
@@ -757,12 +757,12 @@ int tsdbLoadDataFromCache(STable *pTable, SSkipListIterator *pIter, TSKEY maxKey
...
@@ -757,12 +757,12 @@ int tsdbLoadDataFromCache(STable *pTable, SSkipListIterator *pIter, TSKEY maxKey
if (pCols && pMergeInfo->nOperations >= pCols->maxPoints) break;
if (pCols && pMergeInfo->nOperations >= pCols->maxPoints) break;
pMergeInfo->rowsUpdated++;
pMergeInfo->rowsUpdated++;
pMergeInfo->nOperations++;
pMergeInfo->nOperations++;
pMergeInfo->keyFirst = MIN(pMergeInfo->keyFirst, rowKey);
pMergeInfo->keyFirst =
T
MIN(pMergeInfo->keyFirst, rowKey);
pMergeInfo->keyLast = MAX(pMergeInfo->keyLast, rowKey);
pMergeInfo->keyLast =
T
MAX(pMergeInfo->keyLast, rowKey);
tsdbAppendTableRowToCols(pTable, pCols, &pSchema, row);
tsdbAppendTableRowToCols(pTable, pCols, &pSchema, row);
} else {
} else {
pMergeInfo->keyFirst = MIN(pMergeInfo->keyFirst, fKey);
pMergeInfo->keyFirst =
T
MIN(pMergeInfo->keyFirst, fKey);
pMergeInfo->keyLast = MAX(pMergeInfo->keyLast, fKey);
pMergeInfo->keyLast =
T
MAX(pMergeInfo->keyLast, fKey);
}
}
}
}
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
92bef71e
...
@@ -504,7 +504,7 @@ void tsdbResetQueryHandle(tsdbReadHandleT queryHandle, STsdbQueryCond *pCond) {
...
@@ -504,7 +504,7 @@ void tsdbResetQueryHandle(tsdbReadHandleT queryHandle, STsdbQueryCond *pCond) {
if
(
emptyQueryTimewindow
(
pTsdbReadHandle
))
{
if
(
emptyQueryTimewindow
(
pTsdbReadHandle
))
{
if
(
pCond
->
order
!=
pTsdbReadHandle
->
order
)
{
if
(
pCond
->
order
!=
pTsdbReadHandle
->
order
)
{
pTsdbReadHandle
->
order
=
pCond
->
order
;
pTsdbReadHandle
->
order
=
pCond
->
order
;
SWAP
(
pTsdbReadHandle
->
window
.
skey
,
pTsdbReadHandle
->
window
.
ekey
,
int64_t
);
T
SWAP
(
pTsdbReadHandle
->
window
.
skey
,
pTsdbReadHandle
->
window
.
ekey
,
int64_t
);
}
}
return
;
return
;
...
@@ -971,7 +971,7 @@ static bool hasMoreDataInCache(STsdbReadHandle* pHandle) {
...
@@ -971,7 +971,7 @@ static bool hasMoreDataInCache(STsdbReadHandle* pHandle) {
pHandle
->
cur
.
mixBlock
=
true
;
pHandle
->
cur
.
mixBlock
=
true
;
if
(
!
ASCENDING_TRAVERSE
(
pHandle
->
order
))
{
if
(
!
ASCENDING_TRAVERSE
(
pHandle
->
order
))
{
SWAP
(
win
->
skey
,
win
->
ekey
,
TSKEY
);
T
SWAP
(
win
->
skey
,
win
->
ekey
,
TSKEY
);
}
}
return
true
;
return
true
;
...
@@ -1074,8 +1074,8 @@ static int32_t loadBlockInfo(STsdbReadHandle * pTsdbReadHandle, int32_t index, i
...
@@ -1074,8 +1074,8 @@ static int32_t loadBlockInfo(STsdbReadHandle * pTsdbReadHandle, int32_t index, i
assert
(
pCheckInfo
->
lastKey
>=
pTsdbReadHandle
->
window
.
ekey
&&
pTsdbReadHandle
->
window
.
skey
>=
pTsdbReadHandle
->
window
.
ekey
);
assert
(
pCheckInfo
->
lastKey
>=
pTsdbReadHandle
->
window
.
ekey
&&
pTsdbReadHandle
->
window
.
skey
>=
pTsdbReadHandle
->
window
.
ekey
);
}
}
s
=
MIN
(
pCheckInfo
->
lastKey
,
pTsdbReadHandle
->
window
.
ekey
);
s
=
T
MIN
(
pCheckInfo
->
lastKey
,
pTsdbReadHandle
->
window
.
ekey
);
e
=
MAX
(
pCheckInfo
->
lastKey
,
pTsdbReadHandle
->
window
.
ekey
);
e
=
T
MAX
(
pCheckInfo
->
lastKey
,
pTsdbReadHandle
->
window
.
ekey
);
// discard the unqualified data block based on the query time window
// discard the unqualified data block based on the query time window
int32_t
start
=
binarySearchForBlock
(
pCompInfo
->
blocks
,
compIndex
->
numOfBlocks
,
s
,
TSDB_ORDER_ASC
);
int32_t
start
=
binarySearchForBlock
(
pCompInfo
->
blocks
,
compIndex
->
numOfBlocks
,
s
,
TSDB_ORDER_ASC
);
...
@@ -1240,7 +1240,7 @@ static int32_t handleDataMergeIfNeeded(STsdbReadHandle* pTsdbReadHandle, SBlock*
...
@@ -1240,7 +1240,7 @@ static int32_t handleDataMergeIfNeeded(STsdbReadHandle* pTsdbReadHandle, SBlock*
// update the last key value
// update the last key value
pCheckInfo
->
lastKey
=
cur
->
win
.
ekey
+
step
;
pCheckInfo
->
lastKey
=
cur
->
win
.
ekey
+
step
;
if
(
!
ASCENDING_TRAVERSE
(
pTsdbReadHandle
->
order
))
{
if
(
!
ASCENDING_TRAVERSE
(
pTsdbReadHandle
->
order
))
{
SWAP
(
cur
->
win
.
skey
,
cur
->
win
.
ekey
,
TSKEY
);
T
SWAP
(
cur
->
win
.
skey
,
cur
->
win
.
ekey
,
TSKEY
);
}
}
cur
->
mixBlock
=
true
;
cur
->
mixBlock
=
true
;
...
@@ -1795,7 +1795,7 @@ static void copyAllRemainRowsFromFileBlock(STsdbReadHandle* pTsdbReadHandle, STa
...
@@ -1795,7 +1795,7 @@ static void copyAllRemainRowsFromFileBlock(STsdbReadHandle* pTsdbReadHandle, STa
int32_t
end
=
endPos
;
int32_t
end
=
endPos
;
if
(
!
ASCENDING_TRAVERSE
(
pTsdbReadHandle
->
order
))
{
if
(
!
ASCENDING_TRAVERSE
(
pTsdbReadHandle
->
order
))
{
SWAP
(
start
,
end
,
int32_t
);
T
SWAP
(
start
,
end
,
int32_t
);
}
}
assert
(
pTsdbReadHandle
->
outputCapacity
>=
(
end
-
start
+
1
));
assert
(
pTsdbReadHandle
->
outputCapacity
>=
(
end
-
start
+
1
));
...
@@ -2020,7 +2020,7 @@ static void doMergeTwoLevelData(STsdbReadHandle* pTsdbReadHandle, STableCheckInf
...
@@ -2020,7 +2020,7 @@ static void doMergeTwoLevelData(STsdbReadHandle* pTsdbReadHandle, STableCheckInf
((
pos
<
endPos
||
cur
->
lastKey
<
pTsdbReadHandle
->
window
.
ekey
)
&&
!
ASCENDING_TRAVERSE
(
pTsdbReadHandle
->
order
)));
((
pos
<
endPos
||
cur
->
lastKey
<
pTsdbReadHandle
->
window
.
ekey
)
&&
!
ASCENDING_TRAVERSE
(
pTsdbReadHandle
->
order
)));
if
(
!
ASCENDING_TRAVERSE
(
pTsdbReadHandle
->
order
))
{
if
(
!
ASCENDING_TRAVERSE
(
pTsdbReadHandle
->
order
))
{
SWAP
(
cur
->
win
.
skey
,
cur
->
win
.
ekey
,
TSKEY
);
T
SWAP
(
cur
->
win
.
skey
,
cur
->
win
.
ekey
,
TSKEY
);
}
}
moveDataToFront
(
pTsdbReadHandle
,
numOfRows
,
numOfCols
);
moveDataToFront
(
pTsdbReadHandle
,
numOfRows
,
numOfCols
);
...
...
source/dnode/vnode/src/vnd/vnodeArenaMAImpl.c
浏览文件 @
92bef71e
...
@@ -68,7 +68,7 @@ void *vmaMalloc(SVMemAllocator *pVMA, uint64_t size) {
...
@@ -68,7 +68,7 @@ void *vmaMalloc(SVMemAllocator *pVMA, uint64_t size) {
void
*
ptr
;
void
*
ptr
;
if
(
pNode
->
size
<
POINTER_DISTANCE
(
pNode
->
ptr
,
pNode
->
data
)
+
size
)
{
if
(
pNode
->
size
<
POINTER_DISTANCE
(
pNode
->
ptr
,
pNode
->
data
)
+
size
)
{
uint64_t
capacity
=
MAX
(
pVMA
->
ssize
,
size
);
uint64_t
capacity
=
T
MAX
(
pVMA
->
ssize
,
size
);
pNode
=
vArenaNodeNew
(
capacity
);
pNode
=
vArenaNodeNew
(
capacity
);
if
(
pNode
==
NULL
)
{
if
(
pNode
==
NULL
)
{
// TODO: handle error
// TODO: handle error
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
92bef71e
...
@@ -303,7 +303,7 @@ SSDataBlock* createOutputBuf(SExprInfo* pExpr, int32_t numOfOutput, int32_t numO
...
@@ -303,7 +303,7 @@ SSDataBlock* createOutputBuf(SExprInfo* pExpr, int32_t numOfOutput, int32_t numO
idata
.
info
.
bytes
=
pExpr
[
i
].
base
.
resSchema
.
bytes
;
idata
.
info
.
bytes
=
pExpr
[
i
].
base
.
resSchema
.
bytes
;
idata
.
info
.
colId
=
pExpr
[
i
].
base
.
resSchema
.
colId
;
idata
.
info
.
colId
=
pExpr
[
i
].
base
.
resSchema
.
colId
;
int32_t
size
=
MAX
(
idata
.
info
.
bytes
*
numOfRows
,
minSize
);
int32_t
size
=
T
MAX
(
idata
.
info
.
bytes
*
numOfRows
,
minSize
);
idata
.
pData
=
calloc
(
1
,
size
);
// at least to hold a pointer on x64 platform
idata
.
pData
=
calloc
(
1
,
size
);
// at least to hold a pointer on x64 platform
taosArrayPush
(
res
->
pDataBlock
,
&
idata
);
taosArrayPush
(
res
->
pDataBlock
,
&
idata
);
}
}
...
@@ -328,7 +328,7 @@ SSDataBlock* createOutputBuf_rv(SArray* pExprInfo, int32_t numOfRows) {
...
@@ -328,7 +328,7 @@ SSDataBlock* createOutputBuf_rv(SArray* pExprInfo, int32_t numOfRows) {
idata
.
info
.
bytes
=
pExpr
->
base
.
resSchema
.
bytes
;
idata
.
info
.
bytes
=
pExpr
->
base
.
resSchema
.
bytes
;
idata
.
info
.
colId
=
pExpr
->
base
.
resSchema
.
colId
;
idata
.
info
.
colId
=
pExpr
->
base
.
resSchema
.
colId
;
int32_t
size
=
MAX
(
idata
.
info
.
bytes
*
numOfRows
,
minSize
);
int32_t
size
=
T
MAX
(
idata
.
info
.
bytes
*
numOfRows
,
minSize
);
idata
.
pData
=
calloc
(
1
,
size
);
// at least to hold a pointer on x64 platform
idata
.
pData
=
calloc
(
1
,
size
);
// at least to hold a pointer on x64 platform
taosArrayPush
(
res
->
pDataBlock
,
&
idata
);
taosArrayPush
(
res
->
pDataBlock
,
&
idata
);
}
}
...
@@ -2678,7 +2678,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableReq* pQueryMsg, bool
...
@@ -2678,7 +2678,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableReq* pQueryMsg, bool
pQueryAttr
->
order
.
order
=
TSDB_ORDER_ASC
;
pQueryAttr
->
order
.
order
=
TSDB_ORDER_ASC
;
if
(
pQueryAttr
->
window
.
skey
>
pQueryAttr
->
window
.
ekey
)
{
if
(
pQueryAttr
->
window
.
skey
>
pQueryAttr
->
window
.
ekey
)
{
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
T
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
}
}
pQueryAttr
->
needReverseScan
=
false
;
pQueryAttr
->
needReverseScan
=
false
;
...
@@ -2688,7 +2688,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableReq* pQueryMsg, bool
...
@@ -2688,7 +2688,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableReq* pQueryMsg, bool
if
(
pQueryAttr
->
groupbyColumn
&&
pQueryAttr
->
order
.
order
==
TSDB_ORDER_DESC
)
{
if
(
pQueryAttr
->
groupbyColumn
&&
pQueryAttr
->
order
.
order
==
TSDB_ORDER_DESC
)
{
pQueryAttr
->
order
.
order
=
TSDB_ORDER_ASC
;
pQueryAttr
->
order
.
order
=
TSDB_ORDER_ASC
;
if
(
pQueryAttr
->
window
.
skey
>
pQueryAttr
->
window
.
ekey
)
{
if
(
pQueryAttr
->
window
.
skey
>
pQueryAttr
->
window
.
ekey
)
{
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
T
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
}
}
pQueryAttr
->
needReverseScan
=
false
;
pQueryAttr
->
needReverseScan
=
false
;
...
@@ -2699,7 +2699,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableReq* pQueryMsg, bool
...
@@ -2699,7 +2699,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableReq* pQueryMsg, bool
if
(
pQueryAttr
->
pointInterpQuery
&&
pQueryAttr
->
interval
.
interval
==
0
)
{
if
(
pQueryAttr
->
pointInterpQuery
&&
pQueryAttr
->
interval
.
interval
==
0
)
{
if
(
!
QUERY_IS_ASC_QUERY
(
pQueryAttr
))
{
if
(
!
QUERY_IS_ASC_QUERY
(
pQueryAttr
))
{
//qDebug(msg, pQInfo->qId, "interp", pQueryAttr->order.order, TSDB_ORDER_ASC, pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey);
//qDebug(msg, pQInfo->qId, "interp", pQueryAttr->order.order, TSDB_ORDER_ASC, pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey);
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
T
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
}
}
pQueryAttr
->
order
.
order
=
TSDB_ORDER_ASC
;
pQueryAttr
->
order
.
order
=
TSDB_ORDER_ASC
;
...
@@ -2712,7 +2712,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableReq* pQueryMsg, bool
...
@@ -2712,7 +2712,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableReq* pQueryMsg, bool
//qDebug(msg, pQInfo->qId, "only-first", pQueryAttr->order.order, TSDB_ORDER_ASC, pQueryAttr->window.skey,
//qDebug(msg, pQInfo->qId, "only-first", pQueryAttr->order.order, TSDB_ORDER_ASC, pQueryAttr->window.skey,
// pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey);
// pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey);
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
T
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
doUpdateLastKey
(
pQueryAttr
);
doUpdateLastKey
(
pQueryAttr
);
}
}
...
@@ -2723,7 +2723,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableReq* pQueryMsg, bool
...
@@ -2723,7 +2723,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableReq* pQueryMsg, bool
//qDebug(msg, pQInfo->qId, "only-last", pQueryAttr->order.order, TSDB_ORDER_DESC, pQueryAttr->window.skey,
//qDebug(msg, pQInfo->qId, "only-last", pQueryAttr->order.order, TSDB_ORDER_DESC, pQueryAttr->window.skey,
// pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey);
// pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey);
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
T
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
doUpdateLastKey
(
pQueryAttr
);
doUpdateLastKey
(
pQueryAttr
);
}
}
...
@@ -2738,7 +2738,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableReq* pQueryMsg, bool
...
@@ -2738,7 +2738,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableReq* pQueryMsg, bool
//qDebug(msg, pQInfo->qId, "only-first stable", pQueryAttr->order.order, TSDB_ORDER_ASC,
//qDebug(msg, pQInfo->qId, "only-first stable", pQueryAttr->order.order, TSDB_ORDER_ASC,
// pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey);
// pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey);
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
T
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
doUpdateLastKey
(
pQueryAttr
);
doUpdateLastKey
(
pQueryAttr
);
}
}
...
@@ -2749,7 +2749,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableReq* pQueryMsg, bool
...
@@ -2749,7 +2749,7 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableReq* pQueryMsg, bool
//qDebug(msg, pQInfo->qId, "only-last stable", pQueryAttr->order.order, TSDB_ORDER_DESC,
//qDebug(msg, pQInfo->qId, "only-last stable", pQueryAttr->order.order, TSDB_ORDER_DESC,
// pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey);
// pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey);
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
T
SWAP
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
,
TSKEY
);
doUpdateLastKey
(
pQueryAttr
);
doUpdateLastKey
(
pQueryAttr
);
}
}
...
@@ -2789,8 +2789,8 @@ static void getIntermediateBufInfo(STaskRuntimeEnv* pRuntimeEnv, int32_t* ps, in
...
@@ -2789,8 +2789,8 @@ static void getIntermediateBufInfo(STaskRuntimeEnv* pRuntimeEnv, int32_t* ps, in
static
bool
overlapWithTimeWindow
(
STaskAttr
*
pQueryAttr
,
SDataBlockInfo
*
pBlockInfo
)
{
static
bool
overlapWithTimeWindow
(
STaskAttr
*
pQueryAttr
,
SDataBlockInfo
*
pBlockInfo
)
{
STimeWindow
w
=
{
0
};
STimeWindow
w
=
{
0
};
TSKEY
sk
=
MIN
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
);
TSKEY
sk
=
T
MIN
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
);
TSKEY
ek
=
MAX
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
);
TSKEY
ek
=
T
MAX
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
);
if
(
QUERY_IS_ASC_QUERY
(
pQueryAttr
))
{
if
(
QUERY_IS_ASC_QUERY
(
pQueryAttr
))
{
getAlignQueryTimeWindow
(
pQueryAttr
,
pBlockInfo
->
window
.
skey
,
sk
,
ek
,
&
w
);
getAlignQueryTimeWindow
(
pQueryAttr
,
pBlockInfo
->
window
.
skey
,
sk
,
ek
,
&
w
);
...
@@ -3473,7 +3473,7 @@ static void updateTableQueryInfoForReverseScan(STableQueryInfo *pTableQueryInfo)
...
@@ -3473,7 +3473,7 @@ static void updateTableQueryInfoForReverseScan(STableQueryInfo *pTableQueryInfo)
return
;
return
;
}
}
SWAP
(
pTableQueryInfo
->
win
.
skey
,
pTableQueryInfo
->
win
.
ekey
,
TSKEY
);
T
SWAP
(
pTableQueryInfo
->
win
.
skey
,
pTableQueryInfo
->
win
.
ekey
,
TSKEY
);
pTableQueryInfo
->
lastKey
=
pTableQueryInfo
->
win
.
skey
;
pTableQueryInfo
->
lastKey
=
pTableQueryInfo
->
win
.
skey
;
SWITCH_ORDER
(
pTableQueryInfo
->
cur
.
order
);
SWITCH_ORDER
(
pTableQueryInfo
->
cur
.
order
);
...
@@ -4095,8 +4095,8 @@ void setIntervalQueryRange(STaskRuntimeEnv *pRuntimeEnv, TSKEY key) {
...
@@ -4095,8 +4095,8 @@ void setIntervalQueryRange(STaskRuntimeEnv *pRuntimeEnv, TSKEY key) {
*/
*/
STimeWindow
w
=
TSWINDOW_INITIALIZER
;
STimeWindow
w
=
TSWINDOW_INITIALIZER
;
TSKEY
sk
=
MIN
(
win
.
skey
,
win
.
ekey
);
TSKEY
sk
=
T
MIN
(
win
.
skey
,
win
.
ekey
);
TSKEY
ek
=
MAX
(
win
.
skey
,
win
.
ekey
);
TSKEY
ek
=
T
MAX
(
win
.
skey
,
win
.
ekey
);
getAlignQueryTimeWindow
(
pQueryAttr
,
win
.
skey
,
sk
,
ek
,
&
w
);
getAlignQueryTimeWindow
(
pQueryAttr
,
win
.
skey
,
sk
,
ek
,
&
w
);
// if (pResultRowInfo->prevSKey == TSKEY_INITIAL_VAL) {
// if (pResultRowInfo->prevSKey == TSKEY_INITIAL_VAL) {
...
@@ -4221,7 +4221,7 @@ static void updateNumOfRowsInResultRows(STaskRuntimeEnv* pRuntimeEnv, SQLFunctio
...
@@ -4221,7 +4221,7 @@ static void updateNumOfRowsInResultRows(STaskRuntimeEnv* pRuntimeEnv, SQLFunctio
}
}
// SResultRowEntryInfo* pCell = getResultCell(pResult, j, rowCellInfoOffset);
// SResultRowEntryInfo* pCell = getResultCell(pResult, j, rowCellInfoOffset);
// pResult->numOfRows = (uint16_t)(MAX(pResult->numOfRows, pCell->numOfRes));
// pResult->numOfRows = (uint16_t)(
T
MAX(pResult->numOfRows, pCell->numOfRes));
}
}
}
}
}
}
...
@@ -7147,8 +7147,8 @@ SOperatorInfo* createFillOperatorInfo(STaskRuntimeEnv* pRuntimeEnv, SOperatorInf
...
@@ -7147,8 +7147,8 @@ SOperatorInfo* createFillOperatorInfo(STaskRuntimeEnv* pRuntimeEnv, SOperatorInf
struct
SFillColInfo
*
pColInfo
=
createFillColInfo
(
pExpr
,
numOfOutput
,
pQueryAttr
->
fillVal
);
struct
SFillColInfo
*
pColInfo
=
createFillColInfo
(
pExpr
,
numOfOutput
,
pQueryAttr
->
fillVal
);
STimeWindow
w
=
TSWINDOW_INITIALIZER
;
STimeWindow
w
=
TSWINDOW_INITIALIZER
;
TSKEY
sk
=
MIN
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
);
TSKEY
sk
=
T
MIN
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
);
TSKEY
ek
=
MAX
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
);
TSKEY
ek
=
T
MAX
(
pQueryAttr
->
window
.
skey
,
pQueryAttr
->
window
.
ekey
);
getAlignQueryTimeWindow
(
pQueryAttr
,
pQueryAttr
->
window
.
skey
,
sk
,
ek
,
&
w
);
getAlignQueryTimeWindow
(
pQueryAttr
,
pQueryAttr
->
window
.
skey
,
sk
,
ek
,
&
w
);
pInfo
->
pFillInfo
=
pInfo
->
pFillInfo
=
...
...
source/libs/function/src/taggfunction.c
浏览文件 @
92bef71e
...
@@ -443,7 +443,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
...
@@ -443,7 +443,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
pInfo
->
intermediateBytes
=
(
int16_t
)
sizeof
(
SPercentileInfo
);
pInfo
->
intermediateBytes
=
(
int16_t
)
sizeof
(
SPercentileInfo
);
}
else
if
(
functionId
==
FUNCTION_LEASTSQR
)
{
}
else
if
(
functionId
==
FUNCTION_LEASTSQR
)
{
pInfo
->
type
=
TSDB_DATA_TYPE_BINARY
;
pInfo
->
type
=
TSDB_DATA_TYPE_BINARY
;
pInfo
->
bytes
=
MAX
(
AVG_FUNCTION_INTER_BUFFER_SIZE
,
sizeof
(
SLeastsquaresInfo
));
// string
pInfo
->
bytes
=
T
MAX
(
AVG_FUNCTION_INTER_BUFFER_SIZE
,
sizeof
(
SLeastsquaresInfo
));
// string
pInfo
->
intermediateBytes
=
pInfo
->
bytes
;
pInfo
->
intermediateBytes
=
pInfo
->
bytes
;
}
else
if
(
functionId
==
FUNCTION_FIRST_DST
||
functionId
==
FUNCTION_LAST_DST
)
{
}
else
if
(
functionId
==
FUNCTION_FIRST_DST
||
functionId
==
FUNCTION_LAST_DST
)
{
pInfo
->
type
=
TSDB_DATA_TYPE_BINARY
;
pInfo
->
type
=
TSDB_DATA_TYPE_BINARY
;
...
@@ -1331,7 +1331,7 @@ static void max_func_merge(SQLFunctionCtx *pCtx) {
...
@@ -1331,7 +1331,7 @@ static void max_func_merge(SQLFunctionCtx *pCtx) {
continue; \
continue; \
} \
} \
(num) += 1; \
(num) += 1; \
(r) += POW2(((type *)d)[i] - (delta)); \
(r) +=
T
POW2(((type *)d)[i] - (delta)); \
}
}
static
void
stddev_function
(
SQLFunctionCtx
*
pCtx
)
{
static
void
stddev_function
(
SQLFunctionCtx
*
pCtx
)
{
...
@@ -1370,7 +1370,7 @@ static void stddev_function(SQLFunctionCtx *pCtx) {
...
@@ -1370,7 +1370,7 @@ static void stddev_function(SQLFunctionCtx *pCtx) {
continue
;
continue
;
}
}
num
+=
1
;
num
+=
1
;
*
retVal
+=
POW2
(((
int32_t
*
)
pData
)[
i
]
-
avg
);
*
retVal
+=
T
POW2
(((
int32_t
*
)
pData
)[
i
]
-
avg
);
}
}
break
;
break
;
}
}
...
@@ -1484,7 +1484,7 @@ static void stddev_dst_function(SQLFunctionCtx *pCtx) {
...
@@ -1484,7 +1484,7 @@ static void stddev_dst_function(SQLFunctionCtx *pCtx) {
continue
;
continue
;
}
}
num
+=
1
;
num
+=
1
;
*
retVal
+=
POW2
(((
int32_t
*
)
pData
)[
i
]
-
avg
);
*
retVal
+=
T
POW2
(((
int32_t
*
)
pData
)[
i
]
-
avg
);
}
}
break
;
break
;
}
}
...
@@ -4210,8 +4210,8 @@ static void mergeTableBlockDist(SResultRowEntryInfo* pResInfo, const STableBlock
...
@@ -4210,8 +4210,8 @@ static void mergeTableBlockDist(SResultRowEntryInfo* pResInfo, const STableBlock
pDist
->
totalRows
+=
pSrc
->
totalRows
;
pDist
->
totalRows
+=
pSrc
->
totalRows
;
if
(
pResInfo
->
hasResult
==
DATA_SET_FLAG
)
{
if
(
pResInfo
->
hasResult
==
DATA_SET_FLAG
)
{
pDist
->
maxRows
=
MAX
(
pDist
->
maxRows
,
pSrc
->
maxRows
);
pDist
->
maxRows
=
T
MAX
(
pDist
->
maxRows
,
pSrc
->
maxRows
);
pDist
->
minRows
=
MIN
(
pDist
->
minRows
,
pSrc
->
minRows
);
pDist
->
minRows
=
T
MIN
(
pDist
->
minRows
,
pSrc
->
minRows
);
}
else
{
}
else
{
pDist
->
maxRows
=
pSrc
->
maxRows
;
pDist
->
maxRows
=
pSrc
->
maxRows
;
pDist
->
minRows
=
pSrc
->
minRows
;
pDist
->
minRows
=
pSrc
->
minRows
;
...
...
source/libs/function/src/tbinoperator.c
浏览文件 @
92bef71e
...
@@ -26,7 +26,7 @@ void calc_i32_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight
...
@@ -26,7 +26,7 @@ void calc_i32_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight
int32_t
*
pRight
=
(
int32_t
*
)
right
;
int32_t
*
pRight
=
(
int32_t
*
)
right
;
double
*
pOutput
=
(
double
*
)
output
;
double
*
pOutput
=
(
double
*
)
output
;
int32_t
i
=
(
order
==
TSDB_ORDER_ASC
)
?
0
:
MAX
(
numLeft
,
numRight
)
-
1
;
int32_t
i
=
(
order
==
TSDB_ORDER_ASC
)
?
0
:
T
MAX
(
numLeft
,
numRight
)
-
1
;
int32_t
step
=
(
order
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
int32_t
step
=
(
order
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
if
(
numLeft
==
numRight
)
{
if
(
numLeft
==
numRight
)
{
...
@@ -181,7 +181,7 @@ _getValueAddr_fn_t getVectorValueAddrFn(int32_t srcType) {
...
@@ -181,7 +181,7 @@ _getValueAddr_fn_t getVectorValueAddrFn(int32_t srcType) {
}
}
void
vectorAdd
(
SScalarFuncParam
*
pLeft
,
SScalarFuncParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
void
vectorAdd
(
SScalarFuncParam
*
pLeft
,
SScalarFuncParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
int32_t
i
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
0
:
MAX
(
pLeft
->
num
,
pRight
->
num
)
-
1
;
int32_t
i
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
0
:
T
MAX
(
pLeft
->
num
,
pRight
->
num
)
-
1
;
int32_t
step
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
int32_t
step
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
double
*
output
=
(
double
*
)
out
;
double
*
output
=
(
double
*
)
out
;
...
@@ -220,7 +220,7 @@ void vectorAdd(SScalarFuncParam* pLeft, SScalarFuncParam* pRight, void *out, int
...
@@ -220,7 +220,7 @@ void vectorAdd(SScalarFuncParam* pLeft, SScalarFuncParam* pRight, void *out, int
}
}
void
vectorSub
(
SScalarFuncParam
*
pLeft
,
SScalarFuncParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
void
vectorSub
(
SScalarFuncParam
*
pLeft
,
SScalarFuncParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
int32_t
i
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
0
:
MAX
(
pLeft
->
num
,
pRight
->
num
)
-
1
;
int32_t
i
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
0
:
T
MAX
(
pLeft
->
num
,
pRight
->
num
)
-
1
;
int32_t
step
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
int32_t
step
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
double
*
output
=
(
double
*
)
out
;
double
*
output
=
(
double
*
)
out
;
...
@@ -257,7 +257,7 @@ void vectorSub(SScalarFuncParam* pLeft, SScalarFuncParam* pRight, void *out, int
...
@@ -257,7 +257,7 @@ void vectorSub(SScalarFuncParam* pLeft, SScalarFuncParam* pRight, void *out, int
}
}
}
}
void
vectorMultiply
(
SScalarFuncParam
*
pLeft
,
SScalarFuncParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
void
vectorMultiply
(
SScalarFuncParam
*
pLeft
,
SScalarFuncParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
int32_t
i
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
0
:
MAX
(
pLeft
->
num
,
pRight
->
num
)
-
1
;
int32_t
i
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
0
:
T
MAX
(
pLeft
->
num
,
pRight
->
num
)
-
1
;
int32_t
step
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
int32_t
step
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
double
*
output
=
(
double
*
)
out
;
double
*
output
=
(
double
*
)
out
;
...
@@ -296,7 +296,7 @@ void vectorMultiply(SScalarFuncParam* pLeft, SScalarFuncParam* pRight, void *out
...
@@ -296,7 +296,7 @@ void vectorMultiply(SScalarFuncParam* pLeft, SScalarFuncParam* pRight, void *out
}
}
void
vectorDivide
(
SScalarFuncParam
*
pLeft
,
SScalarFuncParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
void
vectorDivide
(
SScalarFuncParam
*
pLeft
,
SScalarFuncParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
int32_t
i
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
0
:
MAX
(
pLeft
->
num
,
pRight
->
num
)
-
1
;
int32_t
i
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
0
:
T
MAX
(
pLeft
->
num
,
pRight
->
num
)
-
1
;
int32_t
step
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
int32_t
step
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
double
*
output
=
(
double
*
)
out
;
double
*
output
=
(
double
*
)
out
;
...
@@ -342,7 +342,7 @@ void vectorDivide(SScalarFuncParam* pLeft, SScalarFuncParam* pRight, void *out,
...
@@ -342,7 +342,7 @@ void vectorDivide(SScalarFuncParam* pLeft, SScalarFuncParam* pRight, void *out,
}
}
void
vectorRemainder
(
SScalarFuncParam
*
pLeft
,
SScalarFuncParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
void
vectorRemainder
(
SScalarFuncParam
*
pLeft
,
SScalarFuncParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
int32_t
i
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
0
:
MAX
(
pLeft
->
num
,
pRight
->
num
)
-
1
;
int32_t
i
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
0
:
T
MAX
(
pLeft
->
num
,
pRight
->
num
)
-
1
;
int32_t
step
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
int32_t
step
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
double
*
output
=
(
double
*
)
out
;
double
*
output
=
(
double
*
)
out
;
...
@@ -416,7 +416,7 @@ void vectorRemainder(SScalarFuncParam* pLeft, SScalarFuncParam* pRight, void *ou
...
@@ -416,7 +416,7 @@ void vectorRemainder(SScalarFuncParam* pLeft, SScalarFuncParam* pRight, void *ou
void
vectorConcat
(
SScalarFuncParam
*
pLeft
,
SScalarFuncParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
void
vectorConcat
(
SScalarFuncParam
*
pLeft
,
SScalarFuncParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
int32_t
len
=
pLeft
->
bytes
+
pRight
->
bytes
;
int32_t
len
=
pLeft
->
bytes
+
pRight
->
bytes
;
int32_t
i
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
0
:
MAX
(
pLeft
->
num
,
pRight
->
num
)
-
1
;
int32_t
i
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
0
:
T
MAX
(
pLeft
->
num
,
pRight
->
num
)
-
1
;
int32_t
step
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
int32_t
step
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
char
*
output
=
(
char
*
)
out
;
char
*
output
=
(
char
*
)
out
;
...
...
source/libs/index/src/index_fst.c
浏览文件 @
92bef71e
...
@@ -152,7 +152,7 @@ uint64_t fstUnFinishedNodesFindCommPrefixAndSetOutput(FstUnFinishedNodes* node,
...
@@ -152,7 +152,7 @@ uint64_t fstUnFinishedNodesFindCommPrefixAndSetOutput(FstUnFinishedNodes* node,
uint64_t
addPrefix
=
0
;
uint64_t
addPrefix
=
0
;
uint8_t
*
data
=
fstSliceData
(
s
,
NULL
);
uint8_t
*
data
=
fstSliceData
(
s
,
NULL
);
if
(
t
&&
t
->
inp
==
data
[
i
])
{
if
(
t
&&
t
->
inp
==
data
[
i
])
{
uint64_t
commPrefix
=
MIN
(
t
->
out
,
*
out
);
uint64_t
commPrefix
=
T
MIN
(
t
->
out
,
*
out
);
uint64_t
tAddPrefix
=
t
->
out
-
commPrefix
;
uint64_t
tAddPrefix
=
t
->
out
-
commPrefix
;
(
*
out
)
=
(
*
out
)
-
commPrefix
;
(
*
out
)
=
(
*
out
)
-
commPrefix
;
t
->
out
=
commPrefix
;
t
->
out
=
commPrefix
;
...
@@ -244,8 +244,8 @@ void fstStateCompileForAnyTrans(FstCountingWriter* w, CompiledAddr addr, FstBuil
...
@@ -244,8 +244,8 @@ void fstStateCompileForAnyTrans(FstCountingWriter* w, CompiledAddr addr, FstBuil
bool
anyOuts
=
(
node
->
finalOutput
!=
0
);
bool
anyOuts
=
(
node
->
finalOutput
!=
0
);
for
(
size_t
i
=
0
;
i
<
sz
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
sz
;
i
++
)
{
FstTransition
*
t
=
taosArrayGet
(
node
->
trans
,
i
);
FstTransition
*
t
=
taosArrayGet
(
node
->
trans
,
i
);
tSize
=
MAX
(
tSize
,
packDeltaSize
(
addr
,
t
->
addr
));
tSize
=
T
MAX
(
tSize
,
packDeltaSize
(
addr
,
t
->
addr
));
oSize
=
MAX
(
oSize
,
packSize
(
t
->
out
));
oSize
=
T
MAX
(
oSize
,
packSize
(
t
->
out
));
anyOuts
=
anyOuts
||
(
t
->
out
!=
0
);
anyOuts
=
anyOuts
||
(
t
->
out
!=
0
);
}
}
...
...
source/libs/parser/src/astValidate.c
浏览文件 @
92bef71e
...
@@ -1353,7 +1353,7 @@ int32_t validateFillNode(SQueryStmtInfo *pQueryInfo, SSqlNode* pSqlNode, SMsgBuf
...
@@ -1353,7 +1353,7 @@ int32_t validateFillNode(SQueryStmtInfo *pQueryInfo, SSqlNode* pSqlNode, SMsgBuf
numOfFillVal
=
numOfFields
;
numOfFillVal
=
numOfFields
;
}
}
}
else
{
}
else
{
numOfFillVal
=
MIN
(
num
,
numOfFields
);
numOfFillVal
=
T
MIN
(
num
,
numOfFields
);
}
}
int32_t
j
=
1
;
int32_t
j
=
1
;
...
@@ -1928,7 +1928,7 @@ void setResultColName(char* name, tSqlExprItem* pItem, SToken* pToken, SToken* f
...
@@ -1928,7 +1928,7 @@ void setResultColName(char* name, tSqlExprItem* pItem, SToken* pToken, SToken* f
tstrncpy
(
name
,
pItem
->
aliasName
,
TSDB_COL_NAME_LEN
);
tstrncpy
(
name
,
pItem
->
aliasName
,
TSDB_COL_NAME_LEN
);
}
else
if
(
multiCols
)
{
}
else
if
(
multiCols
)
{
char
uname
[
TSDB_COL_NAME_LEN
]
=
{
0
};
char
uname
[
TSDB_COL_NAME_LEN
]
=
{
0
};
int32_t
len
=
MIN
(
pToken
->
n
+
1
,
TSDB_COL_NAME_LEN
);
int32_t
len
=
T
MIN
(
pToken
->
n
+
1
,
TSDB_COL_NAME_LEN
);
tstrncpy
(
uname
,
pToken
->
z
,
len
);
tstrncpy
(
uname
,
pToken
->
z
,
len
);
if
(
tsKeepOriginalColumnName
)
{
// keep the original column name
if
(
tsKeepOriginalColumnName
)
{
// keep the original column name
...
@@ -1944,7 +1944,7 @@ void setResultColName(char* name, tSqlExprItem* pItem, SToken* pToken, SToken* f
...
@@ -1944,7 +1944,7 @@ void setResultColName(char* name, tSqlExprItem* pItem, SToken* pToken, SToken* f
tstrncpy
(
name
,
tmp
,
TSDB_COL_NAME_LEN
);
tstrncpy
(
name
,
tmp
,
TSDB_COL_NAME_LEN
);
}
}
}
else
{
// use the user-input result column name
}
else
{
// use the user-input result column name
int32_t
len
=
MIN
(
pItem
->
pNode
->
exprToken
.
n
+
1
,
TSDB_COL_NAME_LEN
);
int32_t
len
=
T
MIN
(
pItem
->
pNode
->
exprToken
.
n
+
1
,
TSDB_COL_NAME_LEN
);
tstrncpy
(
name
,
pItem
->
pNode
->
exprToken
.
z
,
len
);
tstrncpy
(
name
,
pItem
->
pNode
->
exprToken
.
z
,
len
);
}
}
}
}
...
@@ -2948,7 +2948,7 @@ static SSchema createConstantColumnSchema(SVariant* pVal, const SToken* exprStr,
...
@@ -2948,7 +2948,7 @@ static SSchema createConstantColumnSchema(SVariant* pVal, const SToken* exprStr,
if
(
name
!=
NULL
)
{
if
(
name
!=
NULL
)
{
tstrncpy
(
s
.
name
,
name
,
sizeof
(
s
.
name
));
tstrncpy
(
s
.
name
,
name
,
sizeof
(
s
.
name
));
}
else
{
}
else
{
size_t
tlen
=
MIN
(
sizeof
(
s
.
name
),
exprStr
->
n
+
1
);
size_t
tlen
=
T
MIN
(
sizeof
(
s
.
name
),
exprStr
->
n
+
1
);
tstrncpy
(
s
.
name
,
exprStr
->
z
,
tlen
);
tstrncpy
(
s
.
name
,
exprStr
->
z
,
tlen
);
strdequote
(
s
.
name
);
strdequote
(
s
.
name
);
}
}
...
@@ -3026,7 +3026,7 @@ int32_t addProjectionExprAndResColumn(SQueryStmtInfo* pQueryInfo, tSqlExprItem*
...
@@ -3026,7 +3026,7 @@ int32_t addProjectionExprAndResColumn(SQueryStmtInfo* pQueryInfo, tSqlExprItem*
SSchema
colSchema
=
createConstantColumnSchema
(
&
pItem
->
pNode
->
value
,
&
pItem
->
pNode
->
exprToken
,
pItem
->
aliasName
);
SSchema
colSchema
=
createConstantColumnSchema
(
&
pItem
->
pNode
->
value
,
&
pItem
->
pNode
->
exprToken
,
pItem
->
aliasName
);
char
token
[
TSDB_COL_NAME_LEN
]
=
{
0
};
char
token
[
TSDB_COL_NAME_LEN
]
=
{
0
};
tstrncpy
(
token
,
pItem
->
pNode
->
exprToken
.
z
,
MIN
(
TSDB_COL_NAME_LEN
,
TSDB_COL_NAME_LEN
));
tstrncpy
(
token
,
pItem
->
pNode
->
exprToken
.
z
,
T
MIN
(
TSDB_COL_NAME_LEN
,
TSDB_COL_NAME_LEN
));
STableMetaInfo
*
pTableMetaInfo
=
getMetaInfo
(
pQueryInfo
,
index
.
tableIndex
);
STableMetaInfo
*
pTableMetaInfo
=
getMetaInfo
(
pQueryInfo
,
index
.
tableIndex
);
SColumn
c
=
createColumn
(
pTableMetaInfo
->
pTableMeta
->
uid
,
pTableMetaInfo
->
aliasName
,
index
.
type
,
&
colSchema
);
SColumn
c
=
createColumn
(
pTableMetaInfo
->
pTableMeta
->
uid
,
pTableMetaInfo
->
aliasName
,
index
.
type
,
&
colSchema
);
...
...
source/libs/parser/src/insertParser.c
浏览文件 @
92bef71e
...
@@ -156,7 +156,7 @@ static int32_t buildOutput(SInsertParseContext* pCxt) {
...
@@ -156,7 +156,7 @@ static int32_t buildOutput(SInsertParseContext* pCxt) {
taosHashGetClone
(
pCxt
->
pVgroupsHashObj
,
(
const
char
*
)
&
src
->
vgId
,
sizeof
(
src
->
vgId
),
&
dst
->
vg
);
taosHashGetClone
(
pCxt
->
pVgroupsHashObj
,
(
const
char
*
)
&
src
->
vgId
,
sizeof
(
src
->
vgId
),
&
dst
->
vg
);
dst
->
numOfTables
=
src
->
numOfTables
;
dst
->
numOfTables
=
src
->
numOfTables
;
dst
->
size
=
src
->
size
;
dst
->
size
=
src
->
size
;
SWAP
(
dst
->
pData
,
src
->
pData
,
char
*
);
T
SWAP
(
dst
->
pData
,
src
->
pData
,
char
*
);
buildMsgHeader
(
dst
);
buildMsgHeader
(
dst
);
taosArrayPush
(
pCxt
->
pOutput
->
pDataBlocks
,
&
dst
);
taosArrayPush
(
pCxt
->
pOutput
->
pDataBlocks
,
&
dst
);
}
}
...
...
source/libs/planner/src/physicalPlan.c
浏览文件 @
92bef71e
...
@@ -135,7 +135,7 @@ static SDataSink* createDataInserter(SPlanContext* pCxt, SVgDataBlocks* pBlocks,
...
@@ -135,7 +135,7 @@ static SDataSink* createDataInserter(SPlanContext* pCxt, SVgDataBlocks* pBlocks,
SDataInserter
*
inserter
=
(
SDataInserter
*
)
initDataSink
(
DSINK_Insert
,
sizeof
(
SDataInserter
),
pRoot
);
SDataInserter
*
inserter
=
(
SDataInserter
*
)
initDataSink
(
DSINK_Insert
,
sizeof
(
SDataInserter
),
pRoot
);
inserter
->
numOfTables
=
pBlocks
->
numOfTables
;
inserter
->
numOfTables
=
pBlocks
->
numOfTables
;
inserter
->
size
=
pBlocks
->
size
;
inserter
->
size
=
pBlocks
->
size
;
SWAP
(
inserter
->
pData
,
pBlocks
->
pData
,
char
*
);
T
SWAP
(
inserter
->
pData
,
pBlocks
->
pData
,
char
*
);
return
(
SDataSink
*
)
inserter
;
return
(
SDataSink
*
)
inserter
;
}
}
...
...
source/libs/qcom/src/queryUtil.c
浏览文件 @
92bef71e
...
@@ -85,7 +85,7 @@ static void* pTaskQueue = NULL;
...
@@ -85,7 +85,7 @@ static void* pTaskQueue = NULL;
int32_t
initTaskQueue
()
{
int32_t
initTaskQueue
()
{
double
factor
=
4
.
0
;
double
factor
=
4
.
0
;
int32_t
numOfThreads
=
MAX
((
int
)(
tsNumOfCores
*
tsNumOfThreadsPerCore
/
factor
),
2
);
int32_t
numOfThreads
=
T
MAX
((
int
)(
tsNumOfCores
*
tsNumOfThreadsPerCore
/
factor
),
2
);
int32_t
queueSize
=
tsMaxConnections
*
2
;
int32_t
queueSize
=
tsMaxConnections
*
2
;
pTaskQueue
=
taosInitScheduler
(
queueSize
,
numOfThreads
,
"tsc"
);
pTaskQueue
=
taosInitScheduler
(
queueSize
,
numOfThreads
,
"tsc"
);
...
...
source/libs/sync/inc/sync_type.h
浏览文件 @
92bef71e
...
@@ -43,12 +43,12 @@ typedef struct SSyncRaftLog SSyncRaftLog;
...
@@ -43,12 +43,12 @@ typedef struct SSyncRaftLog SSyncRaftLog;
typedef
struct
SSyncRaftEntry
SSyncRaftEntry
;
typedef
struct
SSyncRaftEntry
SSyncRaftEntry
;
#if 0
#if 0
#ifndef MIN
#ifndef
T
MIN
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#define
T
MIN(x, y) (((x) < (y)) ? (x) : (y))
#endif
#endif
#ifndef MAX
#ifndef
T
MAX
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#define
T
MAX(x, y) (((x) > (y)) ? (x) : (y))
#endif
#endif
#endif
#endif
...
...
source/libs/sync/src/sync_raft_progress.c
浏览文件 @
92bef71e
...
@@ -59,7 +59,7 @@ bool syncRaftProgressMaybeUpdate(SSyncRaftProgress* progress, SyncIndex lastInde
...
@@ -59,7 +59,7 @@ bool syncRaftProgressMaybeUpdate(SSyncRaftProgress* progress, SyncIndex lastInde
probeAcked
(
progress
);
probeAcked
(
progress
);
}
}
progress
->
nextIndex
=
MAX
(
progress
->
nextIndex
,
lastIndex
+
1
);
progress
->
nextIndex
=
T
MAX
(
progress
->
nextIndex
,
lastIndex
+
1
);
return
updated
;
return
updated
;
}
}
...
@@ -100,7 +100,7 @@ bool syncRaftProgressMaybeDecrTo(SSyncRaftProgress* progress,
...
@@ -100,7 +100,7 @@ bool syncRaftProgressMaybeDecrTo(SSyncRaftProgress* progress,
return
false
;
return
false
;
}
}
progress
->
nextIndex
=
MAX
(
MIN
(
rejected
,
matchHint
+
1
),
1
);
progress
->
nextIndex
=
TMAX
(
T
MIN
(
rejected
,
matchHint
+
1
),
1
);
progress
->
probeSent
=
false
;
progress
->
probeSent
=
false
;
return
true
;
return
true
;
...
@@ -166,7 +166,7 @@ void syncRaftProgressBecomeProbe(SSyncRaftProgress* progress) {
...
@@ -166,7 +166,7 @@ void syncRaftProgressBecomeProbe(SSyncRaftProgress* progress) {
if
(
progress
->
state
==
PROGRESS_STATE_SNAPSHOT
)
{
if
(
progress
->
state
==
PROGRESS_STATE_SNAPSHOT
)
{
SyncIndex
pendingSnapshotIndex
=
progress
->
pendingSnapshotIndex
;
SyncIndex
pendingSnapshotIndex
=
progress
->
pendingSnapshotIndex
;
resetProgressState
(
progress
,
PROGRESS_STATE_PROBE
);
resetProgressState
(
progress
,
PROGRESS_STATE_PROBE
);
progress
->
nextIndex
=
MAX
(
progress
->
matchIndex
+
1
,
pendingSnapshotIndex
+
1
);
progress
->
nextIndex
=
T
MAX
(
progress
->
matchIndex
+
1
,
pendingSnapshotIndex
+
1
);
}
else
{
}
else
{
resetProgressState
(
progress
,
PROGRESS_STATE_PROBE
);
resetProgressState
(
progress
,
PROGRESS_STATE_PROBE
);
progress
->
nextIndex
=
progress
->
matchIndex
+
1
;
progress
->
nextIndex
=
progress
->
matchIndex
+
1
;
...
...
source/libs/wal/src/walMeta.c
浏览文件 @
92bef71e
...
@@ -66,7 +66,7 @@ static inline int64_t walScanLogGetLastVer(SWal* pWal) {
...
@@ -66,7 +66,7 @@ static inline int64_t walScanLogGetLastVer(SWal* pWal) {
struct
stat
statbuf
;
struct
stat
statbuf
;
stat
(
fnameStr
,
&
statbuf
);
stat
(
fnameStr
,
&
statbuf
);
int
readSize
=
MIN
(
WAL_MAX_SIZE
+
2
,
statbuf
.
st_size
);
int
readSize
=
T
MIN
(
WAL_MAX_SIZE
+
2
,
statbuf
.
st_size
);
pLastFileInfo
->
fileSize
=
statbuf
.
st_size
;
pLastFileInfo
->
fileSize
=
statbuf
.
st_size
;
FileFd
fd
=
taosOpenFileRead
(
fnameStr
);
FileFd
fd
=
taosOpenFileRead
(
fnameStr
);
...
...
source/util/src/thash.c
浏览文件 @
92bef71e
...
@@ -67,7 +67,7 @@ static FORCE_INLINE void __wr_unlock(void *lock, int32_t type) {
...
@@ -67,7 +67,7 @@ static FORCE_INLINE void __wr_unlock(void *lock, int32_t type) {
}
}
static
FORCE_INLINE
int32_t
taosHashCapacity
(
int32_t
length
)
{
static
FORCE_INLINE
int32_t
taosHashCapacity
(
int32_t
length
)
{
int32_t
len
=
MIN
(
length
,
HASH_MAX_CAPACITY
);
int32_t
len
=
T
MIN
(
length
,
HASH_MAX_CAPACITY
);
int32_t
i
=
4
;
int32_t
i
=
4
;
while
(
i
<
len
)
i
=
(
i
<<
1u
);
while
(
i
<
len
)
i
=
(
i
<<
1u
);
...
...
tools/shell/src/shellEngine.c
浏览文件 @
92bef71e
...
@@ -751,56 +751,56 @@ static int calcColWidth(TAOS_FIELD *field, int precision) {
...
@@ -751,56 +751,56 @@ static int calcColWidth(TAOS_FIELD *field, int precision) {
switch
(
field
->
type
)
{
switch
(
field
->
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_BOOL
:
return
MAX
(
5
,
width
);
// 'false'
return
T
MAX
(
5
,
width
);
// 'false'
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_UTINYINT
:
case
TSDB_DATA_TYPE_UTINYINT
:
return
MAX
(
4
,
width
);
// '-127'
return
T
MAX
(
4
,
width
);
// '-127'
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_USMALLINT
:
case
TSDB_DATA_TYPE_USMALLINT
:
return
MAX
(
6
,
width
);
// '-32767'
return
T
MAX
(
6
,
width
);
// '-32767'
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_UINT
:
case
TSDB_DATA_TYPE_UINT
:
return
MAX
(
11
,
width
);
// '-2147483648'
return
T
MAX
(
11
,
width
);
// '-2147483648'
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
return
MAX
(
21
,
width
);
// '-9223372036854775807'
return
T
MAX
(
21
,
width
);
// '-9223372036854775807'
case
TSDB_DATA_TYPE_FLOAT
:
case
TSDB_DATA_TYPE_FLOAT
:
return
MAX
(
20
,
width
);
return
T
MAX
(
20
,
width
);
case
TSDB_DATA_TYPE_DOUBLE
:
case
TSDB_DATA_TYPE_DOUBLE
:
return
MAX
(
25
,
width
);
return
T
MAX
(
25
,
width
);
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_BINARY
:
if
(
field
->
bytes
>
tsMaxBinaryDisplayWidth
)
{
if
(
field
->
bytes
>
tsMaxBinaryDisplayWidth
)
{
return
MAX
(
tsMaxBinaryDisplayWidth
,
width
);
return
T
MAX
(
tsMaxBinaryDisplayWidth
,
width
);
}
else
{
}
else
{
return
MAX
(
field
->
bytes
,
width
);
return
T
MAX
(
field
->
bytes
,
width
);
}
}
case
TSDB_DATA_TYPE_NCHAR
:
{
case
TSDB_DATA_TYPE_NCHAR
:
{
int16_t
bytes
=
field
->
bytes
*
TSDB_NCHAR_SIZE
;
int16_t
bytes
=
field
->
bytes
*
TSDB_NCHAR_SIZE
;
if
(
bytes
>
tsMaxBinaryDisplayWidth
)
{
if
(
bytes
>
tsMaxBinaryDisplayWidth
)
{
return
MAX
(
tsMaxBinaryDisplayWidth
,
width
);
return
T
MAX
(
tsMaxBinaryDisplayWidth
,
width
);
}
else
{
}
else
{
return
MAX
(
bytes
,
width
);
return
T
MAX
(
bytes
,
width
);
}
}
}
}
case
TSDB_DATA_TYPE_TIMESTAMP
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
if
(
args
.
is_raw_time
)
{
if
(
args
.
is_raw_time
)
{
return
MAX
(
14
,
width
);
return
T
MAX
(
14
,
width
);
}
}
if
(
precision
==
TSDB_TIME_PRECISION_NANO
)
{
if
(
precision
==
TSDB_TIME_PRECISION_NANO
)
{
return
MAX
(
29
,
width
);
return
T
MAX
(
29
,
width
);
}
else
if
(
precision
==
TSDB_TIME_PRECISION_MICRO
)
{
}
else
if
(
precision
==
TSDB_TIME_PRECISION_MICRO
)
{
return
MAX
(
26
,
width
);
// '2020-01-01 00:00:00.000000'
return
T
MAX
(
26
,
width
);
// '2020-01-01 00:00:00.000000'
}
else
{
}
else
{
return
MAX
(
23
,
width
);
// '2020-01-01 00:00:00.000'
return
T
MAX
(
23
,
width
);
// '2020-01-01 00:00:00.000'
}
}
default:
default:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录