Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
d99b94a5
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d99b94a5
编写于
1月 07, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bugs referred in issue #1091. [tbase-1448]
上级
ff3ad278
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
34 deletion
+19
-34
src/client/src/tscAst.c
src/client/src/tscAst.c
+3
-0
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+11
-29
src/system/detail/src/vnodeUtil.c
src/system/detail/src/vnodeUtil.c
+5
-5
未找到文件。
src/client/src/tscAst.c
浏览文件 @
d99b94a5
...
@@ -115,6 +115,9 @@ static tSQLSyntaxNode *tSQLSyntaxNodeCreate(SSchema *pSchema, int32_t numOfCols,
...
@@ -115,6 +115,9 @@ static tSQLSyntaxNode *tSQLSyntaxNodeCreate(SSchema *pSchema, int32_t numOfCols,
int32_t
i
=
0
;
int32_t
i
=
0
;
if
(
pToken
->
type
==
TK_ID
)
{
if
(
pToken
->
type
==
TK_ID
)
{
do
{
do
{
SSQLToken
tableToken
=
{
0
};
extractTableNameFromToken
(
pToken
,
&
tableToken
);
size_t
len
=
strlen
(
pSchema
[
i
].
name
);
size_t
len
=
strlen
(
pSchema
[
i
].
name
);
if
(
strncmp
(
pToken
->
z
,
pSchema
[
i
].
name
,
pToken
->
n
)
==
0
&&
pToken
->
n
==
len
)
break
;
if
(
strncmp
(
pToken
->
z
,
pSchema
[
i
].
name
,
pToken
->
n
)
==
0
&&
pToken
->
n
==
len
)
break
;
}
while
(
++
i
<
numOfCols
);
}
while
(
++
i
<
numOfCols
);
...
...
src/client/src/tscSQLParser.c
浏览文件 @
d99b94a5
...
@@ -2876,31 +2876,14 @@ int32_t buildArithmeticExprString(tSQLExpr* pExpr, char** exprString) {
...
@@ -2876,31 +2876,14 @@ int32_t buildArithmeticExprString(tSQLExpr* pExpr, char** exprString) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
validateSQLExpr
(
tSQLExpr
*
pExpr
,
S
Schema
*
pSchema
,
int32_t
numOfCols
,
SColumnIdListRes
*
pList
)
{
static
int32_t
validateSQLExpr
(
tSQLExpr
*
pExpr
,
S
QueryInfo
*
pQueryInfo
,
SColumnList
*
pList
)
{
if
(
pExpr
->
nSQLOptr
==
TK_ID
)
{
if
(
pExpr
->
nSQLOptr
==
TK_ID
)
{
bool
validColumnName
=
false
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
&
pExpr
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
SColumnList
*
list
=
&
pList
->
list
;
return
TSDB_CODE_INVALID_SQL
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
if
(
strncasecmp
(
pExpr
->
colInfo
.
z
,
pSchema
[
i
].
name
,
pExpr
->
colInfo
.
n
)
==
0
&&
pExpr
->
colInfo
.
n
==
strlen
(
pSchema
[
i
].
name
))
{
if
(
pSchema
[
i
].
type
<
TSDB_DATA_TYPE_TINYINT
||
pSchema
[
i
].
type
>
TSDB_DATA_TYPE_DOUBLE
)
{
return
TSDB_CODE_INVALID_SQL
;
}
if
(
pList
!=
NULL
)
{
list
->
ids
[
list
->
num
++
].
columnIndex
=
(
int16_t
)
i
;
}
validColumnName
=
true
;
}
}
}
pList
->
ids
[
pList
->
num
++
].
columnIndex
=
index
.
columnIndex
;
if
(
!
validColumnName
)
{
return
TSDB_CODE_INVALID_SQL
;
}
}
else
if
(
pExpr
->
nSQLOptr
==
TK_FLOAT
&&
(
isnan
(
pExpr
->
val
.
dKey
)
||
isinf
(
pExpr
->
val
.
dKey
)))
{
}
else
if
(
pExpr
->
nSQLOptr
==
TK_FLOAT
&&
(
isnan
(
pExpr
->
val
.
dKey
)
||
isinf
(
pExpr
->
val
.
dKey
)))
{
return
TSDB_CODE_INVALID_SQL
;
return
TSDB_CODE_INVALID_SQL
;
}
else
if
(
pExpr
->
nSQLOptr
>=
TK_MIN
&&
pExpr
->
nSQLOptr
<=
TK_LAST_ROW
)
{
}
else
if
(
pExpr
->
nSQLOptr
>=
TK_MIN
&&
pExpr
->
nSQLOptr
<=
TK_LAST_ROW
)
{
...
@@ -2910,20 +2893,19 @@ static int32_t validateSQLExpr(tSQLExpr* pExpr, SSchema* pSchema, int32_t numOfC
...
@@ -2910,20 +2893,19 @@ static int32_t validateSQLExpr(tSQLExpr* pExpr, SSchema* pSchema, int32_t numOfC
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
validateArithmeticSQLExpr
(
tSQLExpr
*
pExpr
,
SSchema
*
pSchema
,
int32_t
numOfCols
,
static
int32_t
validateArithmeticSQLExpr
(
tSQLExpr
*
pExpr
,
SQueryInfo
*
pQueryInfo
,
SColumnList
*
pList
)
{
SColumnIdListRes
*
pList
)
{
if
(
pExpr
==
NULL
)
{
if
(
pExpr
==
NULL
)
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
tSQLExpr
*
pLeft
=
pExpr
->
pLeft
;
tSQLExpr
*
pLeft
=
pExpr
->
pLeft
;
if
(
pLeft
->
nSQLOptr
>=
TK_PLUS
&&
pLeft
->
nSQLOptr
<=
TK_REM
)
{
if
(
pLeft
->
nSQLOptr
>=
TK_PLUS
&&
pLeft
->
nSQLOptr
<=
TK_REM
)
{
int32_t
ret
=
validateArithmeticSQLExpr
(
pLeft
,
p
Schema
,
numOfCols
,
pList
);
int32_t
ret
=
validateArithmeticSQLExpr
(
pLeft
,
p
QueryInfo
,
pList
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
return
ret
;
}
}
}
else
{
}
else
{
int32_t
ret
=
validateSQLExpr
(
pLeft
,
p
Schema
,
numOfCols
,
pList
);
int32_t
ret
=
validateSQLExpr
(
pLeft
,
p
QueryInfo
,
pList
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
return
ret
;
}
}
...
@@ -2931,12 +2913,12 @@ static int32_t validateArithmeticSQLExpr(tSQLExpr* pExpr, SSchema* pSchema, int3
...
@@ -2931,12 +2913,12 @@ static int32_t validateArithmeticSQLExpr(tSQLExpr* pExpr, SSchema* pSchema, int3
tSQLExpr
*
pRight
=
pExpr
->
pRight
;
tSQLExpr
*
pRight
=
pExpr
->
pRight
;
if
(
pRight
->
nSQLOptr
>=
TK_PLUS
&&
pRight
->
nSQLOptr
<=
TK_REM
)
{
if
(
pRight
->
nSQLOptr
>=
TK_PLUS
&&
pRight
->
nSQLOptr
<=
TK_REM
)
{
int32_t
ret
=
validateArithmeticSQLExpr
(
pRight
,
p
Schema
,
numOfCols
,
pList
);
int32_t
ret
=
validateArithmeticSQLExpr
(
pRight
,
p
QueryInfo
,
pList
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
return
ret
;
}
}
}
else
{
}
else
{
int32_t
ret
=
validateSQLExpr
(
pRight
,
p
Schema
,
numOfCols
,
pList
);
int32_t
ret
=
validateSQLExpr
(
pRight
,
p
QueryInfo
,
pList
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
return
ret
;
}
}
...
...
src/system/detail/src/vnodeUtil.c
浏览文件 @
d99b94a5
...
@@ -195,9 +195,9 @@ static int32_t vnodeBuildExprFromArithmeticStr(SSqlFunctionExpr* pExpr, SQueryMe
...
@@ -195,9 +195,9 @@ static int32_t vnodeBuildExprFromArithmeticStr(SSqlFunctionExpr* pExpr, SQueryMe
num
=
i
+
1
;
num
=
i
+
1
;
pBinaryExprInfo
->
pReqColumns
=
malloc
(
sizeof
(
SColIndexEx
)
*
num
);
pBinaryExprInfo
->
pReqColumns
=
malloc
(
sizeof
(
SColIndexEx
)
*
num
);
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
for
(
int32_t
k
=
0
;
k
<
num
;
++
k
)
{
SColIndexEx
*
pColIndex
=
&
pBinaryExprInfo
->
pReqColumns
[
i
];
SColIndexEx
*
pColIndex
=
&
pBinaryExprInfo
->
pReqColumns
[
k
];
pColIndex
->
colId
=
ids
[
i
];
pColIndex
->
colId
=
ids
[
k
];
}
}
pBinaryExprInfo
->
numOfCols
=
num
;
pBinaryExprInfo
->
numOfCols
=
num
;
...
@@ -252,7 +252,7 @@ SSqlFunctionExpr* vnodeCreateSqlFunctionExpr(SQueryMeterMsg* pQueryMsg, int32_t*
...
@@ -252,7 +252,7 @@ SSqlFunctionExpr* vnodeCreateSqlFunctionExpr(SQueryMeterMsg* pQueryMsg, int32_t*
if
(
pColumnIndexExInfo
->
colIdx
>=
pQueryMsg
->
numOfTagsCols
)
{
if
(
pColumnIndexExInfo
->
colIdx
>=
pQueryMsg
->
numOfTagsCols
)
{
*
code
=
TSDB_CODE_INVALID_QUERY_MSG
;
*
code
=
TSDB_CODE_INVALID_QUERY_MSG
;
tfree
(
pExprs
);
tfree
(
pExprs
);
break
;
return
NULL
;
}
}
type
=
pTagSchema
[
pColumnIndexExInfo
->
colIdx
].
type
;
type
=
pTagSchema
[
pColumnIndexExInfo
->
colIdx
].
type
;
...
@@ -264,7 +264,7 @@ SSqlFunctionExpr* vnodeCreateSqlFunctionExpr(SQueryMeterMsg* pQueryMsg, int32_t*
...
@@ -264,7 +264,7 @@ SSqlFunctionExpr* vnodeCreateSqlFunctionExpr(SQueryMeterMsg* pQueryMsg, int32_t*
if
(
*
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
*
code
!=
TSDB_CODE_SUCCESS
)
{
tfree
(
pExprs
);
tfree
(
pExprs
);
break
;
return
NULL
;
}
}
type
=
TSDB_DATA_TYPE_DOUBLE
;
type
=
TSDB_DATA_TYPE_DOUBLE
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录