Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7d246d65
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
7d246d65
编写于
3月 19, 2021
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug
上级
a4eb0053
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
28 addition
and
9 deletion
+28
-9
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+21
-7
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+7
-2
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
7d246d65
...
...
@@ -2344,13 +2344,13 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
// todo REFACTOR
// set the first column ts for top/bottom query
SColumnIndex
index1
=
{
0
,
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
SColumnIndex
index1
=
{
index
.
tableIndex
,
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
pExpr
=
tscSqlExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS
,
&
index1
,
TSDB_DATA_TYPE_TIMESTAMP
,
TSDB_KEYSIZE
,
getNewResColId
(
pQueryInfo
),
TSDB_KEYSIZE
,
false
);
tstrncpy
(
pExpr
->
aliasName
,
aAggs
[
TSDB_FUNC_TS
].
name
,
sizeof
(
pExpr
->
aliasName
));
const
int32_t
TS_COLUMN_INDEX
=
PRIMARYKEY_TIMESTAMP_COL_INDEX
;
SColumnList
ids
=
getColumnList
(
1
,
0
,
TS_COLUMN_INDEX
);
SColumnList
ids
=
getColumnList
(
1
,
index
.
tableIndex
,
TS_COLUMN_INDEX
);
insertResultField
(
pQueryInfo
,
TS_COLUMN_INDEX
,
&
ids
,
TSDB_KEYSIZE
,
TSDB_DATA_TYPE_TIMESTAMP
,
aAggs
[
TSDB_FUNC_TS
].
name
,
pExpr
);
...
...
@@ -2363,7 +2363,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
memset
(
pExpr
->
aliasName
,
0
,
tListLen
(
pExpr
->
aliasName
));
getColumnName
(
pItem
,
pExpr
->
aliasName
,
sizeof
(
pExpr
->
aliasName
)
-
1
);
SColumnList
ids
=
getColumnList
(
1
,
0
,
index
.
columnIndex
);
SColumnList
ids
=
getColumnList
(
1
,
index
.
tableIndex
,
index
.
columnIndex
);
if
(
finalResult
)
{
insertResultField
(
pQueryInfo
,
colIndex
,
&
ids
,
resultSize
,
resultType
,
pExpr
->
aliasName
,
pExpr
);
}
else
{
...
...
@@ -3715,6 +3715,7 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
const
char
*
msg1
=
"table query cannot use tags filter"
;
const
char
*
msg2
=
"illegal column name"
;
const
char
*
msg3
=
"only one query time range allowed"
;
const
char
*
msg4
=
"too many join tables"
;
const
char
*
msg5
=
"not support ordinary column join"
;
const
char
*
msg6
=
"only one query condition on tbname allowed"
;
const
char
*
msg7
=
"only in/like allowed in filter table name"
;
...
...
@@ -3761,7 +3762,9 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
assert
(
index
.
tableIndex
>=
0
&&
index
.
tableIndex
<
TSDB_MAX_JOIN_TABLE_NUM
);
if
(
index
.
tableIndex
<
0
||
index
.
tableIndex
>=
TSDB_MAX_JOIN_TABLE_NUM
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
}
SJoinNode
**
rightNode
=
&
pQueryInfo
->
tagCond
.
joinInfo
.
joinTables
[
index
.
tableIndex
];
if
(
*
rightNode
==
NULL
)
{
...
...
@@ -4374,7 +4377,10 @@ void mergeJoinNodesImpl(int8_t* r, int8_t* p, int16_t* tidx, SJoinNode** nodes,
}
}
int32_t
mergeJoinNodes
(
SQueryInfo
*
pQueryInfo
)
{
int32_t
mergeJoinNodes
(
SQueryInfo
*
pQueryInfo
,
SSqlObj
*
pSql
)
{
const
char
*
msg1
=
"not all join tables have same timestamp"
;
const
char
*
msg2
=
"not all join tables have same tag"
;
int8_t
r
[
TSDB_MAX_JOIN_TABLE_NUM
]
=
{
0
};
int8_t
p
[
TSDB_MAX_JOIN_TABLE_NUM
]
=
{
0
};
...
...
@@ -4393,6 +4399,10 @@ int32_t mergeJoinNodes(SQueryInfo* pQueryInfo) {
memset
(
p
,
0
,
sizeof
(
p
));
}
if
(
taosArrayGetSize
(
pQueryInfo
->
tagCond
.
joinInfo
.
joinTables
[
0
]
->
tsJoin
)
!=
pQueryInfo
->
numOfTables
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
&
pSql
->
cmd
),
msg1
);
}
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
if
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
for
(
int16_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
...
...
@@ -4410,6 +4420,10 @@ int32_t mergeJoinNodes(SQueryInfo* pQueryInfo) {
memset
(
p
,
0
,
sizeof
(
p
));
}
if
(
taosArrayGetSize
(
pQueryInfo
->
tagCond
.
joinInfo
.
joinTables
[
0
]
->
tagJoin
)
!=
pQueryInfo
->
numOfTables
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
&
pSql
->
cmd
),
msg2
);
}
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -4489,13 +4503,13 @@ int32_t parseWhereClause(SQueryInfo* pQueryInfo, tSqlExpr** pExpr, SSqlObj* pSql
}
//doAddJoinTagsColumnsIntoTagList(&pSql->cmd, pQueryInfo, &condExpr);
if
(
pQueryInfo
->
tagCond
.
joinInfo
.
ha
sJoin
)
{
if
(
condExpr
.
t
sJoin
)
{
ret
=
validateJoinNodes
(
pQueryInfo
,
pSql
);
if
(
ret
)
{
goto
PARSE_WHERE_EXIT
;
}
ret
=
mergeJoinNodes
(
pQueryInfo
);
ret
=
mergeJoinNodes
(
pQueryInfo
,
pSql
);
if
(
ret
)
{
goto
PARSE_WHERE_EXIT
;
}
...
...
src/client/src/tscUtil.c
浏览文件 @
7d246d65
...
...
@@ -1619,10 +1619,15 @@ int32_t tscTagCondCopy(STagCond* dest, const STagCond* src) {
memcpy
(
dest
->
joinInfo
.
joinTables
[
i
],
src
->
joinInfo
.
joinTables
[
i
],
sizeof
(
SJoinNode
));
if
(
src
->
joinInfo
.
joinTables
[
i
]
->
tsJoin
)
{
dest
->
joinInfo
.
joinTables
[
i
]
->
tsJoin
=
taosArrayDup
(
src
->
joinInfo
.
joinTables
[
i
]
->
tsJoin
);
}
if
(
src
->
joinInfo
.
joinTables
[
i
]
->
tagJoin
)
{
dest
->
joinInfo
.
joinTables
[
i
]
->
tagJoin
=
taosArrayDup
(
src
->
joinInfo
.
joinTables
[
i
]
->
tagJoin
);
}
}
}
dest
->
relType
=
src
->
relType
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录