Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
loser646
TDengine
提交
372ac9c2
T
TDengine
项目概览
loser646
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
372ac9c2
编写于
12月 04, 2019
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[tbase-1282]
上级
30975a74
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
59 addition
and
51 deletion
+59
-51
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+1
-1
src/client/src/tscJoinProcess.c
src/client/src/tscJoinProcess.c
+1
-1
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+41
-40
src/client/src/tscServer.c
src/client/src/tscServer.c
+16
-9
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
372ac9c2
...
@@ -218,7 +218,7 @@ void addGroupInfoForSubquery(SSqlObj* pParentObj, SSqlObj* pSql, int32_t tableIn
...
@@ -218,7 +218,7 @@ void addGroupInfoForSubquery(SSqlObj* pParentObj, SSqlObj* pSql, int32_t tableIn
void
doAddGroupColumnForSubquery
(
SSqlCmd
*
pCmd
,
int32_t
tagIndex
);
void
doAddGroupColumnForSubquery
(
SSqlCmd
*
pCmd
,
int32_t
tagIndex
);
int16_t
tscGetJoinTagColIndexByUid
(
S
SqlCmd
*
pCm
d
,
uint64_t
uid
);
int16_t
tscGetJoinTagColIndexByUid
(
S
TagCond
*
pTagCon
d
,
uint64_t
uid
);
TAOS
*
taos_connect_a
(
char
*
ip
,
char
*
user
,
char
*
pass
,
char
*
db
,
uint16_t
port
,
void
(
*
fp
)(
void
*
,
TAOS_RES
*
,
int
),
TAOS
*
taos_connect_a
(
char
*
ip
,
char
*
user
,
char
*
pass
,
char
*
db
,
uint16_t
port
,
void
(
*
fp
)(
void
*
,
TAOS_RES
*
,
int
),
void
*
param
,
void
**
taos
);
void
*
param
,
void
**
taos
);
...
...
src/client/src/tscJoinProcess.c
浏览文件 @
372ac9c2
...
@@ -307,7 +307,7 @@ int32_t tscLaunchSecondSubquery(SSqlObj* pSql) {
...
@@ -307,7 +307,7 @@ int32_t tscLaunchSecondSubquery(SSqlObj* pSql) {
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
&
pNew
->
cmd
,
0
);
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
&
pNew
->
cmd
,
0
);
assert
(
pNew
->
cmd
.
tagCond
.
joinInfo
.
hasJoin
);
assert
(
pNew
->
cmd
.
tagCond
.
joinInfo
.
hasJoin
);
int16_t
tagColIndex
=
tscGetJoinTagColIndexByUid
(
&
pNew
->
cmd
,
pMeterMetaInfo
->
pMeterMeta
->
uid
);
int16_t
tagColIndex
=
tscGetJoinTagColIndexByUid
(
&
pNew
->
cmd
.
tagCond
,
pMeterMetaInfo
->
pMeterMeta
->
uid
);
pExpr
->
param
[
0
].
i64Key
=
tagColIndex
;
pExpr
->
param
[
0
].
i64Key
=
tagColIndex
;
pExpr
->
numOfParams
=
1
;
pExpr
->
numOfParams
=
1
;
...
...
src/client/src/tscSQLParser.c
浏览文件 @
372ac9c2
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include "taosmsg.h"
#include "taosmsg.h"
#include "tstoken.h"
#include "tstoken.h"
#include "ttime.h"
#include "ttime.h"
#include "tstrbuild.h"
#include "tscUtil.h"
#include "tscUtil.h"
#include "tschemautil.h"
#include "tschemautil.h"
...
@@ -3103,26 +3104,23 @@ static int32_t optrToString(tSQLExpr* pExpr, char** exprString) {
...
@@ -3103,26 +3104,23 @@ static int32_t optrToString(tSQLExpr* pExpr, char** exprString) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
tablenameListToString
(
tSQLExpr
*
pExpr
,
char
*
str
)
{
static
int32_t
tablenameListToString
(
tSQLExpr
*
pExpr
,
/*char* str*/
SStringBuilder
*
sb
)
{
tSQLExprList
*
pList
=
pExpr
->
pParam
;
tSQLExprList
*
pList
=
pExpr
->
pParam
;
if
(
pList
->
nExpr
<=
0
)
{
if
(
pList
->
nExpr
<=
0
)
{
return
TSDB_CODE_INVALID_SQL
;
return
TSDB_CODE_INVALID_SQL
;
}
}
if
(
pList
->
nExpr
>
0
)
{
if
(
pList
->
nExpr
>
0
)
{
strcpy
(
str
,
QUERY_COND_REL_PREFIX_IN
);
taosStringBuilderAppendStringLen
(
sb
,
QUERY_COND_REL_PREFIX_IN
,
QUERY_COND_REL_PREFIX_IN_LEN
);
str
+=
QUERY_COND_REL_PREFIX_IN_LEN
;
}
}
int32_t
len
=
0
;
int32_t
len
=
0
;
for
(
int32_t
i
=
0
;
i
<
pList
->
nExpr
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pList
->
nExpr
;
++
i
)
{
tSQLExpr
*
pSub
=
pList
->
a
[
i
].
pNode
;
tSQLExpr
*
pSub
=
pList
->
a
[
i
].
pNode
;
strncpy
(
str
+
len
,
pSub
->
val
.
pz
,
pSub
->
val
.
nLen
);
taosStringBuilderAppendStringLen
(
sb
,
pSub
->
val
.
pz
,
pSub
->
val
.
nLen
);
len
+=
pSub
->
val
.
nLen
;
if
(
i
<
pList
->
nExpr
-
1
)
{
if
(
i
<
pList
->
nExpr
-
1
)
{
str
[
len
++
]
=
TBNAME_LIST_SEP
[
0
]
;
taosStringBuilderAppendString
(
sb
,
TBNAME_LIST_SEP
)
;
}
}
if
(
pSub
->
val
.
nLen
<=
0
||
pSub
->
val
.
nLen
>
TSDB_METER_NAME_LEN
)
{
if
(
pSub
->
val
.
nLen
<=
0
||
pSub
->
val
.
nLen
>
TSDB_METER_NAME_LEN
)
{
...
@@ -3133,11 +3131,9 @@ static int32_t tablenameListToString(tSQLExpr* pExpr, char* str) {
...
@@ -3133,11 +3131,9 @@ static int32_t tablenameListToString(tSQLExpr* pExpr, char* str) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
tablenameCondToString
(
tSQLExpr
*
pExpr
,
char
*
str
)
{
static
int32_t
tablenameCondToString
(
tSQLExpr
*
pExpr
,
/*char* str*/
SStringBuilder
*
sb
)
{
strcpy
(
str
,
QUERY_COND_REL_PREFIX_LIKE
);
taosStringBuilderAppendStringLen
(
sb
,
QUERY_COND_REL_PREFIX_LIKE
,
QUERY_COND_REL_PREFIX_LIKE_LEN
);
str
+=
strlen
(
QUERY_COND_REL_PREFIX_LIKE
);
taosStringBuilderAppendString
(
sb
,
pExpr
->
val
.
pz
);
strcpy
(
str
,
pExpr
->
val
.
pz
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -3241,7 +3237,7 @@ static int32_t getTagCondString(SSqlCmd* pCmd, tSQLExpr* pExpr, char** str) {
...
@@ -3241,7 +3237,7 @@ static int32_t getTagCondString(SSqlCmd* pCmd, tSQLExpr* pExpr, char** str) {
return
tSQLExprLeafToString
(
pExpr
,
true
,
str
);
return
tSQLExprLeafToString
(
pExpr
,
true
,
str
);
}
}
static
int32_t
getTablenameCond
(
SSqlCmd
*
pCmd
,
tSQLExpr
*
pTableCond
,
char
*
str
)
{
static
int32_t
getTablenameCond
(
SSqlCmd
*
pCmd
,
tSQLExpr
*
pTableCond
,
/*char* str*/
SStringBuilder
*
sb
)
{
const
char
*
msg0
=
"invalid table name list"
;
const
char
*
msg0
=
"invalid table name list"
;
if
(
pTableCond
==
NULL
)
{
if
(
pTableCond
==
NULL
)
{
...
@@ -3258,9 +3254,9 @@ static int32_t getTablenameCond(SSqlCmd* pCmd, tSQLExpr* pTableCond, char* str)
...
@@ -3258,9 +3254,9 @@ static int32_t getTablenameCond(SSqlCmd* pCmd, tSQLExpr* pTableCond, char* str)
int32_t
ret
=
TSDB_CODE_SUCCESS
;
int32_t
ret
=
TSDB_CODE_SUCCESS
;
if
(
pTableCond
->
nSQLOptr
==
TK_IN
)
{
if
(
pTableCond
->
nSQLOptr
==
TK_IN
)
{
ret
=
tablenameListToString
(
pRight
,
s
tr
);
ret
=
tablenameListToString
(
pRight
,
s
b
);
}
else
if
(
pTableCond
->
nSQLOptr
==
TK_LIKE
)
{
}
else
if
(
pTableCond
->
nSQLOptr
==
TK_LIKE
)
{
ret
=
tablenameCondToString
(
pRight
,
s
tr
);
ret
=
tablenameCondToString
(
pRight
,
s
b
);
}
}
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
...
@@ -3828,8 +3824,7 @@ int tableNameCompar(const void* lhs, const void* rhs) {
...
@@ -3828,8 +3824,7 @@ int tableNameCompar(const void* lhs, const void* rhs) {
return
ret
>
0
?
1
:
-
1
;
return
ret
>
0
?
1
:
-
1
;
}
}
static
int32_t
setTableCondForMetricQuery
(
SSqlObj
*
pSql
,
tSQLExpr
*
pExpr
,
int16_t
tableCondIndex
,
static
int32_t
setTableCondForMetricQuery
(
SSqlObj
*
pSql
,
tSQLExpr
*
pExpr
,
int16_t
tableCondIndex
,
SStringBuilder
*
sb
)
{
char
*
tmpTableCondBuf
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
const
char
*
msg
=
"meter name too long"
;
const
char
*
msg
=
"meter name too long"
;
...
@@ -3842,26 +3837,25 @@ static int32_t setTableCondForMetricQuery(SSqlObj* pSql, tSQLExpr* pExpr, int16_
...
@@ -3842,26 +3837,25 @@ static int32_t setTableCondForMetricQuery(SSqlObj* pSql, tSQLExpr* pExpr, int16_
STagCond
*
pTagCond
=
&
pSql
->
cmd
.
tagCond
;
STagCond
*
pTagCond
=
&
pSql
->
cmd
.
tagCond
;
pTagCond
->
tbnameCond
.
uid
=
pMeterMetaInfo
->
pMeterMeta
->
uid
;
pTagCond
->
tbnameCond
.
uid
=
pMeterMetaInfo
->
pMeterMeta
->
uid
;
SString
*
pTableCond
=
&
pCmd
->
tagCond
.
tbnameCond
.
cond
;
SStringAlloc
(
pTableCond
,
4096
);
assert
(
pExpr
->
nSQLOptr
==
TK_LIKE
||
pExpr
->
nSQLOptr
==
TK_IN
);
assert
(
pExpr
->
nSQLOptr
==
TK_LIKE
||
pExpr
->
nSQLOptr
==
TK_IN
);
if
(
pExpr
->
nSQLOptr
==
TK_LIKE
)
{
if
(
pExpr
->
nSQLOptr
==
TK_LIKE
)
{
strcpy
(
pTableCond
->
z
,
tmpTableCondBuf
);
char
*
str
=
taosStringBuilderGetResult
(
sb
,
NULL
);
p
TableCond
->
n
=
strlen
(
pTableCond
->
z
);
p
Cmd
->
tagCond
.
tbnameCond
.
cond
=
strdup
(
str
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
strcpy
(
pTableCond
->
z
,
QUERY_COND_REL_PREFIX_IN
)
;
SStringBuilder
sb1
=
{
0
}
;
pTableCond
->
n
+=
strlen
(
QUERY_COND_REL_PREFIX_I
N
);
taosStringBuilderAppendStringLen
(
&
sb1
,
QUERY_COND_REL_PREFIX_IN
,
QUERY_COND_REL_PREFIX_IN_LE
N
);
char
db
[
TSDB_METER_ID_LEN
]
=
{
0
};
char
db
[
TSDB_METER_ID_LEN
]
=
{
0
};
// remove the duplicated input table names
// remove the duplicated input table names
int32_t
num
=
0
;
int32_t
num
=
0
;
char
**
segments
=
strsplit
(
tmpTableCondBuf
+
QUERY_COND_REL_PREFIX_IN_LEN
,
TBNAME_LIST_SEP
,
&
num
);
char
*
tableNameString
=
taosStringBuilderGetResult
(
sb
,
NULL
);
qsort
(
segments
,
num
,
sizeof
(
void
*
),
tableNameCompar
);
char
**
segments
=
strsplit
(
tableNameString
+
QUERY_COND_REL_PREFIX_IN_LEN
,
TBNAME_LIST_SEP
,
&
num
);
qsort
(
segments
,
num
,
POINTER_BYTES
,
tableNameCompar
);
int32_t
j
=
1
;
int32_t
j
=
1
;
for
(
int32_t
i
=
1
;
i
<
num
;
++
i
)
{
for
(
int32_t
i
=
1
;
i
<
num
;
++
i
)
{
...
@@ -3875,25 +3869,30 @@ static int32_t setTableCondForMetricQuery(SSqlObj* pSql, tSQLExpr* pExpr, int16_
...
@@ -3875,25 +3869,30 @@ static int32_t setTableCondForMetricQuery(SSqlObj* pSql, tSQLExpr* pExpr, int16_
char
*
acc
=
getAccountId
(
pSql
);
char
*
acc
=
getAccountId
(
pSql
);
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
SStringEnsureRemain
(
pTableCond
,
TSDB_METER_ID_LEN
);
if
(
i
>=
1
)
{
if
(
i
>=
1
)
{
pTableCond
->
z
[
pTableCond
->
n
++
]
=
TBNAME_LIST_SEP
[
0
]
;
taosStringBuilderAppendStringLen
(
&
sb1
,
TBNAME_LIST_SEP
,
1
)
;
}
}
char
idBuf
[
TSDB_METER_ID_LEN
+
1
]
=
{
0
};
int32_t
xlen
=
strlen
(
segments
[
i
]);
int32_t
xlen
=
strlen
(
segments
[
i
]);
SSQLToken
t
=
{.
z
=
segments
[
i
],
.
n
=
xlen
,
.
type
=
TK_STRING
};
SSQLToken
t
=
{.
z
=
segments
[
i
],
.
n
=
xlen
,
.
type
=
TK_STRING
};
int32_t
ret
=
setObjFullName
(
pTableCond
->
z
+
pTableCond
->
n
,
acc
,
&
dbToken
,
&
t
,
&
xlen
);
int32_t
ret
=
setObjFullName
(
idBuf
,
acc
,
&
dbToken
,
&
t
,
&
xlen
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
taosStringBuilderDestroy
(
&
sb1
);
tfree
(
segments
);
tfree
(
segments
);
invalidSqlErrMsg
(
pCmd
,
msg
);
invalidSqlErrMsg
(
pCmd
,
msg
);
return
ret
;
return
ret
;
}
}
pTableCond
->
n
+=
xlen
;
taosStringBuilderAppendString
(
&
sb1
,
idBuf
)
;
}
}
char
*
str
=
taosStringBuilderGetResult
(
&
sb1
,
NULL
);
pCmd
->
tagCond
.
tbnameCond
.
cond
=
strdup
(
str
);
taosStringBuilderDestroy
(
&
sb1
);
tfree
(
segments
);
tfree
(
segments
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -4071,10 +4070,9 @@ int32_t doParseWhereClause(SSqlObj* pSql, tSQLExpr** pExpr, SCondExpr* condExpr)
...
@@ -4071,10 +4070,9 @@ int32_t doParseWhereClause(SSqlObj* pSql, tSQLExpr** pExpr, SCondExpr* condExpr)
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
/*
/*
* tags query condition may be larger than 512bytes,
* tags query condition may be larger than 512bytes, therefore, we need to prepare enough large space
* therefore, we need to prepare enough large space
*/
*/
char
tableNameCond
[
TSDB_MAX_SQL_LEN
]
=
{
0
};
SStringBuilder
sb
=
{
0
};
int32_t
ret
=
TSDB_CODE_SUCCESS
;
int32_t
ret
=
TSDB_CODE_SUCCESS
;
if
((
ret
=
getQueryCondExpr
(
pCmd
,
pExpr
,
condExpr
,
&
type
,
(
*
pExpr
)
->
nSQLOptr
))
!=
TSDB_CODE_SUCCESS
)
{
if
((
ret
=
getQueryCondExpr
(
pCmd
,
pExpr
,
condExpr
,
&
type
,
(
*
pExpr
)
->
nSQLOptr
))
!=
TSDB_CODE_SUCCESS
)
{
...
@@ -4119,7 +4117,7 @@ int32_t doParseWhereClause(SSqlObj* pSql, tSQLExpr** pExpr, SCondExpr* condExpr)
...
@@ -4119,7 +4117,7 @@ int32_t doParseWhereClause(SSqlObj* pSql, tSQLExpr** pExpr, SCondExpr* condExpr)
}
}
// 4. get the table name query condition
// 4. get the table name query condition
if
((
ret
=
getTablenameCond
(
pCmd
,
condExpr
->
pTableCond
,
tableNameCond
))
!=
TSDB_CODE_SUCCESS
)
{
if
((
ret
=
getTablenameCond
(
pCmd
,
condExpr
->
pTableCond
,
&
sb
))
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
return
ret
;
}
}
...
@@ -4135,7 +4133,10 @@ int32_t doParseWhereClause(SSqlObj* pSql, tSQLExpr** pExpr, SCondExpr* condExpr)
...
@@ -4135,7 +4133,10 @@ int32_t doParseWhereClause(SSqlObj* pSql, tSQLExpr** pExpr, SCondExpr* condExpr)
// 7. query condition for table name
// 7. query condition for table name
pCmd
->
tagCond
.
relType
=
(
condExpr
->
relType
==
TK_AND
)
?
TSDB_RELATION_AND
:
TSDB_RELATION_OR
;
pCmd
->
tagCond
.
relType
=
(
condExpr
->
relType
==
TK_AND
)
?
TSDB_RELATION_AND
:
TSDB_RELATION_OR
;
ret
=
setTableCondForMetricQuery
(
pSql
,
condExpr
->
pTableCond
,
condExpr
->
tableCondIndex
,
tableNameCond
);
ret
=
setTableCondForMetricQuery
(
pSql
,
condExpr
->
pTableCond
,
condExpr
->
tableCondIndex
,
&
sb
);
taosStringBuilderDestroy
(
&
sb
);
if
(
!
validateFilterExpr
(
pCmd
))
{
if
(
!
validateFilterExpr
(
pCmd
))
{
return
invalidSqlErrMsg
(
pCmd
,
msg
);
return
invalidSqlErrMsg
(
pCmd
,
msg
);
}
}
...
@@ -5156,7 +5157,7 @@ void addGroupInfoForSubquery(SSqlObj* pParentObj, SSqlObj* pSql, int32_t tableIn
...
@@ -5156,7 +5157,7 @@ void addGroupInfoForSubquery(SSqlObj* pParentObj, SSqlObj* pSql, int32_t tableIn
if
(
pExpr
->
functionId
!=
TSDB_FUNC_TAG
)
{
if
(
pExpr
->
functionId
!=
TSDB_FUNC_TAG
)
{
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfo
(
&
pSql
->
cmd
,
0
);
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfo
(
&
pSql
->
cmd
,
0
);
int16_t
columnInfo
=
tscGetJoinTagColIndexByUid
(
pCm
d
,
pMeterMetaInfo
->
pMeterMeta
->
uid
);
int16_t
columnInfo
=
tscGetJoinTagColIndexByUid
(
&
pCmd
->
tagCon
d
,
pMeterMetaInfo
->
pMeterMeta
->
uid
);
SColumnIndex
index
=
{.
tableIndex
=
0
,
.
columnIndex
=
columnInfo
};
SColumnIndex
index
=
{.
tableIndex
=
0
,
.
columnIndex
=
columnInfo
};
SSchema
*
pSchema
=
tsGetTagSchema
(
pMeterMetaInfo
->
pMeterMeta
);
SSchema
*
pSchema
=
tsGetTagSchema
(
pMeterMetaInfo
->
pMeterMeta
);
...
...
src/client/src/tscServer.c
浏览文件 @
372ac9c2
...
@@ -689,7 +689,7 @@ int32_t tscLaunchJoinSubquery(SSqlObj *pSql, int16_t tableIndex, int16_t vnodeId
...
@@ -689,7 +689,7 @@ int32_t tscLaunchJoinSubquery(SSqlObj *pSql, int16_t tableIndex, int16_t vnodeId
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
&
pNew
->
cmd
,
0
);
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
&
pNew
->
cmd
,
0
);
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfo
(
&
pNew
->
cmd
,
0
);
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfo
(
&
pNew
->
cmd
,
0
);
int16_t
tagColIndex
=
tscGetJoinTagColIndexByUid
(
&
p
New
->
cm
d
,
pMeterMetaInfo
->
pMeterMeta
->
uid
);
int16_t
tagColIndex
=
tscGetJoinTagColIndexByUid
(
&
p
Supporter
->
tagCon
d
,
pMeterMetaInfo
->
pMeterMeta
->
uid
);
pExpr
->
param
->
i64Key
=
tagColIndex
;
pExpr
->
param
->
i64Key
=
tagColIndex
;
pExpr
->
numOfParams
=
1
;
pExpr
->
numOfParams
=
1
;
...
@@ -2741,10 +2741,14 @@ static int32_t tscEstimateMetricMetaMsgSize(SSqlCmd *pCmd) {
...
@@ -2741,10 +2741,14 @@ static int32_t tscEstimateMetricMetaMsgSize(SSqlCmd *pCmd) {
int32_t
n
=
0
;
int32_t
n
=
0
;
for
(
int32_t
i
=
0
;
i
<
pCmd
->
tagCond
.
numOfTagCond
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pCmd
->
tagCond
.
numOfTagCond
;
++
i
)
{
n
+=
pCmd
->
tagCond
.
cond
[
i
].
cond
.
n
;
n
+=
strlen
(
pCmd
->
tagCond
.
cond
[
i
].
cond
)
;
}
}
int32_t
tagLen
=
n
*
TSDB_NCHAR_SIZE
+
pCmd
->
tagCond
.
tbnameCond
.
cond
.
n
*
TSDB_NCHAR_SIZE
;
int32_t
tagLen
=
n
*
TSDB_NCHAR_SIZE
;
if
(
pCmd
->
tagCond
.
tbnameCond
.
cond
!=
NULL
)
{
tagLen
+=
strlen
(
pCmd
->
tagCond
.
tbnameCond
.
cond
)
*
TSDB_NCHAR_SIZE
;
}
int32_t
joinCondLen
=
(
TSDB_METER_ID_LEN
+
sizeof
(
int16_t
))
*
2
;
int32_t
joinCondLen
=
(
TSDB_METER_ID_LEN
+
sizeof
(
int16_t
))
*
2
;
int32_t
elemSize
=
sizeof
(
SMetricMetaElemMsg
)
*
pCmd
->
numOfTables
;
int32_t
elemSize
=
sizeof
(
SMetricMetaElemMsg
)
*
pCmd
->
numOfTables
;
...
@@ -2816,8 +2820,9 @@ int tscBuildMetricMetaMsg(SSqlObj *pSql) {
...
@@ -2816,8 +2820,9 @@ int tscBuildMetricMetaMsg(SSqlObj *pSql) {
if
(
pTagCond
->
numOfTagCond
>
0
)
{
if
(
pTagCond
->
numOfTagCond
>
0
)
{
SCond
*
pCond
=
tsGetMetricQueryCondPos
(
pTagCond
,
uid
);
SCond
*
pCond
=
tsGetMetricQueryCondPos
(
pTagCond
,
uid
);
if
(
pCond
!=
NULL
)
{
if
(
pCond
!=
NULL
)
{
condLen
=
pCond
->
cond
.
n
+
1
;
condLen
=
strlen
(
pCond
->
cond
)
+
1
;
bool
ret
=
taosMbsToUcs4
(
pCond
->
cond
.
z
,
pCond
->
cond
.
n
,
pMsg
,
pCond
->
cond
.
n
*
TSDB_NCHAR_SIZE
);
bool
ret
=
taosMbsToUcs4
(
pCond
->
cond
,
condLen
,
pMsg
,
condLen
*
TSDB_NCHAR_SIZE
);
if
(
!
ret
)
{
if
(
!
ret
)
{
tscError
(
"%p mbs to ucs4 failed:%s"
,
pSql
,
tsGetMetricQueryCondPos
(
pTagCond
,
uid
));
tscError
(
"%p mbs to ucs4 failed:%s"
,
pSql
,
tsGetMetricQueryCondPos
(
pTagCond
,
uid
));
return
0
;
return
0
;
...
@@ -2836,15 +2841,17 @@ int tscBuildMetricMetaMsg(SSqlObj *pSql) {
...
@@ -2836,15 +2841,17 @@ int tscBuildMetricMetaMsg(SSqlObj *pSql) {
offset
=
pMsg
-
(
char
*
)
pMetaMsg
;
offset
=
pMsg
-
(
char
*
)
pMetaMsg
;
pElem
->
tableCond
=
htonl
(
offset
);
pElem
->
tableCond
=
htonl
(
offset
);
pElem
->
tableCondLen
=
htonl
(
pTagCond
->
tbnameCond
.
cond
.
n
);
uint32_t
len
=
strlen
(
pTagCond
->
tbnameCond
.
cond
);
pElem
->
tableCondLen
=
htonl
(
len
);
memcpy
(
pMsg
,
pTagCond
->
tbnameCond
.
cond
.
z
,
pTagCond
->
tbnameCond
.
cond
.
n
);
memcpy
(
pMsg
,
pTagCond
->
tbnameCond
.
cond
,
le
n
);
pMsg
+=
pTagCond
->
tbnameCond
.
cond
.
n
;
pMsg
+=
le
n
;
}
}
SSqlGroupbyExpr
*
pGroupby
=
&
pCmd
->
groupbyExpr
;
SSqlGroupbyExpr
*
pGroupby
=
&
pCmd
->
groupbyExpr
;
if
(
pGroupby
->
tableIndex
!=
i
)
{
if
(
pGroupby
->
tableIndex
!=
i
&&
pGroupby
->
numOfGroupCols
>
0
)
{
pElem
->
orderType
=
0
;
pElem
->
orderType
=
0
;
pElem
->
orderIndex
=
0
;
pElem
->
orderIndex
=
0
;
pElem
->
numOfGroupCols
=
0
;
pElem
->
numOfGroupCols
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录