Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3beb2d1d
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1191
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看板
提交
3beb2d1d
编写于
12月 15, 2021
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-12014]<fix>: taosshell crash when apply arithmetic operation with select now
上级
ae919911
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
12 deletion
+17
-12
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+17
-12
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
3beb2d1d
...
@@ -2175,16 +2175,16 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS
...
@@ -2175,16 +2175,16 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS
pQueryInfo
->
colList
=
taosArrayInit
(
4
,
POINTER_BYTES
);
pQueryInfo
->
colList
=
taosArrayInit
(
4
,
POINTER_BYTES
);
}
}
bool
hasDistinct
=
false
;
bool
hasDistinct
=
false
;
bool
hasAgg
=
false
;
bool
hasAgg
=
false
;
size_t
numOfExpr
=
taosArrayGetSize
(
pSelNodeList
);
size_t
numOfExpr
=
taosArrayGetSize
(
pSelNodeList
);
int32_t
distIdx
=
-
1
;
int32_t
distIdx
=
-
1
;
for
(
int32_t
i
=
0
;
i
<
numOfExpr
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfExpr
;
++
i
)
{
int32_t
outputIndex
=
(
int32_t
)
tscNumOfExprs
(
pQueryInfo
);
int32_t
outputIndex
=
(
int32_t
)
tscNumOfExprs
(
pQueryInfo
);
tSqlExprItem
*
pItem
=
taosArrayGet
(
pSelNodeList
,
i
);
tSqlExprItem
*
pItem
=
taosArrayGet
(
pSelNodeList
,
i
);
if
(
hasDistinct
==
false
)
{
if
(
hasDistinct
==
false
)
{
hasDistinct
=
(
pItem
->
distinct
==
true
);
hasDistinct
=
(
pItem
->
distinct
==
true
);
distIdx
=
hasDistinct
?
i
:
-
1
;
distIdx
=
hasDistinct
?
i
:
-
1
;
}
}
if
(
pItem
->
aliasName
!=
NULL
&&
validateColumnName
(
pItem
->
aliasName
)
!=
TSDB_CODE_SUCCESS
){
if
(
pItem
->
aliasName
!=
NULL
&&
validateColumnName
(
pItem
->
aliasName
)
!=
TSDB_CODE_SUCCESS
){
...
@@ -2202,7 +2202,7 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS
...
@@ -2202,7 +2202,7 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS
return
code
;
return
code
;
}
}
}
else
if
(
type
==
SQL_NODE_SQLFUNCTION
)
{
}
else
if
(
type
==
SQL_NODE_SQLFUNCTION
)
{
hasAgg
=
true
;
hasAgg
=
true
;
if
(
hasDistinct
)
break
;
if
(
hasDistinct
)
break
;
pItem
->
pNode
->
functionId
=
isValidFunction
(
pItem
->
pNode
->
Expr
.
operand
.
z
,
pItem
->
pNode
->
Expr
.
operand
.
n
);
pItem
->
pNode
->
functionId
=
isValidFunction
(
pItem
->
pNode
->
Expr
.
operand
.
z
,
pItem
->
pNode
->
Expr
.
operand
.
n
);
...
@@ -2252,12 +2252,12 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS
...
@@ -2252,12 +2252,12 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS
}
}
}
}
//TODO(dengyihao), refactor as function
//TODO(dengyihao), refactor as function
//handle distinct func mixed with other func
//handle distinct func mixed with other func
if
(
hasDistinct
==
true
)
{
if
(
hasDistinct
==
true
)
{
if
(
distIdx
!=
0
||
hasAgg
)
{
if
(
distIdx
!=
0
||
hasAgg
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
}
}
if
(
joinQuery
)
{
if
(
joinQuery
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg6
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg6
);
}
}
...
@@ -2267,11 +2267,11 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS
...
@@ -2267,11 +2267,11 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS
if
(
pQueryInfo
->
pDownstream
!=
NULL
)
{
if
(
pQueryInfo
->
pDownstream
!=
NULL
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg8
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg8
);
}
}
pQueryInfo
->
distinct
=
true
;
pQueryInfo
->
distinct
=
true
;
}
}
// there is only one user-defined column in the final result field, add the timestamp column.
// there is only one user-defined column in the final result field, add the timestamp column.
size_t
numOfSrcCols
=
taosArrayGetSize
(
pQueryInfo
->
colList
);
size_t
numOfSrcCols
=
taosArrayGetSize
(
pQueryInfo
->
colList
);
if
((
numOfSrcCols
<=
0
||
!
hasNoneUserDefineExpr
(
pQueryInfo
))
&&
!
tscQueryTags
(
pQueryInfo
)
&&
!
tscQueryBlockInfo
(
pQueryInfo
))
{
if
((
numOfSrcCols
<=
0
||
!
hasNoneUserDefineExpr
(
pQueryInfo
))
&&
!
tscQueryTags
(
pQueryInfo
)
&&
!
tscQueryBlockInfo
(
pQueryInfo
))
{
...
@@ -4693,7 +4693,12 @@ static int32_t validateSQLExprItem(SSqlCmd* pCmd, tSqlExpr* pExpr,
...
@@ -4693,7 +4693,12 @@ static int32_t validateSQLExprItem(SSqlCmd* pCmd, tSqlExpr* pExpr,
if
(
pExpr
->
value
.
nType
==
(
uint32_t
)
-
1
)
{
if
(
pExpr
->
value
.
nType
==
(
uint32_t
)
-
1
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
}
//now allowing now +/- value in select expr
if
(
pExpr
->
tokenId
==
TK_TIMESTAMP
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
if
(
pExpr
->
type
==
SQL_NODE_VALUE
)
{
if
(
pExpr
->
type
==
SQL_NODE_VALUE
)
{
*
type
=
SQLEXPR_TYPE_VALUE
;
*
type
=
SQLEXPR_TYPE_VALUE
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录